@schema-forms-data/react 4.0.5 → 4.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.cjs +29 -29
  2. package/dist/index.js +6953 -6809
  3. 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 N=require("react"),o=require("react/jsx-runtime"),Ee=require("react-hook-form"),I=require("lucide-react"),xi=require("react-dom"),Kt=require("@dnd-kit/sortable"),ta=require("@dnd-kit/utilities"),Xt=require("@dnd-kit/core");function gi(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const g=gi(N),Pt=gi(I),ao=gi(xi);var D=(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))(D||{}),vi=(e=>(e.RASCUNHO="rascunho",e.ATIVO="ativo",e.INATIVO="inativo",e))(vi||{}),au=(e=>(e.CPF="cpf",e.TELEFONE="telefone",e.CEP="cep",e.CUSTOM="custom",e))(au||{});const qx={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"},Gx={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"},ou=()=>{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 console.warn("[schema-forms-data] generateId: crypto API indisponível neste ambiente. Usando Math.random() como fallback — NÃO USE em contextos de segurança."),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})},Nt=ou,su=/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/,iu=/^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/,lu=/^\d{5}-?\d{3}$/,cu=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,du=e=>{const t=e.replace(/\D/g,"");if(t.length!==11||/^(\d)\1{10}$/.test(t))return!1;const r=n=>{let a=0;for(let i=0;i<n;i++)a+=parseInt(t[i])*(n+1-i);const s=a*10%11;return s>=10?0:s};return r(9)===parseInt(t[9])&&r(10)===parseInt(t[10])},$e=(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,u="or"in e&&Array.isArray(e.or)&&e.or.length>0;return d&&u?(console.warn("[evaluateFieldCondition] FieldConditionGroup com `and` e `or` simultâneos — apenas `and` será avaliado."),e.and.every(m=>$e(m,t,r))):d?e.and.every(m=>$e(m,t,r)):u?e.or.some(m=>$e(m,t,r)):!0}const n=e;if(!n.campoId)return!0;const a=n.source==="evento"?r[n.campoId]:t[n.campoId];if(Array.isArray(a)){const d=n.valor;switch(n.operador){case"contem":return a.includes(d);case"naoContem":return!a.includes(d);case"vazio":return a.length===0;case"naoVazio":return a.length>0;case"igual":return a.length===1&&a[0]===d;case"diferente":return!(a.length===1&&a[0]===d);default:return!0}}const s=a==null||a===!1?"":a===!0?"1":String(a),i=n.valor!==void 0?String(n.valor):"",l=Number(s),c=Number(i);switch(n.operador){case"igual":return s===i;case"diferente":return s!==i;case"vazio":return!s;case"naoVazio":return!!s;case"contem":return s.includes(i);case"naoContem":return!s.includes(i);case"maiorQue":return!isNaN(l)&&!isNaN(c)?l>c:s>i;case"menorQue":return!isNaN(l)&&!isNaN(c)?l<c:s<i;case"maiorOuIgual":return!isNaN(l)&&!isNaN(c)?l>=c:s>=i;case"menorOuIgual":return!isNaN(l)&&!isNaN(c)?l<=c:s<=i;default:return!0}},bi=(e,t,r={})=>{const n={...t},a=[],s=[...e.containers].sort((i,l)=>i.ordem-l.ordem);for(const i of s){if(i.repeatable)continue;const l=$e(i.condicional,t,r),c=[...i.campos].sort((d,u)=>d.ordem-u.ordem);for(const d of c)if(!(l&&$e(d.condicional,t,r))){if(d.tipo===D.FILE){const m=n[d.nome];typeof m=="string"&&m&&a.push(m)}delete n[d.nome]}}return{cleaned:n,fileIdsToDelete:a}},Mn=new Map,Xx=e=>{if(Mn.has(e))return Mn.get(e);if(/^\/.*\/[gimsuy]*$/.test(e))return Mn.set(e,null),null;try{const t=new RegExp(e);return Mn.set(e,t),t}catch{return Mn.set(e,null),null}},es=(e,t,r)=>{const n=e.validacao;if(e.tipo===D.CHECKBOX||e.tipo===D.SWITCH)return e.obrigatorio&&!t?"Campo obrigatório":void 0;if(e.tipo===D.SLIDER){const s=t!=null&&t!==""?Number(t):NaN;return e.obrigatorio&&isNaN(s)?"Campo obrigatório":isNaN(s)?void 0:(n==null?void 0:n.min)!==void 0&&s<n.min?`Valor mínimo: ${n.min}`:(n==null?void 0:n.max)!==void 0&&s>n.max?`Valor máximo: ${n.max}`:void 0}if(e.tipo===D.RATING){const s=t!==void 0?Number(t):0;return e.obrigatorio&&(!s||s<1)?"Avaliação obrigatória":void 0}if(e.tipo===D.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===D.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===D.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===D.FILE)return e.obrigatorio&&!t?"Arquivo obrigatório":void 0;if(e.tipo===D.TERMS)return e.obrigatorio&&t!=="accepted"?"Você precisa aceitar os termos para continuar":void 0;if(e.tipo===D.NUMBER){const s=t!=null?String(t):"";if(e.obrigatorio&&!s)return"Campo obrigatório";if(!s)return;const i=Number(s);return isNaN(i)?"Deve ser um número":(n==null?void 0:n.min)!==void 0&&i<n.min?`Valor mínimo: ${n.min}`:(n==null?void 0:n.max)!==void 0&&i>n.max?`Valor máximo: ${n.max}`:void 0}if(e.tipo===D.SELECT||e.tipo===D.AUTOCOMPLETE||e.tipo===D.RADIO){const s=t!=null?String(t):"";return e.obrigatorio&&!s?"Campo obrigatório":s&&e.opcoes&&e.opcoes.length>0&&!e.opcoes.map(l=>String(l.valor)).includes(s)?"Opção inválida":void 0}const a=t!=null?String(t):"";if(e.obrigatorio&&!a.trim())return"Campo obrigatório";if(a){if(e.tipo===D.EMAIL&&!cu.test(a))return"E-mail inválido";if(e.tipo===D.CPF&&(!su.test(a)||!du(a)))return"CPF inválido";if(e.tipo===D.TELEFONE&&!iu.test(a))return"Telefone inválido";if(e.tipo===D.CEP&&!lu.test(a))return"CEP inválido";if(n!=null&&n.minLength&&a.length<n.minLength)return`Mínimo ${n.minLength} caracteres`;if(n!=null&&n.maxLength&&a.length>n.maxLength)return`Máximo ${n.maxLength} caracteres`;if((e.tipo===D.DATE||e.tipo===D.DATETIME)&&a){if(n!=null&&n.minDate&&a<n.minDate)return`Data mínima: ${n.minDate}`;if(n!=null&&n.maxDate&&a>n.maxDate)return`Data máxima: ${n.maxDate}`}if((e.tipo===D.DATE||e.tipo===D.DATETIME)&&a&&((n==null?void 0:n.minAge)!=null||(n==null?void 0:n.maxAge)!=null)){const s=a.split("T")[0],i=new Date(s+"T00:00:00"),l=r["evento.dataInicioEvento"],c=l?new Date(l.split("T")[0]+"T00:00:00"):new Date;let d=c.getFullYear()-i.getFullYear();const u=c.getMonth()-i.getMonth();if((u<0||u===0&&c.getDate()<i.getDate())&&d--,n.minAge!=null&&d<n.minAge)return`Idade mínima: ${n.minAge} ano${n.minAge!==1?"s":""}`;if(n.maxAge!=null&&d>n.maxAge)return`Idade máxima: ${n.maxAge} ano${n.maxAge!==1?"s":""}`}if(n!=null&&n.regex){const s=Xx(n.regex);if(s&&!s.test(a))return n.regexMessage||"Formato inválido"}}},yi=(e,t,r={})=>{var n;const a=[],s=[...e.containers].sort((i,l)=>i.ordem-l.ordem);for(const i of s){if(i.repeatable||!$e(i.condicional,t,r))continue;const c=[...i.campos].sort((d,u)=>d.ordem-u.ordem);for(const d of c){if(d.tipo===D.HIDDEN||d.isDisabled||d.isReadOnly||!$e(d.condicional,t,r))continue;if(d.tipo===D.FIELD_ARRAY){const p=Array.isArray(t[d.nome])?t[d.nome]:[];d.obrigatorio&&p.length===0?a.push({campo:d.nome,label:d.label,message:"Adicione pelo menos um item"}):d.minItems&&p.length<d.minItems?a.push({campo:d.nome,label:d.label,message:`Mínimo de ${d.minItems} item${d.minItems!==1?"s":""}`}):d.maxItems&&p.length>d.maxItems&&a.push({campo:d.nome,label:d.label,message:`Máximo de ${d.maxItems} item${d.maxItems!==1?"s":""}`});for(let f=0;f<p.length;f++){const v=p[f];if(v)for(const h of d.subFields??[]){if(h.isDisabled||h.isReadOnly||!$e(h.condicional,v,r))continue;const b=es(h,v[h.nome],r);b&&a.push({campo:`${d.nome}[${f}].${h.nome}`,label:h.label,message:b})}}continue}if(d.tipo===D.SUB_FORM){const p=t[d.nome]??{};d.obrigatorio&&Object.keys(p).length===0&&a.push({campo:d.nome,label:d.label,message:"Campo obrigatório"});for(const f of((n=d.subSchema)==null?void 0:n.fields)??[]){if(f.isDisabled||f.isReadOnly)continue;const v=es(f,p[f.nome],r);v&&a.push({campo:`${d.nome}.${f.nome}`,label:f.label,message:v})}continue}const m=es(d,t[d.nome],r);m&&a.push({campo:d.nome,label:d.label,message:m})}}return{valid:a.length===0,errors:a}},jt={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))"},Zx={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"},Kx={...jt,primary:"#18181b",primaryHover:"#27272a",accent:"#71717a",border:"#e4e4e7"},Yx={...jt,primary:"#1e3a5f",primaryHover:"#162d4a",accent:"#c9a84c"},Jx={...jt,primary:"#ec4899",primaryHover:"#db2777",accent:"#8b5cf6",background:"#0f0f1a",text:"#ffffff",textMuted:"#a78bfa"},Qx={...jt,primary:"#059669",primaryHover:"#047857",accent:"#6ee7b7"},eg={...jt,primary:"#0ea5e9",primaryHover:"#0284c7",accent:"#38bdf8"},tg={...jt,primary:"#6366f1",primaryHover:"#4f46e5",accent:"#818cf8"},rg={...jt,primary:"#d97706",primaryHover:"#b45309",accent:"#fbbf24"},ng={...jt,primary:"#10b981",primaryHover:"#059669",accent:"#34d399"},ag={...jt,primary:"#b45309",primaryHover:"#92400e",accent:"#f59e0b",background:"#0c0c0c",text:"#fafafa",textMuted:"#d4af37"},og={...jt,primary:"#dc2626",primaryHover:"#b91c1c",accent:"#f97316"},sg={...jt,primary:"#7c3aed",primaryHover:"#6d28d9",accent:"#a78bfa"},ig={primary:"#374151",primaryHover:"#1f2937",accent:"#6b7280",background:"#ffffff",surface:"#f9fafb",text:"#111827",textMuted:"#6b7280",border:"#e5e7eb",error:"#ef4444"},lg={primary:"#16a34a",primaryHover:"#15803d",accent:"#4ade80",background:"#fefce8",surface:"#ffffff",text:"#1c1917",textMuted:"#78716c",border:"#d6d3d1",error:"#dc2626"},cg={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"},Zr={moderno:{id:"moderno",displayName:"Moderno",colors:{...jt},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/30"},minimalista:{id:"minimalista",displayName:"Minimalista",colors:Kx,layout:{stepNavigation:"wizard",containerStyle:"flat",spacing:"relaxed",roundness:"rounded-lg",showProgressBar:!1,showStepIndicators:!1},wrapperClass:"bg-background"},card:{id:"card",displayName:"Card",colors:{...jt},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/40"},banner:{id:"banner",displayName:"Banner",colors:{...jt},layout:{stepNavigation:"tabs",containerStyle:"bordered",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},acampamento:{id:"acampamento",displayName:"Acampamento",colors:Zx,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:Yx,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:Jx,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0f0f1a]"},webinar:{id:"webinar",displayName:"Webinar",colors:eg,layout:{stepNavigation:"tabs",containerStyle:"card",spacing:"compact",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},retiro:{id:"retiro",displayName:"Retiro",colors:Qx,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:tg,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},social:{id:"social",displayName:"Social",colors:ng,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},workshop:{id:"workshop",displayName:"Workshop",colors:rg,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:ag,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0c0c0c]"},acao:{id:"acao",displayName:"Ação",colors:og,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},podcast:{id:"podcast",displayName:"Podcast",colors:sg,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},classico:{id:"classico",displayName:"Clássico",colors:ig,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:lg,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:cg,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]"}},oo=e=>e&&e in Zr?Zr[e]:Zr.moderno,dg=()=>Object.values(Zr),ug=e=>e.layout.containerStyle==="glassmorphism",uu=e=>e.colors.background.startsWith("#0")||e.colors.background.startsWith("rgba(0")||e.colors.text==="#ffffff";var zs={exports:{}},Vn={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("react"),o=require("react/jsx-runtime"),$e=require("react-hook-form"),O=require("lucide-react"),yi=require("react-dom"),Kt=require("@dnd-kit/sortable"),ra=require("@dnd-kit/utilities"),Xt=require("@dnd-kit/core");function wi(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const g=wi(j),Pt=wi(O),so=wi(yi);var P=(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))(P||{}),ki=(e=>(e.RASCUNHO="rascunho",e.ATIVO="ativo",e.INATIVO="inativo",e))(ki||{}),lu=(e=>(e.CPF="cpf",e.TELEFONE="telefone",e.CEP="cep",e.CUSTOM="custom",e))(lu||{});const Xx={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"},Zx={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"},cu=()=>{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 console.warn("[schema-forms-data] generateId: crypto API indisponível neste ambiente. Usando Math.random() como fallback — NÃO USE em contextos de segurança."),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})},Nt=cu,du=/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/,uu=/^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/,mu=/^\d{5}-?\d{3}$/,pu=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,fu=e=>{const t=e.replace(/\D/g,"");if(t.length!==11||/^(\d)\1{10}$/.test(t))return!1;const r=n=>{let a=0;for(let i=0;i<n;i++)a+=parseInt(t[i])*(n+1-i);const s=a*10%11;return s>=10?0:s};return r(9)===parseInt(t[9])&&r(10)===parseInt(t[10])},Se=(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,u="or"in e&&Array.isArray(e.or)&&e.or.length>0;return d&&u?(console.warn("[evaluateFieldCondition] FieldConditionGroup com `and` e `or` simultâneos — apenas `and` será avaliado."),e.and.every(m=>Se(m,t,r))):d?e.and.every(m=>Se(m,t,r)):u?e.or.some(m=>Se(m,t,r)):!0}const n=e;if(!n.campoId)return!0;const a=n.source==="evento"?r[n.campoId]:t[n.campoId];if(Array.isArray(a)){const d=n.valor;switch(n.operador){case"contem":return a.includes(d);case"naoContem":return!a.includes(d);case"vazio":return a.length===0;case"naoVazio":return a.length>0;case"igual":return a.length===1&&a[0]===d;case"diferente":return!(a.length===1&&a[0]===d);default:return!0}}const s=a==null||a===!1?"":a===!0?"1":String(a),i=n.valor!==void 0?String(n.valor):"",l=Number(s),c=Number(i);switch(n.operador){case"igual":return s===i;case"diferente":return s!==i;case"vazio":return!s;case"naoVazio":return!!s;case"contem":return s.includes(i);case"naoContem":return!s.includes(i);case"maiorQue":return!isNaN(l)&&!isNaN(c)?l>c:s>i;case"menorQue":return!isNaN(l)&&!isNaN(c)?l<c:s<i;case"maiorOuIgual":return!isNaN(l)&&!isNaN(c)?l>=c:s>=i;case"menorOuIgual":return!isNaN(l)&&!isNaN(c)?l<=c:s<=i;default:return!0}},ji=(e,t,r={})=>{const n={...t},a=[],s=[...e.containers].sort((i,l)=>i.ordem-l.ordem);for(const i of s){if(i.repeatable)continue;const l=Se(i.condicional,t,r),c=[...i.campos].sort((d,u)=>d.ordem-u.ordem);for(const d of c)if(!(l&&Se(d.condicional,t,r))){if(d.tipo===P.FILE){const m=n[d.nome];typeof m=="string"&&m&&a.push(m)}delete n[d.nome]}}return{cleaned:n,fileIdsToDelete:a}},Vn=new Map,Kx=e=>{if(Vn.has(e))return Vn.get(e);if(/^\/.*\/[gimsuy]*$/.test(e))return Vn.set(e,null),null;try{const t=new RegExp(e);return Vn.set(e,t),t}catch{return Vn.set(e,null),null}},as=(e,t,r)=>{const n=e.validacao;if(e.tipo===P.CHECKBOX||e.tipo===P.SWITCH)return e.obrigatorio&&!t?"Campo obrigatório":void 0;if(e.tipo===P.SLIDER){const s=t!=null&&t!==""?Number(t):NaN;return e.obrigatorio&&isNaN(s)?"Campo obrigatório":isNaN(s)?void 0:(n==null?void 0:n.min)!==void 0&&s<n.min?`Valor mínimo: ${n.min}`:(n==null?void 0:n.max)!==void 0&&s>n.max?`Valor máximo: ${n.max}`:void 0}if(e.tipo===P.RATING){const s=t!==void 0?Number(t):0;return e.obrigatorio&&(!s||s<1)?"Avaliação obrigatória":void 0}if(e.tipo===P.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===P.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===P.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===P.FILE)return e.obrigatorio&&!t?"Arquivo obrigatório":void 0;if(e.tipo===P.TERMS)return e.obrigatorio&&t!=="accepted"?"Você precisa aceitar os termos para continuar":void 0;if(e.tipo===P.NUMBER){const s=t!=null?String(t):"";if(e.obrigatorio&&!s)return"Campo obrigatório";if(!s)return;const i=Number(s);return isNaN(i)?"Deve ser um número":(n==null?void 0:n.min)!==void 0&&i<n.min?`Valor mínimo: ${n.min}`:(n==null?void 0:n.max)!==void 0&&i>n.max?`Valor máximo: ${n.max}`:void 0}if(e.tipo===P.SELECT||e.tipo===P.AUTOCOMPLETE||e.tipo===P.RADIO){const s=t!=null?String(t):"";return e.obrigatorio&&!s?"Campo obrigatório":s&&e.opcoes&&e.opcoes.length>0&&!e.opcoes.map(l=>String(l.valor)).includes(s)?"Opção inválida":void 0}const a=t!=null?String(t):"";if(e.obrigatorio&&!a.trim())return"Campo obrigatório";if(a){if(e.tipo===P.EMAIL&&!pu.test(a))return"E-mail inválido";if(e.tipo===P.CPF&&(!du.test(a)||!fu(a)))return"CPF inválido";if(e.tipo===P.TELEFONE&&!uu.test(a))return"Telefone inválido";if(e.tipo===P.CEP&&!mu.test(a))return"CEP inválido";if(n!=null&&n.minLength&&a.length<n.minLength)return`Mínimo ${n.minLength} caracteres`;if(n!=null&&n.maxLength&&a.length>n.maxLength)return`Máximo ${n.maxLength} caracteres`;if((e.tipo===P.DATE||e.tipo===P.DATETIME)&&a){if(n!=null&&n.minDate&&a<n.minDate)return`Data mínima: ${n.minDate}`;if(n!=null&&n.maxDate&&a>n.maxDate)return`Data máxima: ${n.maxDate}`}if((e.tipo===P.DATE||e.tipo===P.DATETIME)&&a&&((n==null?void 0:n.minAge)!=null||(n==null?void 0:n.maxAge)!=null)){const s=a.split("T")[0],i=new Date(s+"T00:00:00"),l=r["evento.dataInicioEvento"],c=l?new Date(l.split("T")[0]+"T00:00:00"):new Date;let d=c.getFullYear()-i.getFullYear();const u=c.getMonth()-i.getMonth();if((u<0||u===0&&c.getDate()<i.getDate())&&d--,n.minAge!=null&&d<n.minAge)return`Idade mínima: ${n.minAge} ano${n.minAge!==1?"s":""}`;if(n.maxAge!=null&&d>n.maxAge)return`Idade máxima: ${n.maxAge} ano${n.maxAge!==1?"s":""}`}if(n!=null&&n.regex){const s=Kx(n.regex);if(s&&!s.test(a))return n.regexMessage||"Formato inválido"}}},Ci=(e,t,r={})=>{var n;const a=[],s=[...e.containers].sort((i,l)=>i.ordem-l.ordem);for(const i of s){if(i.repeatable||!Se(i.condicional,t,r))continue;const c=[...i.campos].sort((d,u)=>d.ordem-u.ordem);for(const d of c){if(d.tipo===P.HIDDEN||d.isDisabled||d.isReadOnly||!Se(d.condicional,t,r))continue;if(d.tipo===P.FIELD_ARRAY){const p=Array.isArray(t[d.nome])?t[d.nome]:[];d.obrigatorio&&p.length===0?a.push({campo:d.nome,label:d.label,message:"Adicione pelo menos um item"}):d.minItems&&p.length<d.minItems?a.push({campo:d.nome,label:d.label,message:`Mínimo de ${d.minItems} item${d.minItems!==1?"s":""}`}):d.maxItems&&p.length>d.maxItems&&a.push({campo:d.nome,label:d.label,message:`Máximo de ${d.maxItems} item${d.maxItems!==1?"s":""}`});for(let f=0;f<p.length;f++){const v=p[f];if(v)for(const h of d.subFields??[]){if(h.isDisabled||h.isReadOnly||!Se(h.condicional,v,r))continue;const y=as(h,v[h.nome],r);y&&a.push({campo:`${d.nome}[${f}].${h.nome}`,label:h.label,message:y})}}continue}if(d.tipo===P.SUB_FORM){const p=t[d.nome]??{};d.obrigatorio&&Object.keys(p).length===0&&a.push({campo:d.nome,label:d.label,message:"Campo obrigatório"});for(const f of((n=d.subSchema)==null?void 0:n.fields)??[]){if(f.isDisabled||f.isReadOnly)continue;const v=as(f,p[f.nome],r);v&&a.push({campo:`${d.nome}.${f.nome}`,label:f.label,message:v})}continue}const m=as(d,t[d.nome],r);m&&a.push({campo:d.nome,label:d.label,message:m})}}return{valid:a.length===0,errors:a}},wt={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))"},Yx={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"},Jx={...wt,primary:"#18181b",primaryHover:"#27272a",accent:"#71717a",border:"#e4e4e7"},Qx={...wt,primary:"#1e3a5f",primaryHover:"#162d4a",accent:"#c9a84c"},eg={...wt,primary:"#ec4899",primaryHover:"#db2777",accent:"#8b5cf6",background:"#0f0f1a",text:"#ffffff",textMuted:"#a78bfa"},tg={...wt,primary:"#059669",primaryHover:"#047857",accent:"#6ee7b7"},rg={...wt,primary:"#0ea5e9",primaryHover:"#0284c7",accent:"#38bdf8"},ng={...wt,primary:"#6366f1",primaryHover:"#4f46e5",accent:"#818cf8"},ag={...wt,primary:"#d97706",primaryHover:"#b45309",accent:"#fbbf24"},og={...wt,primary:"#10b981",primaryHover:"#059669",accent:"#34d399"},sg={...wt,primary:"#b45309",primaryHover:"#92400e",accent:"#f59e0b",background:"#0c0c0c",text:"#fafafa",textMuted:"#d4af37"},ig={...wt,primary:"#dc2626",primaryHover:"#b91c1c",accent:"#f97316"},lg={...wt,primary:"#7c3aed",primaryHover:"#6d28d9",accent:"#a78bfa"},cg={primary:"#374151",primaryHover:"#1f2937",accent:"#6b7280",background:"#ffffff",surface:"#f9fafb",text:"#111827",textMuted:"#6b7280",border:"#e5e7eb",error:"#ef4444"},dg={primary:"#16a34a",primaryHover:"#15803d",accent:"#4ade80",background:"#fefce8",surface:"#ffffff",text:"#1c1917",textMuted:"#78716c",border:"#d6d3d1",error:"#dc2626"},ug={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"},Zr={moderno:{id:"moderno",displayName:"Moderno",colors:{...wt},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/30"},minimalista:{id:"minimalista",displayName:"Minimalista",colors:Jx,layout:{stepNavigation:"wizard",containerStyle:"flat",spacing:"relaxed",roundness:"rounded-lg",showProgressBar:!1,showStepIndicators:!1},wrapperClass:"bg-background"},card:{id:"card",displayName:"Card",colors:{...wt},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/40"},banner:{id:"banner",displayName:"Banner",colors:{...wt},layout:{stepNavigation:"tabs",containerStyle:"bordered",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},acampamento:{id:"acampamento",displayName:"Acampamento",colors:Yx,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:Qx,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:eg,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0f0f1a]"},webinar:{id:"webinar",displayName:"Webinar",colors:rg,layout:{stepNavigation:"tabs",containerStyle:"card",spacing:"compact",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},retiro:{id:"retiro",displayName:"Retiro",colors:tg,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:ng,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},social:{id:"social",displayName:"Social",colors:og,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},workshop:{id:"workshop",displayName:"Workshop",colors:ag,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:sg,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0c0c0c]"},acao:{id:"acao",displayName:"Ação",colors:ig,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},podcast:{id:"podcast",displayName:"Podcast",colors:lg,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},classico:{id:"classico",displayName:"Clássico",colors:cg,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:dg,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:ug,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]"}},io=e=>e&&e in Zr?Zr[e]:Zr.moderno,mg=()=>Object.values(Zr),pg=e=>e.layout.containerStyle==="glassmorphism",hu=e=>e.colors.background.startsWith("#0")||e.colors.background.startsWith("rgba(0")||e.colors.text==="#ffffff";var Bs={exports:{}},Bn={};/**
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 Xl;function mg(){if(Xl)return Vn;Xl=1;var e=N,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(l,c,d){var u,m={},p=null,f=null;d!==void 0&&(p=""+d),c.key!==void 0&&(p=""+c.key),c.ref!==void 0&&(f=c.ref);for(u in c)n.call(c,u)&&!s.hasOwnProperty(u)&&(m[u]=c[u]);if(l&&l.defaultProps)for(u in c=l.defaultProps,c)m[u]===void 0&&(m[u]=c[u]);return{$$typeof:t,type:l,key:p,ref:f,props:m,_owner:a.current}}return Vn.Fragment=r,Vn.jsx=i,Vn.jsxs=i,Vn}var xa={};/**
9
+ */var Jl;function fg(){if(Jl)return Bn;Jl=1;var e=j,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(l,c,d){var u,m={},p=null,f=null;d!==void 0&&(p=""+d),c.key!==void 0&&(p=""+c.key),c.ref!==void 0&&(f=c.ref);for(u in c)n.call(c,u)&&!s.hasOwnProperty(u)&&(m[u]=c[u]);if(l&&l.defaultProps)for(u in c=l.defaultProps,c)m[u]===void 0&&(m[u]=c[u]);return{$$typeof:t,type:l,key:p,ref:f,props:m,_owner:a.current}}return Bn.Fragment=r,Bn.jsx=i,Bn.jsxs=i,Bn}var va={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,25 +14,25 @@
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 Zl;function pg(){return Zl||(Zl=1,process.env.NODE_ENV!=="production"&&function(){var e=N,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),v=Symbol.iterator,h="@@iterator";function x(R){if(R===null||typeof R!="object")return null;var ee=v&&R[v]||R[h];return typeof ee=="function"?ee:null}var b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(R){{for(var ee=arguments.length,de=new Array(ee>1?ee-1:0),je=1;je<ee;je++)de[je-1]=arguments[je];j("error",R,de)}}function j(R,ee,de){{var je=b.ReactDebugCurrentFrame,Ie=je.getStackAddendum();Ie!==""&&(ee+="%s",de=de.concat([Ie]));var Le=de.map(function(Re){return String(Re)});Le.unshift("Warning: "+ee),Function.prototype.apply.call(console[R],console,Le)}}var w=!1,C=!1,S=!1,$=!1,k=!1,E;E=Symbol.for("react.module.reference");function T(R){return!!(typeof R=="string"||typeof R=="function"||R===n||R===s||k||R===a||R===d||R===u||$||R===f||w||C||S||typeof R=="object"&&R!==null&&(R.$$typeof===p||R.$$typeof===m||R.$$typeof===i||R.$$typeof===l||R.$$typeof===c||R.$$typeof===E||R.getModuleId!==void 0))}function O(R,ee,de){var je=R.displayName;if(je)return je;var Ie=ee.displayName||ee.name||"";return Ie!==""?de+"("+Ie+")":de}function L(R){return R.displayName||"Context"}function A(R){if(R==null)return null;if(typeof R.tag=="number"&&y("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 n:return"Fragment";case r:return"Portal";case s:return"Profiler";case a:return"StrictMode";case d:return"Suspense";case u:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case l:var ee=R;return L(ee)+".Consumer";case i:var de=R;return L(de._context)+".Provider";case c:return O(R,R.render,"ForwardRef");case m:var je=R.displayName||null;return je!==null?je:A(R.type)||"Memo";case p:{var Ie=R,Le=Ie._payload,Re=Ie._init;try{return A(Re(Le))}catch{return null}}}return null}var z=Object.assign,X=0,q,Z,V,M,_,se,U;function Q(){}Q.__reactDisabledLog=!0;function Y(){{if(X===0){q=console.log,Z=console.info,V=console.warn,M=console.error,_=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})}X++}}function H(){{if(X--,X===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},R,{value:q}),info:z({},R,{value:Z}),warn:z({},R,{value:V}),error:z({},R,{value:M}),group:z({},R,{value:_}),groupCollapsed:z({},R,{value:se}),groupEnd:z({},R,{value:U})})}X<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var W=b.ReactCurrentDispatcher,G;function ne(R,ee,de){{if(G===void 0)try{throw Error()}catch(Ie){var je=Ie.stack.trim().match(/\n( *(at )?)/);G=je&&je[1]||""}return`
18
- `+G+R}}var J=!1,te;{var ce=typeof WeakMap=="function"?WeakMap:Map;te=new ce}function be(R,ee){if(!R||J)return"";{var de=te.get(R);if(de!==void 0)return de}var je;J=!0;var Ie=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Le;Le=W.current,W.current=null,Y();try{if(ee){var Re=function(){throw Error()};if(Object.defineProperty(Re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Re,[])}catch(vt){je=vt}Reflect.construct(R,[],Re)}else{try{Re.call()}catch(vt){je=vt}R.call(Re.prototype)}}else{try{throw Error()}catch(vt){je=vt}R()}}catch(vt){if(vt&&je&&typeof vt.stack=="string"){for(var De=vt.stack.split(`
19
- `),ut=je.stack.split(`
20
- `),Ue=De.length-1,Ye=ut.length-1;Ue>=1&&Ye>=0&&De[Ue]!==ut[Ye];)Ye--;for(;Ue>=1&&Ye>=0;Ue--,Ye--)if(De[Ue]!==ut[Ye]){if(Ue!==1||Ye!==1)do if(Ue--,Ye--,Ye<0||De[Ue]!==ut[Ye]){var Ot=`
21
- `+De[Ue].replace(" at new "," at ");return R.displayName&&Ot.includes("<anonymous>")&&(Ot=Ot.replace("<anonymous>",R.displayName)),typeof R=="function"&&te.set(R,Ot),Ot}while(Ue>=1&&Ye>=0);break}}}finally{J=!1,W.current=Le,H(),Error.prepareStackTrace=Ie}var ln=R?R.displayName||R.name:"",Hr=ln?ne(ln):"";return typeof R=="function"&&te.set(R,Hr),Hr}function Ce(R,ee,de){return be(R,!1)}function ve(R){var ee=R.prototype;return!!(ee&&ee.isReactComponent)}function me(R,ee,de){if(R==null)return"";if(typeof R=="function")return be(R,ve(R));if(typeof R=="string")return ne(R);switch(R){case d:return ne("Suspense");case u:return ne("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case c:return Ce(R.render);case m:return me(R.type,ee,de);case p:{var je=R,Ie=je._payload,Le=je._init;try{return me(Le(Ie),ee,de)}catch{}}}return""}var Te=Object.prototype.hasOwnProperty,ze={},dt=b.ReactDebugCurrentFrame;function Ve(R){if(R){var ee=R._owner,de=me(R.type,R._source,ee?ee.type:null);dt.setExtraStackFrame(de)}else dt.setExtraStackFrame(null)}function P(R,ee,de,je,Ie){{var Le=Function.call.bind(Te);for(var Re in R)if(Le(R,Re)){var De=void 0;try{if(typeof R[Re]!="function"){var ut=Error((je||"React class")+": "+de+" type `"+Re+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[Re]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ut.name="Invariant Violation",ut}De=R[Re](ee,Re,je,de,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ue){De=Ue}De&&!(De instanceof Error)&&(Ve(Ie),y("%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).",je||"React class",de,Re,typeof De),Ve(null)),De instanceof Error&&!(De.message in ze)&&(ze[De.message]=!0,Ve(Ie),y("Failed %s type: %s",de,De.message),Ve(null))}}}var F=Array.isArray;function B(R){return F(R)}function le(R){{var ee=typeof Symbol=="function"&&Symbol.toStringTag,de=ee&&R[Symbol.toStringTag]||R.constructor.name||"Object";return de}}function oe(R){try{return re(R),!1}catch{return!0}}function re(R){return""+R}function ye(R){if(oe(R))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",le(R)),re(R)}var Pe=b.ReactCurrentOwner,_e={key:!0,ref:!0,__self:!0,__source:!0},st,er;function tr(R){if(Te.call(R,"ref")){var ee=Object.getOwnPropertyDescriptor(R,"ref").get;if(ee&&ee.isReactWarning)return!1}return R.ref!==void 0}function Xo(R){if(Te.call(R,"key")){var ee=Object.getOwnPropertyDescriptor(R,"key").get;if(ee&&ee.isReactWarning)return!1}return R.key!==void 0}function zn(R,ee){typeof R.ref=="string"&&Pe.current}function Ln(R,ee){{var de=function(){st||(st=!0,y("%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)",ee))};de.isReactWarning=!0,Object.defineProperty(R,"key",{get:de,configurable:!0})}}function Zo(R,ee){{var de=function(){er||(er=!0,y("%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)",ee))};de.isReactWarning=!0,Object.defineProperty(R,"ref",{get:de,configurable:!0})}}var ha=function(R,ee,de,je,Ie,Le,Re){var De={$$typeof:t,type:R,key:ee,ref:de,props:Re,_owner:Le};return De._store={},Object.defineProperty(De._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(De,"_self",{configurable:!1,enumerable:!1,writable:!1,value:je}),Object.defineProperty(De,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ie}),Object.freeze&&(Object.freeze(De.props),Object.freeze(De)),De};function Ko(R,ee,de,je,Ie){{var Le,Re={},De=null,ut=null;de!==void 0&&(ye(de),De=""+de),Xo(ee)&&(ye(ee.key),De=""+ee.key),tr(ee)&&(ut=ee.ref,zn(ee));for(Le in ee)Te.call(ee,Le)&&!_e.hasOwnProperty(Le)&&(Re[Le]=ee[Le]);if(R&&R.defaultProps){var Ue=R.defaultProps;for(Le in Ue)Re[Le]===void 0&&(Re[Le]=Ue[Le])}if(De||ut){var Ye=typeof R=="function"?R.displayName||R.name||"Unknown":R;De&&Ln(Re,Ye),ut&&Zo(Re,Ye)}return ha(R,De,ut,Ie,je,Pe.current,Re)}}var on=b.ReactCurrentOwner,Vl=b.ReactDebugCurrentFrame;function sn(R){if(R){var ee=R._owner,de=me(R.type,R._source,ee?ee.type:null);Vl.setExtraStackFrame(de)}else Vl.setExtraStackFrame(null)}var Yo;Yo=!1;function Jo(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function Bl(){{if(on.current){var R=A(on.current.type);if(R)return`
17
+ */var Ql;function hg(){return Ql||(Ql=1,process.env.NODE_ENV!=="production"&&function(){var e=j,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),v=Symbol.iterator,h="@@iterator";function x(_){if(_===null||typeof _!="object")return null;var ee=v&&_[v]||_[h];return typeof ee=="function"?ee:null}var y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(_){{for(var ee=arguments.length,de=new Array(ee>1?ee-1:0),ke=1;ke<ee;ke++)de[ke-1]=arguments[ke];k("error",_,de)}}function k(_,ee,de){{var ke=y.ReactDebugCurrentFrame,Pe=ke.getStackAddendum();Pe!==""&&(ee+="%s",de=de.concat([Pe]));var Oe=de.map(function(Ae){return String(Ae)});Oe.unshift("Warning: "+ee),Function.prototype.apply.call(console[_],console,Oe)}}var w=!1,N=!1,S=!1,A=!1,C=!1,E;E=Symbol.for("react.module.reference");function $(_){return!!(typeof _=="string"||typeof _=="function"||_===n||_===s||C||_===a||_===d||_===u||A||_===f||w||N||S||typeof _=="object"&&_!==null&&(_.$$typeof===p||_.$$typeof===m||_.$$typeof===i||_.$$typeof===l||_.$$typeof===c||_.$$typeof===E||_.getModuleId!==void 0))}function I(_,ee,de){var ke=_.displayName;if(ke)return ke;var Pe=ee.displayName||ee.name||"";return Pe!==""?de+"("+Pe+")":de}function L(_){return _.displayName||"Context"}function D(_){if(_==null)return null;if(typeof _.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof _=="function")return _.displayName||_.name||null;if(typeof _=="string")return _;switch(_){case n:return"Fragment";case r:return"Portal";case s:return"Profiler";case a:return"StrictMode";case d:return"Suspense";case u:return"SuspenseList"}if(typeof _=="object")switch(_.$$typeof){case l:var ee=_;return L(ee)+".Consumer";case i:var de=_;return L(de._context)+".Provider";case c:return I(_,_.render,"ForwardRef");case m:var ke=_.displayName||null;return ke!==null?ke:D(_.type)||"Memo";case p:{var Pe=_,Oe=Pe._payload,Ae=Pe._init;try{return D(Ae(Oe))}catch{return null}}}return null}var z=Object.assign,H=0,U,Z,V,M,R,oe,ge;function q(){}q.__reactDisabledLog=!0;function G(){{if(H===0){U=console.log,Z=console.info,V=console.warn,M=console.error,R=console.group,oe=console.groupCollapsed,ge=console.groupEnd;var _={configurable:!0,enumerable:!0,value:q,writable:!0};Object.defineProperties(console,{info:_,log:_,warn:_,error:_,group:_,groupCollapsed:_,groupEnd:_})}H++}}function ne(){{if(H--,H===0){var _={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},_,{value:U}),info:z({},_,{value:Z}),warn:z({},_,{value:V}),error:z({},_,{value:M}),group:z({},_,{value:R}),groupCollapsed:z({},_,{value:oe}),groupEnd:z({},_,{value:ge})})}H<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var W=y.ReactCurrentDispatcher,X;function re(_,ee,de){{if(X===void 0)try{throw Error()}catch(Pe){var ke=Pe.stack.trim().match(/\n( *(at )?)/);X=ke&&ke[1]||""}return`
18
+ `+X+_}}var K=!1,J;{var ce=typeof WeakMap=="function"?WeakMap:Map;J=new ce}function se(_,ee){if(!_||K)return"";{var de=J.get(_);if(de!==void 0)return de}var ke;K=!0;var Pe=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Oe;Oe=W.current,W.current=null,G();try{if(ee){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(gt){ke=gt}Reflect.construct(_,[],Ae)}else{try{Ae.call()}catch(gt){ke=gt}_.call(Ae.prototype)}}else{try{throw Error()}catch(gt){ke=gt}_()}}catch(gt){if(gt&&ke&&typeof gt.stack=="string"){for(var Ee=gt.stack.split(`
19
+ `),dt=ke.stack.split(`
20
+ `),Ue=Ee.length-1,Ye=dt.length-1;Ue>=1&&Ye>=0&&Ee[Ue]!==dt[Ye];)Ye--;for(;Ue>=1&&Ye>=0;Ue--,Ye--)if(Ee[Ue]!==dt[Ye]){if(Ue!==1||Ye!==1)do if(Ue--,Ye--,Ye<0||Ee[Ue]!==dt[Ye]){var Ot=`
21
+ `+Ee[Ue].replace(" at new "," at ");return _.displayName&&Ot.includes("<anonymous>")&&(Ot=Ot.replace("<anonymous>",_.displayName)),typeof _=="function"&&J.set(_,Ot),Ot}while(Ue>=1&&Ye>=0);break}}}finally{K=!1,W.current=Oe,ne(),Error.prepareStackTrace=Pe}var ln=_?_.displayName||_.name:"",Hr=ln?re(ln):"";return typeof _=="function"&&J.set(_,Hr),Hr}function ye(_,ee,de){return se(_,!1)}function be(_){var ee=_.prototype;return!!(ee&&ee.isReactComponent)}function Fe(_,ee,de){if(_==null)return"";if(typeof _=="function")return se(_,be(_));if(typeof _=="string")return re(_);switch(_){case d:return re("Suspense");case u:return re("SuspenseList")}if(typeof _=="object")switch(_.$$typeof){case c:return ye(_.render);case m:return Fe(_.type,ee,de);case p:{var ke=_,Pe=ke._payload,Oe=ke._init;try{return Fe(Oe(Pe),ee,de)}catch{}}}return""}var Le=Object.prototype.hasOwnProperty,Ve={},Ct=y.ReactDebugCurrentFrame;function Me(_){if(_){var ee=_._owner,de=Fe(_.type,_._source,ee?ee.type:null);Ct.setExtraStackFrame(de)}else Ct.setExtraStackFrame(null)}function T(_,ee,de,ke,Pe){{var Oe=Function.call.bind(Le);for(var Ae in _)if(Oe(_,Ae)){var Ee=void 0;try{if(typeof _[Ae]!="function"){var dt=Error((ke||"React class")+": "+de+" type `"+Ae+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof _[Ae]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw dt.name="Invariant Violation",dt}Ee=_[Ae](ee,Ae,ke,de,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ue){Ee=Ue}Ee&&!(Ee instanceof Error)&&(Me(Pe),b("%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).",ke||"React class",de,Ae,typeof Ee),Me(null)),Ee instanceof Error&&!(Ee.message in Ve)&&(Ve[Ee.message]=!0,Me(Pe),b("Failed %s type: %s",de,Ee.message),Me(null))}}}var F=Array.isArray;function B(_){return F(_)}function ie(_){{var ee=typeof Symbol=="function"&&Symbol.toStringTag,de=ee&&_[Symbol.toStringTag]||_.constructor.name||"Object";return de}}function te(_){try{return Q(_),!1}catch{return!0}}function Q(_){return""+_}function ve(_){if(te(_))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ie(_)),Q(_)}var De=y.ReactCurrentOwner,Re={key:!0,ref:!0,__self:!0,__source:!0},st,er;function tr(_){if(Le.call(_,"ref")){var ee=Object.getOwnPropertyDescriptor(_,"ref").get;if(ee&&ee.isReactWarning)return!1}return _.ref!==void 0}function Jo(_){if(Le.call(_,"key")){var ee=Object.getOwnPropertyDescriptor(_,"key").get;if(ee&&ee.isReactWarning)return!1}return _.key!==void 0}function zn(_,ee){typeof _.ref=="string"&&De.current}function Mn(_,ee){{var de=function(){st||(st=!0,b("%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)",ee))};de.isReactWarning=!0,Object.defineProperty(_,"key",{get:de,configurable:!0})}}function Qo(_,ee){{var de=function(){er||(er=!0,b("%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)",ee))};de.isReactWarning=!0,Object.defineProperty(_,"ref",{get:de,configurable:!0})}}var ga=function(_,ee,de,ke,Pe,Oe,Ae){var Ee={$$typeof:t,type:_,key:ee,ref:de,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:ke}),Object.defineProperty(Ee,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Pe}),Object.freeze&&(Object.freeze(Ee.props),Object.freeze(Ee)),Ee};function es(_,ee,de,ke,Pe){{var Oe,Ae={},Ee=null,dt=null;de!==void 0&&(ve(de),Ee=""+de),Jo(ee)&&(ve(ee.key),Ee=""+ee.key),tr(ee)&&(dt=ee.ref,zn(ee));for(Oe in ee)Le.call(ee,Oe)&&!Re.hasOwnProperty(Oe)&&(Ae[Oe]=ee[Oe]);if(_&&_.defaultProps){var Ue=_.defaultProps;for(Oe in Ue)Ae[Oe]===void 0&&(Ae[Oe]=Ue[Oe])}if(Ee||dt){var Ye=typeof _=="function"?_.displayName||_.name||"Unknown":_;Ee&&Mn(Ae,Ye),dt&&Qo(Ae,Ye)}return ga(_,Ee,dt,Pe,ke,De.current,Ae)}}var on=y.ReactCurrentOwner,Wl=y.ReactDebugCurrentFrame;function sn(_){if(_){var ee=_._owner,de=Fe(_.type,_._source,ee?ee.type:null);Wl.setExtraStackFrame(de)}else Wl.setExtraStackFrame(null)}var ts;ts=!1;function rs(_){return typeof _=="object"&&_!==null&&_.$$typeof===t}function ql(){{if(on.current){var _=D(on.current.type);if(_)return`
22
22
 
23
- Check the render method of \``+R+"`."}return""}}function Ox(R){return""}var Ul={};function Fx(R){{var ee=Bl();if(!ee){var de=typeof R=="string"?R:R.displayName||R.name;de&&(ee=`
23
+ Check the render method of \``+_+"`."}return""}}function Lx(_){return""}var Gl={};function zx(_){{var ee=ql();if(!ee){var de=typeof _=="string"?_:_.displayName||_.name;de&&(ee=`
24
24
 
25
- Check the top-level render call using <`+de+">.")}return ee}}function Hl(R,ee){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var de=Fx(ee);if(Ul[de])return;Ul[de]=!0;var je="";R&&R._owner&&R._owner!==on.current&&(je=" It was passed a child from "+A(R._owner.type)+"."),sn(R),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',de,je),sn(null)}}function Wl(R,ee){{if(typeof R!="object")return;if(B(R))for(var de=0;de<R.length;de++){var je=R[de];Jo(je)&&Hl(je,ee)}else if(Jo(R))R._store&&(R._store.validated=!0);else if(R){var Ie=x(R);if(typeof Ie=="function"&&Ie!==R.entries)for(var Le=Ie.call(R),Re;!(Re=Le.next()).done;)Jo(Re.value)&&Hl(Re.value,ee)}}}function zx(R){{var ee=R.type;if(ee==null||typeof ee=="string")return;var de;if(typeof ee=="function")de=ee.propTypes;else if(typeof ee=="object"&&(ee.$$typeof===c||ee.$$typeof===m))de=ee.propTypes;else return;if(de){var je=A(ee);P(de,R.props,"prop",je,R)}else if(ee.PropTypes!==void 0&&!Yo){Yo=!0;var Ie=A(ee);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ie||"Unknown")}typeof ee.getDefaultProps=="function"&&!ee.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Lx(R){{for(var ee=Object.keys(R.props),de=0;de<ee.length;de++){var je=ee[de];if(je!=="children"&&je!=="key"){sn(R),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",je),sn(null);break}}R.ref!==null&&(sn(R),y("Invalid attribute `ref` supplied to `React.Fragment`."),sn(null))}}var ql={};function Gl(R,ee,de,je,Ie,Le){{var Re=T(R);if(!Re){var De="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(De+=" 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 ut=Ox();ut?De+=ut:De+=Bl();var Ue;R===null?Ue="null":B(R)?Ue="array":R!==void 0&&R.$$typeof===t?(Ue="<"+(A(R.type)||"Unknown")+" />",De=" Did you accidentally export a JSX literal instead of a component?"):Ue=typeof R,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ue,De)}var Ye=Ko(R,ee,de,Ie,Le);if(Ye==null)return Ye;if(Re){var Ot=ee.children;if(Ot!==void 0)if(je)if(B(Ot)){for(var ln=0;ln<Ot.length;ln++)Wl(Ot[ln],R);Object.freeze&&Object.freeze(Ot)}else y("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 Wl(Ot,R)}if(Te.call(ee,"key")){var Hr=A(R),vt=Object.keys(ee).filter(function(Wx){return Wx!=="key"}),Qo=vt.length>0?"{key: someKey, "+vt.join(": ..., ")+": ...}":"{key: someKey}";if(!ql[Hr+Qo]){var Hx=vt.length>0?"{"+vt.join(": ..., ")+": ...}":"{}";y(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+de+">.")}return ee}}function Xl(_,ee){{if(!_._store||_._store.validated||_.key!=null)return;_._store.validated=!0;var de=zx(ee);if(Gl[de])return;Gl[de]=!0;var ke="";_&&_._owner&&_._owner!==on.current&&(ke=" It was passed a child from "+D(_._owner.type)+"."),sn(_),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',de,ke),sn(null)}}function Zl(_,ee){{if(typeof _!="object")return;if(B(_))for(var de=0;de<_.length;de++){var ke=_[de];rs(ke)&&Xl(ke,ee)}else if(rs(_))_._store&&(_._store.validated=!0);else if(_){var Pe=x(_);if(typeof Pe=="function"&&Pe!==_.entries)for(var Oe=Pe.call(_),Ae;!(Ae=Oe.next()).done;)rs(Ae.value)&&Xl(Ae.value,ee)}}}function Mx(_){{var ee=_.type;if(ee==null||typeof ee=="string")return;var de;if(typeof ee=="function")de=ee.propTypes;else if(typeof ee=="object"&&(ee.$$typeof===c||ee.$$typeof===m))de=ee.propTypes;else return;if(de){var ke=D(ee);T(de,_.props,"prop",ke,_)}else if(ee.PropTypes!==void 0&&!ts){ts=!0;var Pe=D(ee);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Pe||"Unknown")}typeof ee.getDefaultProps=="function"&&!ee.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Vx(_){{for(var ee=Object.keys(_.props),de=0;de<ee.length;de++){var ke=ee[de];if(ke!=="children"&&ke!=="key"){sn(_),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ke),sn(null);break}}_.ref!==null&&(sn(_),b("Invalid attribute `ref` supplied to `React.Fragment`."),sn(null))}}var Kl={};function Yl(_,ee,de,ke,Pe,Oe){{var Ae=$(_);if(!Ae){var Ee="";(_===void 0||typeof _=="object"&&_!==null&&Object.keys(_).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 dt=Lx();dt?Ee+=dt:Ee+=ql();var Ue;_===null?Ue="null":B(_)?Ue="array":_!==void 0&&_.$$typeof===t?(Ue="<"+(D(_.type)||"Unknown")+" />",Ee=" Did you accidentally export a JSX literal instead of a component?"):Ue=typeof _,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ue,Ee)}var Ye=es(_,ee,de,Pe,Oe);if(Ye==null)return Ye;if(Ae){var Ot=ee.children;if(Ot!==void 0)if(ke)if(B(Ot)){for(var ln=0;ln<Ot.length;ln++)Zl(Ot[ln],_);Object.freeze&&Object.freeze(Ot)}else b("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 Zl(Ot,_)}if(Le.call(ee,"key")){var Hr=D(_),gt=Object.keys(ee).filter(function(Gx){return Gx!=="key"}),ns=gt.length>0?"{key: someKey, "+gt.join(": ..., ")+": ...}":"{key: someKey}";if(!Kl[Hr+ns]){var qx=gt.length>0?"{"+gt.join(": ..., ")+": ...}":"{}";b(`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} />`,Qo,Hr,Hx,Hr),ql[Hr+Qo]=!0}}return R===n?Lx(Ye):zx(Ye),Ye}}function Mx(R,ee,de){return Gl(R,ee,de,!0)}function Vx(R,ee,de){return Gl(R,ee,de,!1)}var Bx=Vx,Ux=Mx;xa.Fragment=n,xa.jsx=Bx,xa.jsxs=Ux}()),xa}process.env.NODE_ENV==="production"?zs.exports=mg():zs.exports=pg();var ts=zs.exports;const Ls=N.createContext(oo("moderno")),Kn=({config:e,children:t,renderWrapper:r=!0,className:n,style:a})=>{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,...a};return r?ts.jsx(Ls.Provider,{value:e,children:ts.jsx("div",{className:n,style:s,"data-template":"1",children:t})}):ts.jsx(Ls.Provider,{value:e,children:t})},ra=()=>N.useContext(Ls),so=[{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:D.TEXTO,label:"Nome completo",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Seu nome completo"},{id:"_personal_email",nome:"email",tipo:D.EMAIL,label:"E-mail",ordem:1,tamanho:6,obrigatorio:!0,placeholder:"seuemail@exemplo.com"},{id:"_personal_telefone",nome:"telefone",tipo:D.TELEFONE,label:"Telefone / WhatsApp",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_personal_cpf",nome:"cpf",tipo:D.CPF,label:"CPF",ordem:3,tamanho:6,obrigatorio:!1,placeholder:"000.000.000-00"},{id:"_personal_nascimento",nome:"data_nascimento",tipo:D.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:D.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:D.TEXTO,label:"Nome",ordem:0,tamanho:4,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_array_parentesco",nome:"parentesco",tipo:D.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:D.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:D.TEXTO,label:"Nome",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_parentesco",nome:"parentesco",tipo:D.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:D.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:D.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:D.TEXTO,label:"Logradouro",ordem:1,tamanho:8,obrigatorio:!1,placeholder:"Rua, Av., Travessa...",locked:!0},{id:"_address_numero",nome:"_address_numero",tipo:D.TEXTO,label:"Número",ordem:2,tamanho:3,obrigatorio:!1,placeholder:"Nº"},{id:"_address_complemento",nome:"_address_complemento",tipo:D.TEXTO,label:"Complemento",ordem:3,tamanho:9,obrigatorio:!1,placeholder:"Apto, bloco, casa..."},{id:"_address_bairro",nome:"_address_bairro",tipo:D.TEXTO,label:"Bairro",ordem:4,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_cidade",nome:"_address_cidade",tipo:D.TEXTO,label:"Cidade",ordem:5,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_estado",nome:"_address_estado",tipo:D.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:D.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:D.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:D.TELEFONE,label:"Telefone do responsável",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_resp_cpf",nome:"responsavel_cpf",tipo:D.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:D.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:D.TEXTO,label:"Plano de saúde",ordem:1,tamanho:8,obrigatorio:!1,placeholder:'Ex: Unimed... ou "Nenhum"'},{id:"_health_alergias",nome:"alergias",tipo:D.TEXTAREA,label:"Alergias",ordem:2,tamanho:12,obrigatorio:!1,placeholder:"Descreva alergias conhecidas"},{id:"_health_medicamentos",nome:"medicamentos",tipo:D.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:D.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:D.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:D.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:D.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:D.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:D.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:D.PARTICIPATION_TYPE,label:"Tipo de Participação",hint:"Escolha como você deseja participar",ordem:0,tamanho:12,obrigatorio:!0,locked:!0}]}}],fg=e=>so.filter(t=>t.category===e),wi=e=>so.find(t=>t.id===e),ji=[{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:D.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:D.PAYMENT_METHOD,label:"Forma de Pagamento",ordem:0,tamanho:12,obrigatorio:!0,locked:!0,relatedFieldName:"tipo_participacao"}]}]}]}],hg=e=>ji.find(t=>t.id===e);function mu(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=mu(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function pu(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=mu(e))&&(n&&(n+=" "),n+=t);return n}const xg=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},gg=(e,t)=>({classGroupId:e,validator:t}),fu=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Oa="-",Kl=[],vg="arbitrary..",bg=e=>{const t=wg(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return yg(a);const s=a.split(Oa),i=s[0]===""&&s.length>1?1:0;return hu(s,i,t)},getConflictingClassGroupIds:(a,s)=>{if(s){const i=n[a],l=r[a];return i?l?xg(l,i):i:l||Kl}return r[a]||Kl}}},hu=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const c=hu(e,t+1,a);if(c)return c}const s=r.validators;if(s===null)return;const i=t===0?e.join(Oa):e.slice(t).join(Oa),l=s.length;for(let c=0;c<l;c++){const d=s[c];if(d.validator(i))return d.classGroupId}},yg=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?vg+n:void 0})(),wg=e=>{const{theme:t,classGroups:r}=e;return jg(r,t)},jg=(e,t)=>{const r=fu();for(const n in e){const a=e[n];ki(a,r,n,t)}return r},ki=(e,t,r,n)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];kg(i,t,r,n)}},kg=(e,t,r,n)=>{if(typeof e=="string"){Cg(e,t,r);return}if(typeof e=="function"){Ng(e,t,r,n);return}Sg(e,t,r,n)},Cg=(e,t,r)=>{const n=e===""?t:xu(t,e);n.classGroupId=r},Ng=(e,t,r,n)=>{if($g(e)){ki(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(gg(r,e))},Sg=(e,t,r,n)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[l,c]=a[i];ki(c,xu(t,l),r,n)}},xu=(e,t)=>{let r=e;const n=t.split(Oa),a=n.length;for(let s=0;s<a;s++){const i=n[s];let l=r.nextPart.get(i);l||(l=fu(),r.nextPart.set(i,l)),r=l}return r},$g=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Eg=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(s,i)=>{r[s]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let i=r[s];if(i!==void 0)return i;if((i=n[s])!==void 0)return a(s,i),i},set(s,i){s in r?r[s]=i:a(s,i)}}},Ms="!",Yl=":",Tg=[],Jl=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),Ag=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let i=0,l=0,c=0,d;const u=a.length;for(let h=0;h<u;h++){const x=a[h];if(i===0&&l===0){if(x===Yl){s.push(a.slice(c,h)),c=h+1;continue}if(x==="/"){d=h;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const m=s.length===0?a:a.slice(c);let p=m,f=!1;m.endsWith(Ms)?(p=m.slice(0,-1),f=!0):m.startsWith(Ms)&&(p=m.slice(1),f=!0);const v=d&&d>c?d-c:void 0;return Jl(s,f,p,v)};if(t){const a=t+Yl,s=n;n=i=>i.startsWith(a)?s(i.slice(a.length)):Jl(Tg,!1,i,void 0,!0)}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},Dg=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let a=[];for(let s=0;s<r.length;s++){const i=r[s],l=i[0]==="[",c=t.has(i);l||c?(a.length>0&&(a.sort(),n.push(...a),a=[]),n.push(i)):a.push(i)}return a.length>0&&(a.sort(),n.push(...a)),n}},Rg=e=>({cache:Eg(e.cacheSize),parseClassName:Ag(e),sortModifiers:Dg(e),...bg(e)}),Pg=/\s+/,_g=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],l=e.trim().split(Pg);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:m,modifiers:p,hasImportantModifier:f,baseClassName:v,maybePostfixModifierPosition:h}=r(u);if(m){c=u+(c.length>0?" "+c:c);continue}let x=!!h,b=n(x?v.substring(0,h):v);if(!b){if(!x){c=u+(c.length>0?" "+c:c);continue}if(b=n(v),!b){c=u+(c.length>0?" "+c:c);continue}x=!1}const y=p.length===0?"":p.length===1?p[0]:s(p).join(":"),j=f?y+Ms:y,w=j+b;if(i.indexOf(w)>-1)continue;i.push(w);const C=a(b,x);for(let S=0;S<C.length;++S){const $=C[S];i.push(j+$)}c=u+(c.length>0?" "+c:c)}return c},Ig=(...e)=>{let t=0,r,n,a="";for(;t<e.length;)(r=e[t++])&&(n=gu(r))&&(a&&(a+=" "),a+=n);return a},gu=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=gu(e[n]))&&(r&&(r+=" "),r+=t);return r},Og=(e,...t)=>{let r,n,a,s;const i=c=>{const d=t.reduce((u,m)=>m(u),e());return r=Rg(d),n=r.cache.get,a=r.cache.set,s=l,l(c)},l=c=>{const d=n(c);if(d)return d;const u=_g(c,r);return a(c,u),u};return s=i,(...c)=>s(Ig(...c))},Fg=[],at=e=>{const t=r=>r[e]||Fg;return t.isThemeGetter=!0,t},vu=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bu=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zg=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Lg=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Mg=/\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$/,Vg=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Bg=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ug=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nr=e=>zg.test(e),Ne=e=>!!e&&!Number.isNaN(Number(e)),Sr=e=>!!e&&Number.isInteger(Number(e)),rs=e=>e.endsWith("%")&&Ne(e.slice(0,-1)),fr=e=>Lg.test(e),yu=()=>!0,Hg=e=>Mg.test(e)&&!Vg.test(e),Ci=()=>!1,Wg=e=>Bg.test(e),qg=e=>Ug.test(e),Gg=e=>!pe(e)&&!he(e),Xg=e=>zr(e,ku,Ci),pe=e=>vu.test(e),Wr=e=>zr(e,Cu,Hg),Ql=e=>zr(e,rv,Ne),Zg=e=>zr(e,Su,yu),Kg=e=>zr(e,Nu,Ci),ec=e=>zr(e,wu,Ci),Yg=e=>zr(e,ju,qg),ga=e=>zr(e,$u,Wg),he=e=>bu.test(e),Bn=e=>nn(e,Cu),Jg=e=>nn(e,Nu),tc=e=>nn(e,wu),Qg=e=>nn(e,ku),ev=e=>nn(e,ju),va=e=>nn(e,$u,!0),tv=e=>nn(e,Su,!0),zr=(e,t,r)=>{const n=vu.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},nn=(e,t,r=!1)=>{const n=bu.exec(e);return n?n[1]?t(n[1]):r:!1},wu=e=>e==="position"||e==="percentage",ju=e=>e==="image"||e==="url",ku=e=>e==="length"||e==="size"||e==="bg-size",Cu=e=>e==="length",rv=e=>e==="number",Nu=e=>e==="family-name",Su=e=>e==="number"||e==="weight",$u=e=>e==="shadow",nv=()=>{const e=at("color"),t=at("font"),r=at("text"),n=at("font-weight"),a=at("tracking"),s=at("leading"),i=at("breakpoint"),l=at("container"),c=at("spacing"),d=at("radius"),u=at("shadow"),m=at("inset-shadow"),p=at("text-shadow"),f=at("drop-shadow"),v=at("blur"),h=at("perspective"),x=at("aspect"),b=at("ease"),y=at("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...w(),he,pe],S=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],k=()=>[he,pe,c],E=()=>[Nr,"full","auto",...k()],T=()=>[Sr,"none","subgrid",he,pe],O=()=>["auto",{span:["full",Sr,he,pe]},Sr,he,pe],L=()=>[Sr,"auto",he,pe],A=()=>["auto","min","max","fr",he,pe],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...k()],Z=()=>[Nr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],V=()=>[Nr,"screen","full","dvw","lvw","svw","min","max","fit",...k()],M=()=>[Nr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],_=()=>[e,he,pe],se=()=>[...w(),tc,ec,{position:[he,pe]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Q=()=>["auto","cover","contain",Qg,Xg,{size:[he,pe]}],Y=()=>[rs,Bn,Wr],H=()=>["","none","full",d,he,pe],W=()=>["",Ne,Bn,Wr],G=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[Ne,rs,tc,ec],te=()=>["","none",v,he,pe],ce=()=>["none",Ne,he,pe],be=()=>["none",Ne,he,pe],Ce=()=>[Ne,he,pe],ve=()=>[Nr,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fr],breakpoint:[fr],color:[yu],container:[fr],"drop-shadow":[fr],ease:["in","out","in-out"],font:[Gg],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fr],shadow:[fr],spacing:["px",Ne],text:[fr],"text-shadow":[fr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Nr,pe,he,x]}],container:["container"],columns:[{columns:[Ne,pe,he,l]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow: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:[Sr,"auto",he,pe]}],basis:[{basis:[Nr,"full","auto",l,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,Nr,"auto","initial","none",pe]}],grow:[{grow:["",Ne,he,pe]}],shrink:[{shrink:["",Ne,he,pe]}],order:[{order:[Sr,"first","last","none",he,pe]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...M()]}],"min-block-size":[{"min-block":["auto",...M()]}],"max-block-size":[{"max-block":["none",...M()]}],w:[{w:[l,"screen",...Z()]}],"min-w":[{"min-w":[l,"screen","none",...Z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",r,Bn,Wr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,tv,Zg]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",rs,pe]}],"font-family":[{font:[Jg,Kg,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:[a,he,pe]}],"line-clamp":[{"line-clamp":[Ne,"none",he,Ql]}],leading:[{leading:[s,...k()]}],"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:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",he,Wr]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[Ne,"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:k()}],"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"]},Sr,he,pe],radial:["",he,pe],conic:[Sr,he,pe]},ev,Yg]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],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:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-bs":[{"border-bs":W()}],"border-w-be":[{"border-be":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-bs":[{"border-bs":_()}],"border-color-be":[{"border-be":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,he,pe]}],"outline-w":[{outline:["",Ne,Bn,Wr]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",u,va,ga]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",m,va,ga]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[Ne,Wr]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",p,va,ga]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[Ne,he,pe]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[he,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"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":w()}],"mask-image-conic-pos":[{"mask-conic":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"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:[Ne,he,pe]}],contrast:[{contrast:[Ne,he,pe]}],"drop-shadow":[{"drop-shadow":["","none",f,va,ga]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",Ne,he,pe]}],"hue-rotate":[{"hue-rotate":[Ne,he,pe]}],invert:[{invert:["",Ne,he,pe]}],saturate:[{saturate:[Ne,he,pe]}],sepia:[{sepia:["",Ne,he,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",he,pe]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,he,pe]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,he,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,he,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,he,pe]}],"backdrop-invert":[{"backdrop-invert":["",Ne,he,pe]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,he,pe]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,he,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,he,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"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:[Ne,"initial",he,pe]}],ease:[{ease:["linear","initial",b,he,pe]}],delay:[{delay:[Ne,he,pe]}],animate:[{animate:["none",y,he,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,he,pe]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:be()}],"scale-x":[{"scale-x":be()}],"scale-y":[{"scale-y":be()}],"scale-z":[{"scale-z":be()}],"scale-3d":["scale-3d"],skew:[{skew:Ce()}],"skew-x":[{"skew-x":Ce()}],"skew-y":[{"skew-y":Ce()}],transform:[{transform:[he,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"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":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",..._()]}],"stroke-w":[{stroke:[Ne,Bn,Wr,Ql]}],stroke:[{stroke:["none",..._()]}],"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"]}},av=Og(nv);function K(...e){return av(pu(e))}function ov(e){if(!e)return null;if(e.includes("-")){const t=e.split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");return I.icons[t]??null}return I.icons[e]??null}function rc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ni(...e){return t=>{let r=!1;const n=e.map(a=>{const s=rc(a,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let a=0;a<n.length;a++){const s=n[a];typeof s=="function"?s():rc(e[a],null)}}}}function ke(...e){return g.useCallback(Ni(...e),e)}var sv=Symbol.for("react.lazy"),Fa=g[" use ".trim().toString()];function iv(e){return typeof e=="object"&&e!==null&&"then"in e}function Eu(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===sv&&"_payload"in e&&iv(e._payload)}function Tu(e){const t=cv(e),r=g.forwardRef((n,a)=>{let{children:s,...i}=n;Eu(s)&&typeof Fa=="function"&&(s=Fa(s._payload));const l=g.Children.toArray(s),c=l.find(uv);if(c){const d=c.props.children,u=l.map(m=>m===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:m);return o.jsx(t,{...i,ref:a,children:g.isValidElement(d)?g.cloneElement(d,void 0,u):null})}return o.jsx(t,{...i,ref:a,children:s})});return r.displayName=`${e}.Slot`,r}var lv=Tu("Slot");function cv(e){const t=g.forwardRef((r,n)=>{let{children:a,...s}=r;if(Eu(a)&&typeof Fa=="function"&&(a=Fa(a._payload)),g.isValidElement(a)){const i=pv(a),l=mv(s,a.props);return a.type!==g.Fragment&&(l.ref=n?Ni(n,i):i),g.cloneElement(a,l)}return g.Children.count(a)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var dv=Symbol("radix.slottable");function uv(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===dv}function mv(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...i)=>{const l=s(...i);return a(...i),l}:a&&(r[n]=a):n==="style"?r[n]={...a,...s}:n==="className"&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}function pv(e){var t,r;let n=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning;return a?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}const nc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ac=pu,Si=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return ac(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:a,defaultVariants:s}=t,i=Object.keys(a).map(d=>{const u=r==null?void 0:r[d],m=s==null?void 0:s[d];if(u===null)return null;const p=nc(u)||nc(m);return a[d][p]}),l=r&&Object.entries(r).reduce((d,u)=>{let[m,p]=u;return p===void 0||(d[m]=p),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,u)=>{let{class:m,className:p,...f}=u;return Object.entries(f).every(v=>{let[h,x]=v;return Array.isArray(x)?x.includes({...s,...l}[h]):{...s,...l}[h]===x})?[...d,m,p]:d},[]);return ac(e,i,c,r==null?void 0:r.class,r==null?void 0:r.className)},fv=Si("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"}}),Ae=g.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...a},s)=>o.jsx(n?lv:"button",{className:K(fv({variant:t,size:r,className:e})),ref:s,...a}));Ae.displayName="Button";const ue=g.forwardRef(({className:e,type:t,...r},n)=>o.jsx("input",{type:t,className:K("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:n,...r}));ue.displayName="Input";const io=g.forwardRef(({className:e,...t},r)=>o.jsx("textarea",{className:K("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}));io.displayName="Textarea";var hv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lo=hv.reduce((e,t)=>{const r=Tu(`Primitive.${t}`),n=g.forwardRef((a,s)=>{const{asChild:i,...l}=a,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),xv="Label",Au=g.forwardRef((e,t)=>o.jsx(lo.label,{...e,ref:t,onMouseDown:r=>{var n;r.target.closest("button, input, select, textarea")||((n=e.onMouseDown)==null||n.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Au.displayName=xv;var Du=Au;const gv=Si("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ie=g.forwardRef(({className:e,...t},r)=>o.jsx(Du,{ref:r,className:K(gv(),e),...t}));ie.displayName=Du.displayName;const vv=Si("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 $i({className:e,variant:t,...r}){return o.jsx("div",{className:K(vv({variant:t}),e),...r})}var bv="Separator",oc="horizontal",yv=["horizontal","vertical"],Ru=g.forwardRef((e,t)=>{const{decorative:r,orientation:n=oc,...a}=e,s=wv(n)?n:oc,i=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return o.jsx(lo.div,{"data-orientation":s,...i,...a,ref:t})});Ru.displayName=bv;function wv(e){return yv.includes(e)}var Pu=Ru;const it=g.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},a)=>o.jsx(Pu,{ref:a,decorative:r,orientation:t,className:K("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));it.displayName=Pu.displayName;function jv(e,t){const r=g.createContext(t),n=s=>{const{children:i,...l}=s,c=g.useMemo(()=>l,Object.values(l));return o.jsx(r.Provider,{value:c,children:i})};n.displayName=e+"Provider";function a(s){const i=g.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[n,a]}function _t(e,t=[]){let r=[];function n(s,i){const l=g.createContext(i),c=r.length;r=[...r,i];const d=m=>{var p;const{scope:f,children:v,...h}=m,x=((p=f==null?void 0:f[e])==null?void 0:p[c])||l,b=g.useMemo(()=>h,Object.values(h));return o.jsx(x.Provider,{value:b,children:v})};d.displayName=s+"Provider";function u(m,p){var f;const v=((f=p==null?void 0:p[e])==null?void 0:f[c])||l,h=g.useContext(v);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[d,u]}const a=()=>{const s=r.map(i=>g.createContext(i));return function(i){const l=(i==null?void 0:i[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return a.scopeName=e,[n,kv(a,...t)]}function kv(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(a){const s=n.reduce((i,{useScope:l,scopeName:c})=>{const d=l(a)[`__scope${c}`];return{...i,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}function ge(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e==null||e(n),r===!1||!n.defaultPrevented)return t==null?void 0:t(n)}}var lt=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},Cv=g[" useInsertionEffect ".trim().toString()]||lt;function cr({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,s,i]=Nv({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:a;{const u=g.useRef(e!==void 0);g.useEffect(()=>{const m=u.current;m!==l&&console.warn(`${n} is changing from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,n])}const d=g.useCallback(u=>{var m;if(l){const p=Sv(u)?u(e):u;p!==e&&((m=i.current)==null||m.call(i,p))}else s(u)},[l,e,s,i]);return[c,d]}function Nv({defaultProp:e,onChange:t}){const[r,n]=g.useState(e),a=g.useRef(r),s=g.useRef(t);return Cv(()=>{s.current=t},[t]),g.useEffect(()=>{var i;a.current!==r&&((i=s.current)==null||i.call(s,r),a.current=r)},[r,a]),[r,n,s]}function Sv(e){return typeof e=="function"}function na(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function aa(e){const[t,r]=g.useState(void 0);return lt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const s=a[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.blockSize}else i=e.offsetWidth,l=e.offsetHeight;r({width:i,height:l})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}function $v(e,t){return g.useReducer((r,n)=>t[r][n]??r,e)}var It=e=>{const{present:t,children:r}=e,n=Ev(t),a=typeof r=="function"?r({present:n.isPresent}):g.Children.only(r),s=ke(n.ref,Tv(a));return typeof r=="function"||n.isPresent?g.cloneElement(a,{ref:s}):null};It.displayName="Presence";function Ev(e){const[t,r]=g.useState(),n=g.useRef(null),a=g.useRef(e),s=g.useRef("none"),i=e?"mounted":"unmounted",[l,c]=$v(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const d=ba(n.current);s.current=l==="mounted"?d:"none"},[l]),lt(()=>{const d=n.current,u=a.current;if(u!==e){const m=s.current,p=ba(d);e?c("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&m!==p?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),lt(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,m=f=>{const v=ba(n.current).includes(CSS.escape(f.animationName));if(f.target===t&&v&&(c("ANIMATION_END"),!a.current)){const h=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=h)})}},p=f=>{f.target===t&&(s.current=ba(n.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:g.useCallback(d=>{n.current=d?getComputedStyle(d):null,r(d)},[])}}function ba(e){return(e==null?void 0:e.animationName)||"none"}function Tv(e){var t,r;let n=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning;return a?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}function Cn(e){const t=Av(e),r=g.forwardRef((n,a)=>{const{children:s,...i}=n,l=g.Children.toArray(s),c=l.find(Rv);if(c){const d=c.props.children,u=l.map(m=>m===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:m);return o.jsx(t,{...i,ref:a,children:g.isValidElement(d)?g.cloneElement(d,void 0,u):null})}return o.jsx(t,{...i,ref:a,children:s})});return r.displayName=`${e}.Slot`,r}function Av(e){const t=g.forwardRef((r,n)=>{const{children:a,...s}=r;if(g.isValidElement(a)){const i=_v(a),l=Pv(s,a.props);return a.type!==g.Fragment&&(l.ref=n?Ni(n,i):i),g.cloneElement(a,l)}return g.Children.count(a)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _u=Symbol("radix.slottable");function Dv(e){const t=({children:r})=>o.jsx(o.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=_u,t}function Rv(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_u}function Pv(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...i)=>{const l=s(...i);return a(...i),l}:a&&(r[n]=a):n==="style"?r[n]={...a,...s}:n==="className"&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}function _v(e){var t,r;let n=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning;return a?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}var Iv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],we=Iv.reduce((e,t)=>{const r=Cn(`Primitive.${t}`),n=g.forwardRef((a,s)=>{const{asChild:i,...l}=a,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Ov(e,t){e&&ao.flushSync(()=>e.dispatchEvent(t))}var co="Checkbox",[Fv]=_t(co),[zv,Ei]=Fv(co);function Lv(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:a,disabled:s,form:i,name:l,onCheckedChange:c,required:d,value:u="on",internal_do_not_use_render:m}=e,[p,f]=cr({prop:r,defaultProp:a??!1,onChange:c,caller:co}),[v,h]=g.useState(null),[x,b]=g.useState(null),y=g.useRef(!1),j=v?!!i||!!v.closest("form"):!0,w={checked:p,disabled:s,setChecked:f,control:v,setControl:h,name:l,form:i,value:u,hasConsumerStoppedPropagationRef:y,required:d,defaultChecked:Pr(a)?!1:a,isFormControl:j,bubbleInput:x,setBubbleInput:b};return o.jsx(zv,{scope:t,...w,children:Mv(m)?m(w):n})}var Iu="CheckboxTrigger",Ou=g.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},a)=>{const{control:s,value:i,disabled:l,checked:c,required:d,setControl:u,setChecked:m,hasConsumerStoppedPropagationRef:p,isFormControl:f,bubbleInput:v}=Ei(Iu,e),h=ke(a,u),x=g.useRef(c);return g.useEffect(()=>{const b=s==null?void 0:s.form;if(b){const y=()=>m(x.current);return b.addEventListener("reset",y),()=>b.removeEventListener("reset",y)}},[s,m]),o.jsx(we.button,{type:"button",role:"checkbox","aria-checked":Pr(c)?"mixed":c,"aria-required":d,"data-state":Vu(c),"data-disabled":l?"":void 0,disabled:l,value:i,...n,ref:h,onKeyDown:ge(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:ge(r,b=>{m(y=>Pr(y)?!0:!y),v&&f&&(p.current=b.isPropagationStopped(),p.current||b.stopPropagation())})})});Ou.displayName=Iu;var Ti=g.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:a,defaultChecked:s,required:i,disabled:l,value:c,onCheckedChange:d,form:u,...m}=e;return o.jsx(Lv,{__scopeCheckbox:r,checked:a,defaultChecked:s,disabled:l,required:i,onCheckedChange:d,name:n,form:u,value:c,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(Ou,{...m,ref:t,__scopeCheckbox:r}),p&&o.jsx(Mu,{__scopeCheckbox:r})]})})});Ti.displayName=co;var Fu="CheckboxIndicator",zu=g.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...a}=e,s=Ei(Fu,r);return o.jsx(It,{present:n||Pr(s.checked)||s.checked===!0,children:o.jsx(we.span,{"data-state":Vu(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});zu.displayName=Fu;var Lu="CheckboxBubbleInput",Mu=g.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:a,checked:s,defaultChecked:i,required:l,disabled:c,name:d,value:u,form:m,bubbleInput:p,setBubbleInput:f}=Ei(Lu,e),v=ke(r,f),h=na(s),x=aa(n);g.useEffect(()=>{const y=p;if(!y)return;const j=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(j,"checked").set,C=!a.current;if(h!==s&&w){const S=new Event("click",{bubbles:C});y.indeterminate=Pr(s),w.call(y,Pr(s)?!1:s),y.dispatchEvent(S)}},[p,h,s,a]);const b=g.useRef(Pr(s)?!1:s);return o.jsx(we.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??b.current,required:l,disabled:c,name:d,value:u,form:m,...t,tabIndex:-1,ref:v,style:{...t.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Mu.displayName=Lu;function Mv(e){return typeof e=="function"}function Pr(e){return e==="indeterminate"}function Vu(e){return Pr(e)?"indeterminate":e?"checked":"unchecked"}const rt=g.forwardRef(({className:e,...t},r)=>o.jsx(Ti,{ref:r,className:K("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:o.jsx(zu,{className:K("flex items-center justify-center text-current"),children:o.jsx(I.Check,{className:"h-4 w-4"})})}));rt.displayName=Ti.displayName;function Ai(e){const t=e+"CollectionProvider",[r,n]=_t(t),[a,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:x,children:b}=h,y=N.useRef(null),j=N.useRef(new Map).current;return o.jsx(a,{scope:x,itemMap:j,collectionRef:y,children:b})};i.displayName=t;const l=e+"CollectionSlot",c=Cn(l),d=N.forwardRef((h,x)=>{const{scope:b,children:y}=h,j=s(l,b),w=ke(x,j.collectionRef);return o.jsx(c,{ref:w,children:y})});d.displayName=l;const u=e+"CollectionItemSlot",m="data-radix-collection-item",p=Cn(u),f=N.forwardRef((h,x)=>{const{scope:b,children:y,...j}=h,w=N.useRef(null),C=ke(x,w),S=s(u,b);return N.useEffect(()=>(S.itemMap.set(w,{ref:w,...j}),()=>void S.itemMap.delete(w))),o.jsx(p,{[m]:"",ref:C,children:y})});f.displayName=u;function v(h){const x=s(e+"CollectionConsumer",h);return N.useCallback(()=>{const b=x.collectionRef.current;if(!b)return[];const y=Array.from(b.querySelectorAll(`[${m}]`));return Array.from(x.itemMap.values()).sort((j,w)=>y.indexOf(j.ref.current)-y.indexOf(w.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:d,ItemSlot:f},v,n]}var Vv=g[" useId ".trim().toString()]||(()=>{}),Bv=0;function yr(e){const[t,r]=g.useState(Vv());return lt(()=>{r(n=>n??String(Bv++))},[e]),t?`radix-${t}`:""}function ft(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}var Uv=g.createContext(void 0);function oa(e){const t=g.useContext(Uv);return e||t||"ltr"}var ns="rovingFocusGroup.onEntryFocus",Hv={bubbles:!1,cancelable:!0},sa="RovingFocusGroup",[Vs,Bu,Wv]=Ai(sa),[qv,Uu]=_t(sa,[Wv]),[Gv,Xv]=qv(sa),Hu=g.forwardRef((e,t)=>o.jsx(Vs.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Vs.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Zv,{...e,ref:t})})}));Hu.displayName=sa;var Zv=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:a=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:u=!1,...m}=e,p=g.useRef(null),f=ke(t,p),v=oa(s),[h,x]=cr({prop:i,defaultProp:l??null,onChange:c,caller:sa}),[b,y]=g.useState(!1),j=ft(d),w=Bu(r),C=g.useRef(!1),[S,$]=g.useState(0);return g.useEffect(()=>{const k=p.current;if(k)return k.addEventListener(ns,j),()=>k.removeEventListener(ns,j)},[j]),o.jsx(Gv,{scope:r,orientation:n,dir:v,loop:a,currentTabStopId:h,onItemFocus:g.useCallback(k=>x(k),[x]),onItemShiftTab:g.useCallback(()=>y(!0),[]),onFocusableItemAdd:g.useCallback(()=>$(k=>k+1),[]),onFocusableItemRemove:g.useCallback(()=>$(k=>k-1),[]),children:o.jsx(we.div,{tabIndex:b||S===0?-1:0,"data-orientation":n,...m,ref:f,style:{outline:"none",...e.style},onMouseDown:ge(e.onMouseDown,()=>{C.current=!0}),onFocus:ge(e.onFocus,k=>{const E=!C.current;if(k.target===k.currentTarget&&E&&!b){const T=new CustomEvent(ns,Hv);if(k.currentTarget.dispatchEvent(T),!T.defaultPrevented){const O=w().filter(X=>X.focusable),L=O.find(X=>X.active),A=O.find(X=>X.id===h),z=[L,A,...O].filter(Boolean).map(X=>X.ref.current);Gu(z,u)}}C.current=!1}),onBlur:ge(e.onBlur,()=>y(!1))})})}),Wu="RovingFocusGroupItem",qu=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:s,children:i,...l}=e,c=yr(),d=s||c,u=Xv(Wu,r),m=u.currentTabStopId===d,p=Bu(r),{onFocusableItemAdd:f,onFocusableItemRemove:v,currentTabStopId:h}=u;return g.useEffect(()=>{if(n)return f(),()=>v()},[n,f,v]),o.jsx(Vs.ItemSlot,{scope:r,id:d,focusable:n,active:a,children:o.jsx(we.span,{tabIndex:m?0:-1,"data-orientation":u.orientation,...l,ref:t,onMouseDown:ge(e.onMouseDown,x=>{n?u.onItemFocus(d):x.preventDefault()}),onFocus:ge(e.onFocus,()=>u.onItemFocus(d)),onKeyDown:ge(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){u.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const b=Jv(x,u.orientation,u.dir);if(b!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let y=p().filter(j=>j.focusable).map(j=>j.ref.current);if(b==="last")y.reverse();else if(b==="prev"||b==="next"){b==="prev"&&y.reverse();const j=y.indexOf(x.currentTarget);y=u.loop?Qv(y,j+1):y.slice(j+1)}setTimeout(()=>Gu(y))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:h!=null}):i})})});qu.displayName=Wu;var Kv={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Yv(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Jv(e,t,r){const n=Yv(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Kv[n]}function Gu(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function Qv(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var eb=Hu,tb=qu,Di="Radio",[rb,Xu]=_t(Di),[nb,ab]=rb(Di),Zu=g.forwardRef((e,t)=>{const{__scopeRadio:r,name:n,checked:a=!1,required:s,disabled:i,value:l="on",onCheck:c,form:d,...u}=e,[m,p]=g.useState(null),f=ke(t,x=>p(x)),v=g.useRef(!1),h=m?d||!!m.closest("form"):!0;return o.jsxs(nb,{scope:r,checked:a,disabled:i,children:[o.jsx(we.button,{type:"button",role:"radio","aria-checked":a,"data-state":Qu(a),"data-disabled":i?"":void 0,disabled:i,value:l,...u,ref:f,onClick:ge(e.onClick,x=>{a||c==null||c(),h&&(v.current=x.isPropagationStopped(),v.current||x.stopPropagation())})}),h&&o.jsx(Ju,{control:m,bubbles:!v.current,name:n,value:l,checked:a,required:s,disabled:i,form:d,style:{transform:"translateX(-100%)"}})]})});Zu.displayName=Di;var Ku="RadioIndicator",Yu=g.forwardRef((e,t)=>{const{__scopeRadio:r,forceMount:n,...a}=e,s=ab(Ku,r);return o.jsx(It,{present:n||s.checked,children:o.jsx(we.span,{"data-state":Qu(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:t})})});Yu.displayName=Ku;var ob="RadioBubbleInput",Ju=g.forwardRef(({__scopeRadio:e,control:t,checked:r,bubbles:n=!0,...a},s)=>{const i=g.useRef(null),l=ke(i,s),c=na(r),d=aa(t);return g.useEffect(()=>{const u=i.current;if(!u)return;const m=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==r&&p){const f=new Event("click",{bubbles:n});p.call(u,r),u.dispatchEvent(f)}},[c,r,n]),o.jsx(we.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Ju.displayName=ob;function Qu(e){return e?"checked":"unchecked"}var sb=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],uo="RadioGroup",[ib]=_t(uo,[Uu,Xu]),em=Uu(),tm=Xu(),[lb,cb]=ib(uo),rm=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,name:n,defaultValue:a,value:s,required:i=!1,disabled:l=!1,orientation:c,dir:d,loop:u=!0,onValueChange:m,...p}=e,f=em(r),v=oa(d),[h,x]=cr({prop:s,defaultProp:a??null,onChange:m,caller:uo});return o.jsx(lb,{scope:r,name:n,required:i,disabled:l,value:h,onValueChange:x,children:o.jsx(eb,{asChild:!0,...f,orientation:c,dir:v,loop:u,children:o.jsx(we.div,{role:"radiogroup","aria-required":i,"aria-orientation":c,"data-disabled":l?"":void 0,dir:v,...p,ref:t})})})});rm.displayName=uo;var nm="RadioGroupItem",am=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:n,...a}=e,s=cb(nm,r),i=s.disabled||n,l=em(r),c=tm(r),d=g.useRef(null),u=ke(t,d),m=s.value===a.value,p=g.useRef(!1);return g.useEffect(()=>{const f=h=>{sb.includes(h.key)&&(p.current=!0)},v=()=>p.current=!1;return document.addEventListener("keydown",f),document.addEventListener("keyup",v),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",v)}},[]),o.jsx(tb,{asChild:!0,...l,focusable:!i,active:m,children:o.jsx(Zu,{disabled:i,required:s.required,checked:m,...c,...a,name:s.name,ref:u,onCheck:()=>s.onValueChange(a.value),onKeyDown:ge(f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:ge(a.onFocus,()=>{var f;p.current&&((f=d.current)==null||f.click())})})})});am.displayName=nm;var db="RadioGroupIndicator",om=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...n}=e,a=tm(r);return o.jsx(Yu,{...a,...n,ref:t})});om.displayName=db;var sm=rm,im=am,ub=om;const Ri=g.forwardRef(({className:e,...t},r)=>o.jsx(sm,{className:K("grid gap-2",e),...t,ref:r}));Ri.displayName=sm.displayName;const Pi=g.forwardRef(({className:e,...t},r)=>o.jsx(im,{ref:r,className:K("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:o.jsx(ub,{className:"flex items-center justify-center",children:o.jsx(I.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Pi.displayName=im.displayName;var mo="Switch",[mb]=_t(mo),[pb,fb]=mb(mo),lm=g.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:a,defaultChecked:s,required:i,disabled:l,value:c="on",onCheckedChange:d,form:u,...m}=e,[p,f]=g.useState(null),v=ke(t,j=>f(j)),h=g.useRef(!1),x=p?u||!!p.closest("form"):!0,[b,y]=cr({prop:a,defaultProp:s??!1,onChange:d,caller:mo});return o.jsxs(pb,{scope:r,checked:b,disabled:l,children:[o.jsx(we.button,{type:"button",role:"switch","aria-checked":b,"aria-required":i,"data-state":mm(b),"data-disabled":l?"":void 0,disabled:l,value:c,...m,ref:v,onClick:ge(e.onClick,j=>{y(w=>!w),x&&(h.current=j.isPropagationStopped(),h.current||j.stopPropagation())})}),x&&o.jsx(um,{control:p,bubbles:!h.current,name:n,value:c,checked:b,required:i,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});lm.displayName=mo;var cm="SwitchThumb",dm=g.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,a=fb(cm,r);return o.jsx(we.span,{"data-state":mm(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});dm.displayName=cm;var hb="SwitchBubbleInput",um=g.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...a},s)=>{const i=g.useRef(null),l=ke(i,s),c=na(r),d=aa(t);return g.useEffect(()=>{const u=i.current;if(!u)return;const m=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==r&&p){const f=new Event("click",{bubbles:n});p.call(u,r),u.dispatchEvent(f)}},[c,r,n]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});um.displayName=hb;function mm(e){return e?"checked":"unchecked"}var pm=lm,xb=dm;const _i=g.forwardRef(({className:e,...t},r)=>o.jsx(pm,{ref:r,className:K("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:o.jsx(xb,{className:K("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")})}));_i.displayName=pm.displayName;function Yn(e,[t,r]){return Math.min(r,Math.max(t,e))}function gb(e,t=globalThis==null?void 0:globalThis.document){const r=ft(e);g.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var vb="DismissableLayer",Bs="dismissableLayer.update",bb="dismissableLayer.pointerDownOutside",yb="dismissableLayer.focusOutside",sc,fm=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ia=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,d=g.useContext(fm),[u,m]=g.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=g.useState({}),v=ke(t,$=>m($)),h=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=h.indexOf(x),y=u?h.indexOf(u):-1,j=d.layersWithOutsidePointerEventsDisabled.size>0,w=y>=b,C=kb($=>{const k=$.target,E=[...d.branches].some(T=>T.contains(k));!w||E||(a==null||a($),i==null||i($),$.defaultPrevented||l==null||l())},p),S=Cb($=>{const k=$.target;[...d.branches].some(E=>E.contains(k))||(s==null||s($),i==null||i($),$.defaultPrevented||l==null||l())},p);return gb($=>{y===d.layers.size-1&&(n==null||n($),!$.defaultPrevented&&l&&($.preventDefault(),l()))},p),g.useEffect(()=>{if(u)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(sc=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),ic(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=sc)}},[u,p,r,d]),g.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),ic())},[u,d]),g.useEffect(()=>{const $=()=>f({});return document.addEventListener(Bs,$),()=>document.removeEventListener(Bs,$)},[]),o.jsx(we.div,{...c,ref:v,style:{pointerEvents:j?w?"auto":"none":void 0,...e.style},onFocusCapture:ge(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ge(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ge(e.onPointerDownCapture,C.onPointerDownCapture)})});ia.displayName=vb;var wb="DismissableLayerBranch",jb=g.forwardRef((e,t)=>{const r=g.useContext(fm),n=g.useRef(null),a=ke(t,n);return g.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),o.jsx(we.div,{...e,ref:a})});jb.displayName=wb;function kb(e,t=globalThis==null?void 0:globalThis.document){const r=ft(e),n=g.useRef(!1),a=g.useRef(()=>{});return g.useEffect(()=>{const s=l=>{if(l.target&&!n.current){let c=function(){hm(bb,r,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Cb(e,t=globalThis==null?void 0:globalThis.document){const r=ft(e),n=g.useRef(!1);return g.useEffect(()=>{const a=s=>{s.target&&!n.current&&hm(yb,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function ic(){const e=new CustomEvent(Bs);document.dispatchEvent(e)}function hm(e,t,r,{discrete:n}){const a=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?Ov(a,s):a.dispatchEvent(s)}var as=0;function Ii(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??lc()),document.body.insertAdjacentElement("beforeend",e[1]??lc()),as++,()=>{as===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),as--}},[])}function lc(){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 os="focusScope.autoFocusOnMount",ss="focusScope.autoFocusOnUnmount",cc={bubbles:!1,cancelable:!0},Nb="FocusScope",po=g.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...i}=e,[l,c]=g.useState(null),d=ft(a),u=ft(s),m=g.useRef(null),p=ke(t,h=>c(h)),f=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(n){let h=function(j){if(f.paused||!l)return;const w=j.target;l.contains(w)?m.current=w:Ar(m.current,{select:!0})},x=function(j){if(f.paused||!l)return;const w=j.relatedTarget;w!==null&&(l.contains(w)||Ar(m.current,{select:!0}))},b=function(j){if(document.activeElement===document.body)for(const w of j)w.removedNodes.length>0&&Ar(l)};document.addEventListener("focusin",h),document.addEventListener("focusout",x);const y=new MutationObserver(b);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",x),y.disconnect()}}},[n,l,f.paused]),g.useEffect(()=>{if(l){uc.add(f);const h=document.activeElement;if(!l.contains(h)){const x=new CustomEvent(os,cc);l.addEventListener(os,d),l.dispatchEvent(x),x.defaultPrevented||(Sb(Db(xm(l)),{select:!0}),document.activeElement===h&&Ar(l))}return()=>{l.removeEventListener(os,d),setTimeout(()=>{const x=new CustomEvent(ss,cc);l.addEventListener(ss,u),l.dispatchEvent(x),x.defaultPrevented||Ar(h??document.body,{select:!0}),l.removeEventListener(ss,u),uc.remove(f)},0)}}},[l,d,u,f]);const v=g.useCallback(h=>{if(!r&&!n||f.paused)return;const x=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(x&&b){const y=h.currentTarget,[j,w]=$b(y);j&&w?!h.shiftKey&&b===w?(h.preventDefault(),r&&Ar(j,{select:!0})):h.shiftKey&&b===j&&(h.preventDefault(),r&&Ar(w,{select:!0})):b===y&&h.preventDefault()}},[r,n,f.paused]);return o.jsx(we.div,{tabIndex:-1,...i,ref:p,onKeyDown:v})});po.displayName=Nb;function Sb(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Ar(n,{select:t}),document.activeElement!==r)return}function $b(e){const t=xm(e),r=dc(t,e),n=dc(t.reverse(),e);return[r,n]}function xm(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function dc(e,t){for(const r of e)if(!Eb(r,{upTo:t}))return r}function Eb(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 Tb(e){return e instanceof HTMLInputElement&&"select"in e}function Ar(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Tb(e)&&t&&e.select()}}var uc=Ab();function Ab(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=mc(e,t),e.unshift(t)},remove(t){var r;e=mc(e,t),(r=e[0])==null||r.resume()}}}function mc(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Db(e){return e.filter(t=>t.tagName!=="A")}const Rb=["top","right","bottom","left"],Or=Math.min,$t=Math.max,za=Math.round,ya=Math.floor,lr=e=>({x:e,y:e}),Pb={left:"right",right:"left",bottom:"top",top:"bottom"};function Us(e,t,r){return $t(e,Or(t,r))}function wr(e,t){return typeof e=="function"?e(t):e}function jr(e){return e.split("-")[0]}function Rn(e){return e.split("-")[1]}function Oi(e){return e==="x"?"y":"x"}function Fi(e){return e==="y"?"height":"width"}function ir(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function zi(e){return Oi(ir(e))}function _b(e,t,r){r===void 0&&(r=!1);const n=Rn(e),a=zi(e),s=Fi(a);let i=a==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=La(i)),[i,La(i)]}function Ib(e){const t=La(e);return[Hs(e),t,Hs(t)]}function Hs(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const pc=["left","right"],fc=["right","left"],Ob=["top","bottom"],Fb=["bottom","top"];function zb(e,t,r){switch(e){case"top":case"bottom":return r?t?fc:pc:t?pc:fc;case"left":case"right":return t?Ob:Fb;default:return[]}}function Lb(e,t,r,n){const a=Rn(e);let s=zb(jr(e),r==="start",n);return a&&(s=s.map(i=>i+"-"+a),t&&(s=s.concat(s.map(Hs)))),s}function La(e){const t=jr(e);return Pb[t]+e.slice(t.length)}function Mb(e){return{top:0,right:0,bottom:0,left:0,...e}}function gm(e){return typeof e!="number"?Mb(e):{top:e,right:e,bottom:e,left:e}}function Ma(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function hc(e,t,r){let{reference:n,floating:a}=e;const s=ir(t),i=zi(t),l=Fi(i),c=jr(t),d=s==="y",u=n.x+n.width/2-a.width/2,m=n.y+n.height/2-a.height/2,p=n[l]/2-a[l]/2;let f;switch(c){case"top":f={x:u,y:n.y-a.height};break;case"bottom":f={x:u,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:m};break;case"left":f={x:n.x-a.width,y:m};break;default:f={x:n.x,y:n.y}}switch(Rn(t)){case"start":f[i]-=p*(r&&d?-1:1);break;case"end":f[i]+=p*(r&&d?-1:1);break}return f}async function Vb(e,t){var r;t===void 0&&(t={});const{x:n,y:a,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:m="floating",altBoundary:p=!1,padding:f=0}=wr(t,e),v=gm(f),h=l[p?m==="floating"?"reference":"floating":m],x=Ma(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(h)))==null||r?h:h.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),b=m==="floating"?{x:n,y:a,width:i.floating.width,height:i.floating.height}:i.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),j=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},w=Ma(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:y,strategy:c}):b);return{top:(x.top-w.top+v.top)/j.y,bottom:(w.bottom-x.bottom+v.bottom)/j.y,left:(x.left-w.left+v.left)/j.x,right:(w.right-x.right+v.right)/j.x}}const Bb=50,Ub=async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:s=[],platform:i}=r,l=i.detectOverflow?i:{...i,detectOverflow:Vb},c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:u,y:m}=hc(d,n,c),p=n,f=0;const v={};for(let h=0;h<s.length;h++){const x=s[h];if(!x)continue;const{name:b,fn:y}=x,{x:j,y:w,data:C,reset:S}=await y({x:u,y:m,initialPlacement:n,placement:p,strategy:a,middlewareData:v,rects:d,platform:l,elements:{reference:e,floating:t}});u=j??u,m=w??m,v[b]={...v[b],...C},S&&f<Bb&&(f++,typeof S=="object"&&(S.placement&&(p=S.placement),S.rects&&(d=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:a}):S.rects),{x:u,y:m}=hc(d,p,c)),h=-1)}return{x:u,y:m,placement:p,strategy:a,middlewareData:v}},Hb=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=wr(e,t)||{};if(d==null)return{};const m=gm(u),p={x:r,y:n},f=zi(a),v=Fi(f),h=await i.getDimensions(d),x=f==="y",b=x?"top":"left",y=x?"bottom":"right",j=x?"clientHeight":"clientWidth",w=s.reference[v]+s.reference[f]-p[f]-s.floating[v],C=p[f]-s.reference[f],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let $=S?S[j]:0;(!$||!await(i.isElement==null?void 0:i.isElement(S)))&&($=l.floating[j]||s.floating[v]);const k=w/2-C/2,E=$/2-h[v]/2-1,T=Or(m[b],E),O=Or(m[y],E),L=T,A=$-h[v]-O,z=$/2-h[v]/2+k,X=Us(L,z,A),q=!c.arrow&&Rn(a)!=null&&z!==X&&s.reference[v]/2-(z<L?T:O)-h[v]/2<0,Z=q?z<L?z-L:z-A:0;return{[f]:p[f]+Z,data:{[f]:X,centerOffset:z-X-Z,...q&&{alignmentOffset:Z}},reset:q}}}),Wb=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:m=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:h=!0,...x}=wr(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const b=jr(a),y=ir(l),j=jr(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(d.floating)),C=p||(j||!h?[La(l)]:Ib(l)),S=v!=="none";!p&&S&&C.push(...Lb(l,h,v,w));const $=[l,...C],k=await c.detectOverflow(t,x),E=[];let T=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&E.push(k[b]),m){const z=_b(a,i,w);E.push(k[z[0]],k[z[1]])}if(T=[...T,{placement:a,overflows:E}],!E.every(z=>z<=0)){var O,L;const z=(((O=s.flip)==null?void 0:O.index)||0)+1,X=$[z];if(X&&(!(m==="alignment"&&y!==ir(X))||T.every(Z=>ir(Z.placement)===y?Z.overflows[0]>0:!0)))return{data:{index:z,overflows:T},reset:{placement:X}};let q=(L=T.filter(Z=>Z.overflows[0]<=0).sort((Z,V)=>Z.overflows[1]-V.overflows[1])[0])==null?void 0:L.placement;if(!q)switch(f){case"bestFit":{var A;const Z=(A=T.filter(V=>{if(S){const M=ir(V.placement);return M===y||M==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(M=>M>0).reduce((M,_)=>M+_,0)]).sort((V,M)=>V[1]-M[1])[0])==null?void 0:A[0];Z&&(q=Z);break}case"initialPlacement":q=l;break}if(a!==q)return{reset:{placement:q}}}return{}}}};function xc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function gc(e){return Rb.some(t=>e[t]>=0)}const qb=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...s}=wr(e,t);switch(a){case"referenceHidden":{const i=await n.detectOverflow(t,{...s,elementContext:"reference"}),l=xc(i,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:gc(l)}}}case"escaped":{const i=await n.detectOverflow(t,{...s,altBoundary:!0}),l=xc(i,r.floating);return{data:{escapedOffsets:l,escaped:gc(l)}}}default:return{}}}}},vm=new Set(["left","top"]);async function Gb(e,t){const{placement:r,platform:n,elements:a}=e,s=await(n.isRTL==null?void 0:n.isRTL(a.floating)),i=jr(r),l=Rn(r),c=ir(r)==="y",d=vm.has(i)?-1:1,u=s&&c?-1:1,m=wr(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&typeof v=="number"&&(f=l==="end"?v*-1:v),c?{x:f*u,y:p*d}:{x:p*d,y:f*u}}const Xb=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:s,placement:i,middlewareData:l}=t,c=await Gb(t,e);return i===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:a+c.x,y:s+c.y,data:{...c,placement:i}}}}},Zb=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:y,y:j}=b;return{x:y,y:j}}},...d}=wr(e,t),u={x:r,y:n},m=await s.detectOverflow(t,d),p=ir(jr(a)),f=Oi(p);let v=u[f],h=u[p];if(i){const b=f==="y"?"top":"left",y=f==="y"?"bottom":"right",j=v+m[b],w=v-m[y];v=Us(j,v,w)}if(l){const b=p==="y"?"top":"left",y=p==="y"?"bottom":"right",j=h+m[b],w=h-m[y];h=Us(j,h,w)}const x=c.fn({...t,[f]:v,[p]:h});return{...x,data:{x:x.x-r,y:x.y-n,enabled:{[f]:i,[p]:l}}}}}},Kb=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=wr(e,t),u={x:r,y:n},m=ir(a),p=Oi(m);let f=u[p],v=u[m];const h=wr(l,t),x=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const j=p==="y"?"height":"width",w=s.reference[p]-s.floating[j]+x.mainAxis,C=s.reference[p]+s.reference[j]-x.mainAxis;f<w?f=w:f>C&&(f=C)}if(d){var b,y;const j=p==="y"?"width":"height",w=vm.has(jr(a)),C=s.reference[m]-s.floating[j]+(w&&((b=i.offset)==null?void 0:b[m])||0)+(w?0:x.crossAxis),S=s.reference[m]+s.reference[j]+(w?0:((y=i.offset)==null?void 0:y[m])||0)-(w?x.crossAxis:0);v<C?v=C:v>S&&(v=S)}return{[p]:f,[m]:v}}}},Yb=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...d}=wr(e,t),u=await i.detectOverflow(t,d),m=jr(a),p=Rn(a),f=ir(a)==="y",{width:v,height:h}=s.floating;let x,b;m==="top"||m==="bottom"?(x=m,b=p===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(b=m,x=p==="end"?"top":"bottom");const y=h-u.top-u.bottom,j=v-u.left-u.right,w=Or(h-u[x],y),C=Or(v-u[b],j),S=!t.middlewareData.shift;let $=w,k=C;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(k=j),(n=t.middlewareData.shift)!=null&&n.enabled.y&&($=y),S&&!p){const T=$t(u.left,0),O=$t(u.right,0),L=$t(u.top,0),A=$t(u.bottom,0);f?k=v-2*(T!==0||O!==0?T+O:$t(u.left,u.right)):$=h-2*(L!==0||A!==0?L+A:$t(u.top,u.bottom))}await c({...t,availableWidth:k,availableHeight:$});const E=await i.getDimensions(l.floating);return v!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}};function fo(){return typeof window<"u"}function Pn(e){return bm(e)?(e.nodeName||"").toLowerCase():"#document"}function At(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mr(e){var t;return(t=(bm(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function bm(e){return fo()?e instanceof Node||e instanceof At(e).Node:!1}function Yt(e){return fo()?e instanceof Element||e instanceof At(e).Element:!1}function kr(e){return fo()?e instanceof HTMLElement||e instanceof At(e).HTMLElement:!1}function vc(e){return!fo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof At(e).ShadowRoot}function la(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Jt(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&a!=="inline"&&a!=="contents"}function Jb(e){return/^(table|td|th)$/.test(Pn(e))}function ho(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Qb=/transform|translate|scale|rotate|perspective|filter/,ey=/paint|layout|strict|content/,qr=e=>!!e&&e!=="none";let is;function Li(e){const t=Yt(e)?Jt(e):e;return qr(t.transform)||qr(t.translate)||qr(t.scale)||qr(t.rotate)||qr(t.perspective)||!Mi()&&(qr(t.backdropFilter)||qr(t.filter))||Qb.test(t.willChange||"")||ey.test(t.contain||"")}function ty(e){let t=Fr(e);for(;kr(t)&&!Nn(t);){if(Li(t))return t;if(ho(t))return null;t=Fr(t)}return null}function Mi(){return is==null&&(is=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),is}function Nn(e){return/^(html|body|#document)$/.test(Pn(e))}function Jt(e){return At(e).getComputedStyle(e)}function xo(e){return Yt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Fr(e){if(Pn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||vc(e)&&e.host||mr(e);return vc(t)?t.host:t}function ym(e){const t=Fr(e);return Nn(t)?e.ownerDocument?e.ownerDocument.body:e.body:kr(t)&&la(t)?t:ym(t)}function Jn(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const a=ym(e),s=a===((n=e.ownerDocument)==null?void 0:n.body),i=At(a);if(s){const l=Ws(i);return t.concat(i,i.visualViewport||[],la(a)?a:[],l&&r?Jn(l):[])}else return t.concat(a,Jn(a,[],r))}function Ws(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wm(e){const t=Jt(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=kr(e),s=a?e.offsetWidth:r,i=a?e.offsetHeight:n,l=za(r)!==s||za(n)!==i;return l&&(r=s,n=i),{width:r,height:n,$:l}}function Vi(e){return Yt(e)?e:e.contextElement}function wn(e){const t=Vi(e);if(!kr(t))return lr(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:s}=wm(t);let i=(s?za(r.width):r.width)/n,l=(s?za(r.height):r.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const ry=lr(0);function jm(e){const t=At(e);return!Mi()||!t.visualViewport?ry:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ny(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==At(e)?!1:t}function Qr(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const a=e.getBoundingClientRect(),s=Vi(e);let i=lr(1);t&&(n?Yt(n)&&(i=wn(n)):i=wn(e));const l=ny(s,r,n)?jm(s):lr(0);let c=(a.left+l.x)/i.x,d=(a.top+l.y)/i.y,u=a.width/i.x,m=a.height/i.y;if(s){const p=At(s),f=n&&Yt(n)?At(n):n;let v=p,h=Ws(v);for(;h&&n&&f!==v;){const x=wn(h),b=h.getBoundingClientRect(),y=Jt(h),j=b.left+(h.clientLeft+parseFloat(y.paddingLeft))*x.x,w=b.top+(h.clientTop+parseFloat(y.paddingTop))*x.y;c*=x.x,d*=x.y,u*=x.x,m*=x.y,c+=j,d+=w,v=At(h),h=Ws(v)}}return Ma({width:u,height:m,x:c,y:d})}function go(e,t){const r=xo(e).scrollLeft;return t?t.left+r:Qr(mr(e)).left+r}function km(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-go(e,r),a=r.top+t.scrollTop;return{x:n,y:a}}function ay(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const s=a==="fixed",i=mr(n),l=t?ho(t.floating):!1;if(n===i||l&&s)return r;let c={scrollLeft:0,scrollTop:0},d=lr(1);const u=lr(0),m=kr(n);if((m||!m&&!s)&&((Pn(n)!=="body"||la(i))&&(c=xo(n)),m)){const f=Qr(n);d=wn(n),u.x=f.x+n.clientLeft,u.y=f.y+n.clientTop}const p=i&&!m&&!s?km(i,c):lr(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-c.scrollLeft*d.x+u.x+p.x,y:r.y*d.y-c.scrollTop*d.y+u.y+p.y}}function oy(e){return Array.from(e.getClientRects())}function sy(e){const t=mr(e),r=xo(e),n=e.ownerDocument.body,a=$t(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=$t(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+go(e);const l=-r.scrollTop;return Jt(n).direction==="rtl"&&(i+=$t(t.clientWidth,n.clientWidth)-a),{width:a,height:s,x:i,y:l}}const bc=25;function iy(e,t){const r=At(e),n=mr(e),a=r.visualViewport;let s=n.clientWidth,i=n.clientHeight,l=0,c=0;if(a){s=a.width,i=a.height;const u=Mi();(!u||u&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}const d=go(n);if(d<=0){const u=n.ownerDocument,m=u.body,p=getComputedStyle(m),f=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,v=Math.abs(n.clientWidth-m.clientWidth-f);v<=bc&&(s-=v)}else d<=bc&&(s+=d);return{width:s,height:i,x:l,y:c}}function ly(e,t){const r=Qr(e,!0,t==="fixed"),n=r.top+e.clientTop,a=r.left+e.clientLeft,s=kr(e)?wn(e):lr(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=a*s.x,d=n*s.y;return{width:i,height:l,x:c,y:d}}function yc(e,t,r){let n;if(t==="viewport")n=iy(e,r);else if(t==="document")n=sy(mr(e));else if(Yt(t))n=ly(t,r);else{const a=jm(e);n={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Ma(n)}function Cm(e,t){const r=Fr(e);return r===t||!Yt(r)||Nn(r)?!1:Jt(r).position==="fixed"||Cm(r,t)}function cy(e,t){const r=t.get(e);if(r)return r;let n=Jn(e,[],!1).filter(l=>Yt(l)&&Pn(l)!=="body"),a=null;const s=Jt(e).position==="fixed";let i=s?Fr(e):e;for(;Yt(i)&&!Nn(i);){const l=Jt(i),c=Li(i);!c&&l.position==="fixed"&&(a=null),(s?!c&&!a:!c&&l.position==="static"&&a&&(a.position==="absolute"||a.position==="fixed")||la(i)&&!c&&Cm(e,i))?n=n.filter(d=>d!==i):a=l,i=Fr(i)}return t.set(e,n),n}function dy(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const s=[...r==="clippingAncestors"?ho(t)?[]:cy(t,this._c):[].concat(r),n],i=yc(t,s[0],a);let l=i.top,c=i.right,d=i.bottom,u=i.left;for(let m=1;m<s.length;m++){const p=yc(t,s[m],a);l=$t(p.top,l),c=Or(p.right,c),d=Or(p.bottom,d),u=$t(p.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function uy(e){const{width:t,height:r}=wm(e);return{width:t,height:r}}function my(e,t,r){const n=kr(t),a=mr(t),s=r==="fixed",i=Qr(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=lr(0);function d(){c.x=go(a)}if(n||!n&&!s)if((Pn(t)!=="body"||la(a))&&(l=xo(t)),n){const f=Qr(t,!0,s,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else a&&d();s&&!n&&a&&d();const u=a&&!n&&!s?km(a,l):lr(0),m=i.left+l.scrollLeft-c.x-u.x,p=i.top+l.scrollTop-c.y-u.y;return{x:m,y:p,width:i.width,height:i.height}}function ls(e){return Jt(e).position==="static"}function wc(e,t){if(!kr(e)||Jt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return mr(e)===r&&(r=r.ownerDocument.body),r}function Nm(e,t){const r=At(e);if(ho(e))return r;if(!kr(e)){let a=Fr(e);for(;a&&!Nn(a);){if(Yt(a)&&!ls(a))return a;a=Fr(a)}return r}let n=wc(e,t);for(;n&&Jb(n)&&ls(n);)n=wc(n,t);return n&&Nn(n)&&ls(n)&&!Li(n)?r:n||ty(e)||r}const py=async function(e){const t=this.getOffsetParent||Nm,r=this.getDimensions,n=await r(e.floating);return{reference:my(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function fy(e){return Jt(e).direction==="rtl"}const hy={convertOffsetParentRelativeRectToViewportRelativeRect:ay,getDocumentElement:mr,getClippingRect:dy,getOffsetParent:Nm,getElementRects:py,getClientRects:oy,getDimensions:uy,getScale:wn,isElement:Yt,isRTL:fy};function Sm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function xy(e,t){let r=null,n;const a=mr(e);function s(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:u,top:m,width:p,height:f}=d;if(l||t(),!p||!f)return;const v=ya(m),h=ya(a.clientWidth-(u+p)),x=ya(a.clientHeight-(m+f)),b=ya(u),y={rootMargin:-v+"px "+-h+"px "+-x+"px "+-b+"px",threshold:$t(0,Or(1,c))||1};let j=!0;function w(C){const S=C[0].intersectionRatio;if(S!==c){if(!j)return i();S?i(!1,S):n=setTimeout(()=>{i(!1,1e-7)},1e3)}S===1&&!Sm(d,e.getBoundingClientRect())&&i(),j=!1}try{r=new IntersectionObserver(w,{...y,root:a.ownerDocument})}catch{r=new IntersectionObserver(w,y)}r.observe(e)}return i(!0),s}function gy(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,d=Vi(e),u=a||s?[...d?Jn(d):[],...t?Jn(t):[]]:[];u.forEach(b=>{a&&b.addEventListener("scroll",r,{passive:!0}),s&&b.addEventListener("resize",r)});const m=d&&l?xy(d,r):null;let p=-1,f=null;i&&(f=new ResizeObserver(b=>{let[y]=b;y&&y.target===d&&f&&t&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var j;(j=f)==null||j.observe(t)})),r()}),d&&!c&&f.observe(d),t&&f.observe(t));let v,h=c?Qr(e):null;c&&x();function x(){const b=Qr(e);h&&!Sm(h,b)&&r(),h=b,v=requestAnimationFrame(x)}return r(),()=>{var b;u.forEach(y=>{a&&y.removeEventListener("scroll",r),s&&y.removeEventListener("resize",r)}),m==null||m(),(b=f)==null||b.disconnect(),f=null,c&&cancelAnimationFrame(v)}}const vy=Xb,by=Zb,yy=Wb,wy=Yb,jy=qb,jc=Hb,ky=Kb,Cy=(e,t,r)=>{const n=new Map,a={platform:hy,...r},s={...a.platform,_c:n};return Ub(e,t,{...a,platform:s})};var Ny=typeof document<"u",Sy=function(){},Pa=Ny?N.useLayoutEffect:Sy;function Va(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,n,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!Va(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;n--!==0;){const s=a[n];if(!(s==="_owner"&&e.$$typeof)&&!Va(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function $m(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function kc(e,t){const r=$m(e);return Math.round(t*r)/r}function cs(e){const t=g.useRef(e);return Pa(()=>{t.current=e}),t}function $y(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,m]=g.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=g.useState(n);Va(p,n)||f(n);const[v,h]=g.useState(null),[x,b]=g.useState(null),y=g.useCallback(V=>{V!==S.current&&(S.current=V,h(V))},[]),j=g.useCallback(V=>{V!==$.current&&($.current=V,b(V))},[]),w=s||v,C=i||x,S=g.useRef(null),$=g.useRef(null),k=g.useRef(u),E=c!=null,T=cs(c),O=cs(a),L=cs(d),A=g.useCallback(()=>{if(!S.current||!$.current)return;const V={placement:t,strategy:r,middleware:p};O.current&&(V.platform=O.current),Cy(S.current,$.current,V).then(M=>{const _={...M,isPositioned:L.current!==!1};z.current&&!Va(k.current,_)&&(k.current=_,ao.flushSync(()=>{m(_)}))})},[p,t,r,O,L]);Pa(()=>{d===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,m(V=>({...V,isPositioned:!1})))},[d]);const z=g.useRef(!1);Pa(()=>(z.current=!0,()=>{z.current=!1}),[]),Pa(()=>{if(w&&(S.current=w),C&&($.current=C),w&&C){if(T.current)return T.current(w,C,A);A()}},[w,C,A,T,E]);const X=g.useMemo(()=>({reference:S,floating:$,setReference:y,setFloating:j}),[y,j]),q=g.useMemo(()=>({reference:w,floating:C}),[w,C]),Z=g.useMemo(()=>{const V={position:r,left:0,top:0};if(!q.floating)return V;const M=kc(q.floating,u.x),_=kc(q.floating,u.y);return l?{...V,transform:"translate("+M+"px, "+_+"px)",...$m(q.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:M,top:_}},[r,l,q.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:A,refs:X,elements:q,floatingStyles:Z}),[u,A,X,q,Z])}const Ey=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:a}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?jc({element:n.current,padding:a}).fn(r):{}:n?jc({element:n,padding:a}).fn(r):{}}}},Ty=(e,t)=>{const r=vy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Ay=(e,t)=>{const r=by(e);return{name:r.name,fn:r.fn,options:[e,t]}},Dy=(e,t)=>({fn:ky(e).fn,options:[e,t]}),Ry=(e,t)=>{const r=yy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Py=(e,t)=>{const r=wy(e);return{name:r.name,fn:r.fn,options:[e,t]}},_y=(e,t)=>{const r=jy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Iy=(e,t)=>{const r=Ey(e);return{name:r.name,fn:r.fn,options:[e,t]}};var Oy="Arrow",Em=g.forwardRef((e,t)=>{const{children:r,width:n=10,height:a=5,...s}=e;return o.jsx(we.svg,{...s,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});Em.displayName=Oy;var Fy=Em,Bi="Popper",[Tm,_n]=_t(Bi),[zy,Am]=Tm(Bi),Dm=e=>{const{__scopePopper:t,children:r}=e,[n,a]=g.useState(null);return o.jsx(zy,{scope:t,anchor:n,onAnchorChange:a,children:r})};Dm.displayName=Bi;var Rm="PopperAnchor",Pm=g.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...a}=e,s=Am(Rm,r),i=g.useRef(null),l=ke(t,i),c=g.useRef(null);return g.useEffect(()=>{const d=c.current;c.current=(n==null?void 0:n.current)||i.current,d!==c.current&&s.onAnchorChange(c.current)}),n?null:o.jsx(we.div,{...a,ref:l})});Pm.displayName=Rm;var Ui="PopperContent",[Ly,My]=Tm(Ui),_m=g.forwardRef((e,t)=>{var r,n,a,s,i,l;const{__scopePopper:c,side:d="bottom",sideOffset:u=0,align:m="center",alignOffset:p=0,arrowPadding:f=0,avoidCollisions:v=!0,collisionBoundary:h=[],collisionPadding:x=0,sticky:b="partial",hideWhenDetached:y=!1,updatePositionStrategy:j="optimized",onPlaced:w,...C}=e,S=Am(Ui,c),[$,k]=g.useState(null),E=ke(t,Ce=>k(Ce)),[T,O]=g.useState(null),L=aa(T),A=(L==null?void 0:L.width)??0,z=(L==null?void 0:L.height)??0,X=d+(m!=="center"?"-"+m:""),q=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},Z=Array.isArray(h)?h:[h],V=Z.length>0,M={padding:q,boundary:Z.filter(By),altBoundary:V},{refs:_,floatingStyles:se,placement:U,isPositioned:Q,middlewareData:Y}=$y({strategy:"fixed",placement:X,whileElementsMounted:(...Ce)=>gy(...Ce,{animationFrame:j==="always"}),elements:{reference:S.anchor},middleware:[Ty({mainAxis:u+z,alignmentAxis:p}),v&&Ay({mainAxis:!0,crossAxis:!1,limiter:b==="partial"?Dy():void 0,...M}),v&&Ry({...M}),Py({...M,apply:({elements:Ce,rects:ve,availableWidth:me,availableHeight:Te})=>{const{width:ze,height:dt}=ve.reference,Ve=Ce.floating.style;Ve.setProperty("--radix-popper-available-width",`${me}px`),Ve.setProperty("--radix-popper-available-height",`${Te}px`),Ve.setProperty("--radix-popper-anchor-width",`${ze}px`),Ve.setProperty("--radix-popper-anchor-height",`${dt}px`)}}),T&&Iy({element:T,padding:f}),Uy({arrowWidth:A,arrowHeight:z}),y&&_y({strategy:"referenceHidden",...M})]}),[H,W]=Fm(U),G=ft(w);lt(()=>{Q&&(G==null||G())},[Q,G]);const ne=(r=Y.arrow)==null?void 0:r.x,J=(n=Y.arrow)==null?void 0:n.y,te=((a=Y.arrow)==null?void 0:a.centerOffset)!==0,[ce,be]=g.useState();return lt(()=>{$&&be(window.getComputedStyle($).zIndex)},[$]),o.jsx("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...se,transform:Q?se.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[(s=Y.transformOrigin)==null?void 0:s.x,(i=Y.transformOrigin)==null?void 0:i.y].join(" "),...((l=Y.hide)==null?void 0:l.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(Ly,{scope:c,placedSide:H,onArrowChange:O,arrowX:ne,arrowY:J,shouldHideArrow:te,children:o.jsx(we.div,{"data-side":H,"data-align":W,...C,ref:E,style:{...C.style,animation:Q?void 0:"none"}})})})});_m.displayName=Ui;var Im="PopperArrow",Vy={top:"bottom",right:"left",bottom:"top",left:"right"},Om=g.forwardRef(function(e,t){const{__scopePopper:r,...n}=e,a=My(Im,r),s=Vy[a.placedSide];return o.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:o.jsx(Fy,{...n,ref:t,style:{...n.style,display:"block"}})})});Om.displayName=Im;function By(e){return e!==null}var Uy=e=>({name:"transformOrigin",options:e,fn(t){var r,n,a;const{placement:s,rects:i,middlewareData:l}=t,c=((r=l.arrow)==null?void 0:r.centerOffset)!==0,d=c?0:e.arrowWidth,u=c?0:e.arrowHeight,[m,p]=Fm(s),f={start:"0%",center:"50%",end:"100%"}[p],v=(((n=l.arrow)==null?void 0:n.x)??0)+d/2,h=(((a=l.arrow)==null?void 0:a.y)??0)+u/2;let x="",b="";return m==="bottom"?(x=c?f:`${v}px`,b=`${-u}px`):m==="top"?(x=c?f:`${v}px`,b=`${i.floating.height+u}px`):m==="right"?(x=`${-u}px`,b=c?f:`${h}px`):m==="left"&&(x=`${i.floating.width+u}px`,b=c?f:`${h}px`),{data:{x,y:b}}}});function Fm(e){const[t,r="center"]=e.split("-");return[t,r]}var Hi=Dm,vo=Pm,Wi=_m,qi=Om,Hy="Portal",bo=g.forwardRef((e,t)=>{var r;const{container:n,...a}=e,[s,i]=g.useState(!1);lt(()=>i(!0),[]);const l=n||s&&((r=globalThis==null?void 0:globalThis.document)==null?void 0:r.body);return l?xi.createPortal(o.jsx(we.div,{...a,ref:t}),l):null});bo.displayName=Hy;var zm=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"}),Wy="VisuallyHidden",Lm=g.forwardRef((e,t)=>o.jsx(we.span,{...e,ref:t,style:{...zm,...e.style}}));Lm.displayName=Wy;var qy=Lm,Gy=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},cn=new WeakMap,wa=new WeakMap,ja={},ds=0,Mm=function(e){return e&&(e.host||Mm(e.parentNode))},Xy=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Mm(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Zy=function(e,t,r,n){var a=Xy(t,Array.isArray(e)?e:[e]);ja[r]||(ja[r]=new WeakMap);var s=ja[r],i=[],l=new Set,c=new Set(a),d=function(m){!m||l.has(m)||(l.add(m),d(m.parentNode))};a.forEach(d);var u=function(m){!m||c.has(m)||Array.prototype.forEach.call(m.children,function(p){if(l.has(p))u(p);else try{var f=p.getAttribute(n),v=f!==null&&f!=="false",h=(cn.get(p)||0)+1,x=(s.get(p)||0)+1;cn.set(p,h),s.set(p,x),i.push(p),h===1&&v&&wa.set(p,!0),x===1&&p.setAttribute(r,"true"),v||p.setAttribute(n,"true")}catch(b){console.error("aria-hidden: cannot operate on ",p,b)}})};return u(t),l.clear(),ds++,function(){i.forEach(function(m){var p=cn.get(m)-1,f=s.get(m)-1;cn.set(m,p),s.set(m,f),p||(wa.has(m)||m.removeAttribute(n),wa.delete(m)),f||m.removeAttribute(r)}),ds--,ds||(cn=new WeakMap,cn=new WeakMap,wa=new WeakMap,ja={})}},Gi=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=Gy(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),Zy(n,a,r,"aria-hidden")):function(){return null}},sr=function(){return sr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},sr.apply(this,arguments)};function Vm(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function Ky(e,t,r){for(var n=0,a=t.length,s;n<a;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}var _a="right-scroll-bar-position",Ia="width-before-scroll-bar",Yy="with-scroll-bars-hidden",Jy="--removed-body-scroll-bar-size";function us(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Qy(e,t){var r=N.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var a=r.value;a!==n&&(r.value=n,r.callback(n,a))}}}})[0];return r.callback=t,r.facade}var e0=typeof window<"u"?g.useLayoutEffect:g.useEffect,Cc=new WeakMap;function t0(e,t){var r=Qy(null,function(n){return e.forEach(function(a){return us(a,n)})});return e0(function(){var n=Cc.get(r);if(n){var a=new Set(n),s=new Set(e),i=r.current;a.forEach(function(l){s.has(l)||us(l,null)}),s.forEach(function(l){a.has(l)||us(l,i)})}Cc.set(r,e)},[e]),r}function r0(e){return e}function n0(e,t){t===void 0&&(t=r0);var r=[],n=!1,a={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(s){var i=t(s,n);return r.push(i),function(){r=r.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(n=!0;r.length;){var i=r;r=[],i.forEach(s)}r={push:function(l){return s(l)},filter:function(){return r}}},assignMedium:function(s){n=!0;var i=[];if(r.length){var l=r;r=[],l.forEach(s),i=r}var c=function(){var u=i;i=[],u.forEach(s)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(u){i.push(u),d()},filter:function(u){return i=i.filter(u),r}}}};return a}function a0(e){e===void 0&&(e={});var t=n0(null);return t.options=sr({async:!0,ssr:!1},e),t}var Bm=function(e){var t=e.sideCar,r=Vm(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return g.createElement(n,sr({},r))};Bm.isSideCarExport=!0;function o0(e,t){return e.useMedium(t),Bm}var Um=a0(),ms=function(){},yo=g.forwardRef(function(e,t){var r=g.useRef(null),n=g.useState({onScrollCapture:ms,onWheelCapture:ms,onTouchMoveCapture:ms}),a=n[0],s=n[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,m=e.shards,p=e.sideCar,f=e.noRelative,v=e.noIsolation,h=e.inert,x=e.allowPinchZoom,b=e.as,y=b===void 0?"div":b,j=e.gapMode,w=Vm(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=p,S=t0([r,t]),$=sr(sr({},w),a);return g.createElement(g.Fragment,null,u&&g.createElement(C,{sideCar:Um,removeScrollBar:d,shards:m,noRelative:f,noIsolation:v,inert:h,setCallbacks:s,allowPinchZoom:!!x,lockRef:r,gapMode:j}),i?g.cloneElement(g.Children.only(l),sr(sr({},$),{ref:S})):g.createElement(y,sr({},$,{className:c,ref:S}),l))});yo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};yo.classNames={fullWidth:Ia,zeroRight:_a};var s0=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function i0(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=s0();return t&&e.setAttribute("nonce",t),e}function l0(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function c0(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var d0=function(){var e=0,t=null;return{add:function(r){e==0&&(t=i0())&&(l0(t,r),c0(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},u0=function(){var e=d0();return function(t,r){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Hm=function(){var e=u0(),t=function(r){var n=r.styles,a=r.dynamic;return e(n,a),null};return t},m0={left:0,top:0,right:0,gap:0},ps=function(e){return parseInt(e||"",10)||0},p0=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[ps(r),ps(n),ps(a)]},f0=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return m0;var t=p0(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},h0=Hm(),jn="data-scroll-locked",x0=function(e,t,r,n){var a=e.left,s=e.top,i=e.right,l=e.gap;return r===void 0&&(r="margin"),`
31
- .`.concat(Yy,` {
30
+ <%s key={someKey} {...props} />`,ns,Hr,qx,Hr),Kl[Hr+ns]=!0}}return _===n?Vx(Ye):Mx(Ye),Ye}}function Bx(_,ee,de){return Yl(_,ee,de,!0)}function Ux(_,ee,de){return Yl(_,ee,de,!1)}var Hx=Ux,Wx=Bx;va.Fragment=n,va.jsx=Hx,va.jsxs=Wx}()),va}process.env.NODE_ENV==="production"?Bs.exports=fg():Bs.exports=hg();var os=Bs.exports;const Us=j.createContext(io("moderno")),Yn=({config:e,children:t,renderWrapper:r=!0,className:n,style:a})=>{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,...a};return r?os.jsx(Us.Provider,{value:e,children:os.jsx("div",{className:n,style:s,"data-template":"1",children:t})}):os.jsx(Us.Provider,{value:e,children:t})},na=()=>j.useContext(Us),lo=[{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:P.TEXTO,label:"Nome completo",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Seu nome completo"},{id:"_personal_email",nome:"email",tipo:P.EMAIL,label:"E-mail",ordem:1,tamanho:6,obrigatorio:!0,placeholder:"seuemail@exemplo.com"},{id:"_personal_telefone",nome:"telefone",tipo:P.TELEFONE,label:"Telefone / WhatsApp",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_personal_cpf",nome:"cpf",tipo:P.CPF,label:"CPF",ordem:3,tamanho:6,obrigatorio:!1,placeholder:"000.000.000-00"},{id:"_personal_nascimento",nome:"data_nascimento",tipo:P.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:P.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:P.TEXTO,label:"Nome",ordem:0,tamanho:4,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_array_parentesco",nome:"parentesco",tipo:P.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:P.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:P.TEXTO,label:"Nome",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_parentesco",nome:"parentesco",tipo:P.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:P.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:P.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:P.TEXTO,label:"Logradouro",ordem:1,tamanho:8,obrigatorio:!1,placeholder:"Rua, Av., Travessa...",locked:!0},{id:"_address_numero",nome:"_address_numero",tipo:P.TEXTO,label:"Número",ordem:2,tamanho:3,obrigatorio:!1,placeholder:"Nº"},{id:"_address_complemento",nome:"_address_complemento",tipo:P.TEXTO,label:"Complemento",ordem:3,tamanho:9,obrigatorio:!1,placeholder:"Apto, bloco, casa..."},{id:"_address_bairro",nome:"_address_bairro",tipo:P.TEXTO,label:"Bairro",ordem:4,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_cidade",nome:"_address_cidade",tipo:P.TEXTO,label:"Cidade",ordem:5,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_estado",nome:"_address_estado",tipo:P.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:P.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:P.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:P.TELEFONE,label:"Telefone do responsável",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_resp_cpf",nome:"responsavel_cpf",tipo:P.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:P.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:P.TEXTO,label:"Plano de saúde",ordem:1,tamanho:8,obrigatorio:!1,placeholder:'Ex: Unimed... ou "Nenhum"'},{id:"_health_alergias",nome:"alergias",tipo:P.TEXTAREA,label:"Alergias",ordem:2,tamanho:12,obrigatorio:!1,placeholder:"Descreva alergias conhecidas"},{id:"_health_medicamentos",nome:"medicamentos",tipo:P.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:P.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:P.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:P.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:P.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:P.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:P.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:P.PARTICIPATION_TYPE,label:"Tipo de Participação",hint:"Escolha como você deseja participar",ordem:0,tamanho:12,obrigatorio:!0,locked:!0}]}}],xg=e=>lo.filter(t=>t.category===e),Ni=e=>lo.find(t=>t.id===e),Si=[{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:P.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:P.PAYMENT_METHOD,label:"Forma de Pagamento",ordem:0,tamanho:12,obrigatorio:!0,locked:!0,relatedFieldName:"tipo_participacao"}]}]}]}],gg=e=>Si.find(t=>t.id===e);function xu(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=xu(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function gu(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=xu(e))&&(n&&(n+=" "),n+=t);return n}const vg=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},bg=(e,t)=>({classGroupId:e,validator:t}),vu=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),La="-",ec=[],yg="arbitrary..",wg=e=>{const t=jg(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return kg(a);const s=a.split(La),i=s[0]===""&&s.length>1?1:0;return bu(s,i,t)},getConflictingClassGroupIds:(a,s)=>{if(s){const i=n[a],l=r[a];return i?l?vg(l,i):i:l||ec}return r[a]||ec}}},bu=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const c=bu(e,t+1,a);if(c)return c}const s=r.validators;if(s===null)return;const i=t===0?e.join(La):e.slice(t).join(La),l=s.length;for(let c=0;c<l;c++){const d=s[c];if(d.validator(i))return d.classGroupId}},kg=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?yg+n:void 0})(),jg=e=>{const{theme:t,classGroups:r}=e;return Cg(r,t)},Cg=(e,t)=>{const r=vu();for(const n in e){const a=e[n];$i(a,r,n,t)}return r},$i=(e,t,r,n)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];Ng(i,t,r,n)}},Ng=(e,t,r,n)=>{if(typeof e=="string"){Sg(e,t,r);return}if(typeof e=="function"){$g(e,t,r,n);return}Eg(e,t,r,n)},Sg=(e,t,r)=>{const n=e===""?t:yu(t,e);n.classGroupId=r},$g=(e,t,r,n)=>{if(Tg(e)){$i(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(bg(r,e))},Eg=(e,t,r,n)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[l,c]=a[i];$i(c,yu(t,l),r,n)}},yu=(e,t)=>{let r=e;const n=t.split(La),a=n.length;for(let s=0;s<a;s++){const i=n[s];let l=r.nextPart.get(i);l||(l=vu(),r.nextPart.set(i,l)),r=l}return r},Tg=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Ag=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(s,i)=>{r[s]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let i=r[s];if(i!==void 0)return i;if((i=n[s])!==void 0)return a(s,i),i},set(s,i){s in r?r[s]=i:a(s,i)}}},Hs="!",tc=":",Dg=[],rc=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),Rg=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let i=0,l=0,c=0,d;const u=a.length;for(let h=0;h<u;h++){const x=a[h];if(i===0&&l===0){if(x===tc){s.push(a.slice(c,h)),c=h+1;continue}if(x==="/"){d=h;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const m=s.length===0?a:a.slice(c);let p=m,f=!1;m.endsWith(Hs)?(p=m.slice(0,-1),f=!0):m.startsWith(Hs)&&(p=m.slice(1),f=!0);const v=d&&d>c?d-c:void 0;return rc(s,f,p,v)};if(t){const a=t+tc,s=n;n=i=>i.startsWith(a)?s(i.slice(a.length)):rc(Dg,!1,i,void 0,!0)}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},Pg=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let a=[];for(let s=0;s<r.length;s++){const i=r[s],l=i[0]==="[",c=t.has(i);l||c?(a.length>0&&(a.sort(),n.push(...a),a=[]),n.push(i)):a.push(i)}return a.length>0&&(a.sort(),n.push(...a)),n}},_g=e=>({cache:Ag(e.cacheSize),parseClassName:Rg(e),sortModifiers:Pg(e),...wg(e)}),Ig=/\s+/,Og=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],l=e.trim().split(Ig);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:m,modifiers:p,hasImportantModifier:f,baseClassName:v,maybePostfixModifierPosition:h}=r(u);if(m){c=u+(c.length>0?" "+c:c);continue}let x=!!h,y=n(x?v.substring(0,h):v);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=n(v),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}const b=p.length===0?"":p.length===1?p[0]:s(p).join(":"),k=f?b+Hs:b,w=k+y;if(i.indexOf(w)>-1)continue;i.push(w);const N=a(y,x);for(let S=0;S<N.length;++S){const A=N[S];i.push(k+A)}c=u+(c.length>0?" "+c:c)}return c},Fg=(...e)=>{let t=0,r,n,a="";for(;t<e.length;)(r=e[t++])&&(n=wu(r))&&(a&&(a+=" "),a+=n);return a},wu=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=wu(e[n]))&&(r&&(r+=" "),r+=t);return r},Lg=(e,...t)=>{let r,n,a,s;const i=c=>{const d=t.reduce((u,m)=>m(u),e());return r=_g(d),n=r.cache.get,a=r.cache.set,s=l,l(c)},l=c=>{const d=n(c);if(d)return d;const u=Og(c,r);return a(c,u),u};return s=i,(...c)=>s(Fg(...c))},zg=[],at=e=>{const t=r=>r[e]||zg;return t.isThemeGetter=!0,t},ku=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ju=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Mg=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Vg=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Bg=/\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$/,Ug=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Hg=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Wg=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nr=e=>Mg.test(e),Ce=e=>!!e&&!Number.isNaN(Number(e)),Sr=e=>!!e&&Number.isInteger(Number(e)),ss=e=>e.endsWith("%")&&Ce(e.slice(0,-1)),fr=e=>Vg.test(e),Cu=()=>!0,qg=e=>Bg.test(e)&&!Ug.test(e),Ei=()=>!1,Gg=e=>Hg.test(e),Xg=e=>Wg.test(e),Zg=e=>!me(e)&&!fe(e),Kg=e=>Lr(e,$u,Ei),me=e=>ku.test(e),Wr=e=>Lr(e,Eu,qg),nc=e=>Lr(e,av,Ce),Yg=e=>Lr(e,Au,Cu),Jg=e=>Lr(e,Tu,Ei),ac=e=>Lr(e,Nu,Ei),Qg=e=>Lr(e,Su,Xg),ba=e=>Lr(e,Du,Gg),fe=e=>ju.test(e),Un=e=>nn(e,Eu),ev=e=>nn(e,Tu),oc=e=>nn(e,Nu),tv=e=>nn(e,$u),rv=e=>nn(e,Su),ya=e=>nn(e,Du,!0),nv=e=>nn(e,Au,!0),Lr=(e,t,r)=>{const n=ku.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},nn=(e,t,r=!1)=>{const n=ju.exec(e);return n?n[1]?t(n[1]):r:!1},Nu=e=>e==="position"||e==="percentage",Su=e=>e==="image"||e==="url",$u=e=>e==="length"||e==="size"||e==="bg-size",Eu=e=>e==="length",av=e=>e==="number",Tu=e=>e==="family-name",Au=e=>e==="number"||e==="weight",Du=e=>e==="shadow",ov=()=>{const e=at("color"),t=at("font"),r=at("text"),n=at("font-weight"),a=at("tracking"),s=at("leading"),i=at("breakpoint"),l=at("container"),c=at("spacing"),d=at("radius"),u=at("shadow"),m=at("inset-shadow"),p=at("text-shadow"),f=at("drop-shadow"),v=at("blur"),h=at("perspective"),x=at("aspect"),y=at("ease"),b=at("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...w(),fe,me],S=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],C=()=>[fe,me,c],E=()=>[Nr,"full","auto",...C()],$=()=>[Sr,"none","subgrid",fe,me],I=()=>["auto",{span:["full",Sr,fe,me]},Sr,fe,me],L=()=>[Sr,"auto",fe,me],D=()=>["auto","min","max","fr",fe,me],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...C()],Z=()=>[Nr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],V=()=>[Nr,"screen","full","dvw","lvw","svw","min","max","fit",...C()],M=()=>[Nr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...C()],R=()=>[e,fe,me],oe=()=>[...w(),oc,ac,{position:[fe,me]}],ge=()=>["no-repeat",{repeat:["","x","y","space","round"]}],q=()=>["auto","cover","contain",tv,Kg,{size:[fe,me]}],G=()=>[ss,Un,Wr],ne=()=>["","none","full",d,fe,me],W=()=>["",Ce,Un,Wr],X=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[Ce,ss,oc,ac],J=()=>["","none",v,fe,me],ce=()=>["none",Ce,fe,me],se=()=>["none",Ce,fe,me],ye=()=>[Ce,fe,me],be=()=>[Nr,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fr],breakpoint:[fr],color:[Cu],container:[fr],"drop-shadow":[fr],ease:["in","out","in-out"],font:[Zg],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fr],shadow:[fr],spacing:["px",Ce],text:[fr],"text-shadow":[fr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Nr,me,fe,x]}],container:["container"],columns:[{columns:[Ce,me,fe,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],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:[Sr,"auto",fe,me]}],basis:[{basis:[Nr,"full","auto",l,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ce,Nr,"auto","initial","none",me]}],grow:[{grow:["",Ce,fe,me]}],shrink:[{shrink:["",Ce,fe,me]}],order:[{order:[Sr,"first","last","none",fe,me]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],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:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...M()]}],"min-block-size":[{"min-block":["auto",...M()]}],"max-block-size":[{"max-block":["none",...M()]}],w:[{w:[l,"screen",...Z()]}],"min-w":[{"min-w":[l,"screen","none",...Z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",r,Un,Wr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,nv,Yg]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ss,me]}],"font-family":[{font:[ev,Jg,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:[a,fe,me]}],"line-clamp":[{"line-clamp":[Ce,"none",fe,nc]}],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:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ce,"from-font","auto",fe,Wr]}],"text-decoration-color":[{decoration:R()}],"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:oe()}],"bg-repeat":[{bg:ge()}],"bg-size":[{bg:q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Sr,fe,me],radial:["",fe,me],conic:[Sr,fe,me]},rv,Qg]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-bs":[{"border-bs":W()}],"border-w-be":[{"border-be":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-bs":[{"border-bs":R()}],"border-color-be":[{"border-be":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ce,fe,me]}],"outline-w":[{outline:["",Ce,Un,Wr]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",u,ya,ba]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",m,ya,ba]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[Ce,Wr]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",p,ya,ba]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[Ce,fe,me]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"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":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[fe,me]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"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":w()}],"mask-image-conic-pos":[{"mask-conic":[Ce]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:ge()}],"mask-size":[{mask:q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",fe,me]}],filter:[{filter:["","none",fe,me]}],blur:[{blur:J()}],brightness:[{brightness:[Ce,fe,me]}],contrast:[{contrast:[Ce,fe,me]}],"drop-shadow":[{"drop-shadow":["","none",f,ya,ba]}],"drop-shadow-color":[{"drop-shadow":R()}],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":J()}],"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",y,fe,me]}],delay:[{delay:[Ce,fe,me]}],animate:[{animate:["none",b,fe,me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,fe,me]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:se()}],"scale-x":[{"scale-x":se()}],"scale-y":[{"scale-y":se()}],"scale-z":[{"scale-z":se()}],"scale-3d":["scale-3d"],skew:[{skew:ye()}],"skew-x":[{"skew-x":ye()}],"skew-y":[{"skew-y":ye()}],transform:[{transform:[fe,me,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"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",...R()]}],"stroke-w":[{stroke:[Ce,Un,Wr,nc]}],stroke:[{stroke:["none",...R()]}],"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"]}},sv=Lg(ov);function Y(...e){return sv(gu(e))}function iv(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 sc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ti(...e){return t=>{let r=!1;const n=e.map(a=>{const s=sc(a,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let a=0;a<n.length;a++){const s=n[a];typeof s=="function"?s():sc(e[a],null)}}}}function je(...e){return g.useCallback(Ti(...e),e)}var lv=Symbol.for("react.lazy"),za=g[" use ".trim().toString()];function cv(e){return typeof e=="object"&&e!==null&&"then"in e}function Ru(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===lv&&"_payload"in e&&cv(e._payload)}function Pu(e){const t=uv(e),r=g.forwardRef((n,a)=>{let{children:s,...i}=n;Ru(s)&&typeof za=="function"&&(s=za(s._payload));const l=g.Children.toArray(s),c=l.find(pv);if(c){const d=c.props.children,u=l.map(m=>m===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:m);return o.jsx(t,{...i,ref:a,children:g.isValidElement(d)?g.cloneElement(d,void 0,u):null})}return o.jsx(t,{...i,ref:a,children:s})});return r.displayName=`${e}.Slot`,r}var dv=Pu("Slot");function uv(e){const t=g.forwardRef((r,n)=>{let{children:a,...s}=r;if(Ru(a)&&typeof za=="function"&&(a=za(a._payload)),g.isValidElement(a)){const i=hv(a),l=fv(s,a.props);return a.type!==g.Fragment&&(l.ref=n?Ti(n,i):i),g.cloneElement(a,l)}return g.Children.count(a)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var mv=Symbol("radix.slottable");function pv(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===mv}function fv(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...i)=>{const l=s(...i);return a(...i),l}:a&&(r[n]=a):n==="style"?r[n]={...a,...s}:n==="className"&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}function hv(e){var t,r;let n=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning;return a?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}const ic=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,lc=gu,Ai=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return lc(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:a,defaultVariants:s}=t,i=Object.keys(a).map(d=>{const u=r==null?void 0:r[d],m=s==null?void 0:s[d];if(u===null)return null;const p=ic(u)||ic(m);return a[d][p]}),l=r&&Object.entries(r).reduce((d,u)=>{let[m,p]=u;return p===void 0||(d[m]=p),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,u)=>{let{class:m,className:p,...f}=u;return Object.entries(f).every(v=>{let[h,x]=v;return Array.isArray(x)?x.includes({...s,...l}[h]):{...s,...l}[h]===x})?[...d,m,p]:d},[]);return lc(e,i,c,r==null?void 0:r.class,r==null?void 0:r.className)},xv=Ai("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"}}),Te=g.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...a},s)=>o.jsx(n?dv:"button",{className:Y(xv({variant:t,size:r,className:e})),ref:s,...a}));Te.displayName="Button";const ue=g.forwardRef(({className:e,type:t,...r},n)=>o.jsx("input",{type:t,className:Y("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:n,...r}));ue.displayName="Input";const co=g.forwardRef(({className:e,...t},r)=>o.jsx("textarea",{className:Y("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}));co.displayName="Textarea";var gv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],uo=gv.reduce((e,t)=>{const r=Pu(`Primitive.${t}`),n=g.forwardRef((a,s)=>{const{asChild:i,...l}=a,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),vv="Label",_u=g.forwardRef((e,t)=>o.jsx(uo.label,{...e,ref:t,onMouseDown:r=>{var n;r.target.closest("button, input, select, textarea")||((n=e.onMouseDown)==null||n.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));_u.displayName=vv;var Iu=_u;const bv=Ai("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),le=g.forwardRef(({className:e,...t},r)=>o.jsx(Iu,{ref:r,className:Y(bv(),e),...t}));le.displayName=Iu.displayName;const yv=Ai("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 Di({className:e,variant:t,...r}){return o.jsx("div",{className:Y(yv({variant:t}),e),...r})}var wv="Separator",cc="horizontal",kv=["horizontal","vertical"],Ou=g.forwardRef((e,t)=>{const{decorative:r,orientation:n=cc,...a}=e,s=jv(n)?n:cc,i=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return o.jsx(uo.div,{"data-orientation":s,...i,...a,ref:t})});Ou.displayName=wv;function jv(e){return kv.includes(e)}var Fu=Ou;const it=g.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},a)=>o.jsx(Fu,{ref:a,decorative:r,orientation:t,className:Y("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));it.displayName=Fu.displayName;function Cv(e,t){const r=g.createContext(t),n=s=>{const{children:i,...l}=s,c=g.useMemo(()=>l,Object.values(l));return o.jsx(r.Provider,{value:c,children:i})};n.displayName=e+"Provider";function a(s){const i=g.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[n,a]}function _t(e,t=[]){let r=[];function n(s,i){const l=g.createContext(i),c=r.length;r=[...r,i];const d=m=>{var p;const{scope:f,children:v,...h}=m,x=((p=f==null?void 0:f[e])==null?void 0:p[c])||l,y=g.useMemo(()=>h,Object.values(h));return o.jsx(x.Provider,{value:y,children:v})};d.displayName=s+"Provider";function u(m,p){var f;const v=((f=p==null?void 0:p[e])==null?void 0:f[c])||l,h=g.useContext(v);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[d,u]}const a=()=>{const s=r.map(i=>g.createContext(i));return function(i){const l=(i==null?void 0:i[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return a.scopeName=e,[n,Nv(a,...t)]}function Nv(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(a){const s=n.reduce((i,{useScope:l,scopeName:c})=>{const d=l(a)[`__scope${c}`];return{...i,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}function xe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e==null||e(n),r===!1||!n.defaultPrevented)return t==null?void 0:t(n)}}var lt=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},Sv=g[" useInsertionEffect ".trim().toString()]||lt;function cr({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,s,i]=$v({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:a;{const u=g.useRef(e!==void 0);g.useEffect(()=>{const m=u.current;m!==l&&console.warn(`${n} is changing from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,n])}const d=g.useCallback(u=>{var m;if(l){const p=Ev(u)?u(e):u;p!==e&&((m=i.current)==null||m.call(i,p))}else s(u)},[l,e,s,i]);return[c,d]}function $v({defaultProp:e,onChange:t}){const[r,n]=g.useState(e),a=g.useRef(r),s=g.useRef(t);return Sv(()=>{s.current=t},[t]),g.useEffect(()=>{var i;a.current!==r&&((i=s.current)==null||i.call(s,r),a.current=r)},[r,a]),[r,n,s]}function Ev(e){return typeof e=="function"}function aa(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function oa(e){const[t,r]=g.useState(void 0);return lt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const s=a[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.blockSize}else i=e.offsetWidth,l=e.offsetHeight;r({width:i,height:l})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}function Tv(e,t){return g.useReducer((r,n)=>t[r][n]??r,e)}var It=e=>{const{present:t,children:r}=e,n=Av(t),a=typeof r=="function"?r({present:n.isPresent}):g.Children.only(r),s=je(n.ref,Dv(a));return typeof r=="function"||n.isPresent?g.cloneElement(a,{ref:s}):null};It.displayName="Presence";function Av(e){const[t,r]=g.useState(),n=g.useRef(null),a=g.useRef(e),s=g.useRef("none"),i=e?"mounted":"unmounted",[l,c]=Tv(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const d=wa(n.current);s.current=l==="mounted"?d:"none"},[l]),lt(()=>{const d=n.current,u=a.current;if(u!==e){const m=s.current,p=wa(d);e?c("MOUNT"):p==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&m!==p?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),lt(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,m=f=>{const v=wa(n.current).includes(CSS.escape(f.animationName));if(f.target===t&&v&&(c("ANIMATION_END"),!a.current)){const h=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=h)})}},p=f=>{f.target===t&&(s.current=wa(n.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:g.useCallback(d=>{n.current=d?getComputedStyle(d):null,r(d)},[])}}function wa(e){return(e==null?void 0:e.animationName)||"none"}function Dv(e){var t,r;let n=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning;return a?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}function Cn(e){const t=Rv(e),r=g.forwardRef((n,a)=>{const{children:s,...i}=n,l=g.Children.toArray(s),c=l.find(_v);if(c){const d=c.props.children,u=l.map(m=>m===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:m);return o.jsx(t,{...i,ref:a,children:g.isValidElement(d)?g.cloneElement(d,void 0,u):null})}return o.jsx(t,{...i,ref:a,children:s})});return r.displayName=`${e}.Slot`,r}function Rv(e){const t=g.forwardRef((r,n)=>{const{children:a,...s}=r;if(g.isValidElement(a)){const i=Ov(a),l=Iv(s,a.props);return a.type!==g.Fragment&&(l.ref=n?Ti(n,i):i),g.cloneElement(a,l)}return g.Children.count(a)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Lu=Symbol("radix.slottable");function Pv(e){const t=({children:r})=>o.jsx(o.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Lu,t}function _v(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Lu}function Iv(e,t){const r={...t};for(const n in t){const a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...i)=>{const l=s(...i);return a(...i),l}:a&&(r[n]=a):n==="style"?r[n]={...a,...s}:n==="className"&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}function Ov(e){var t,r;let n=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning;return a?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}var Fv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],we=Fv.reduce((e,t)=>{const r=Cn(`Primitive.${t}`),n=g.forwardRef((a,s)=>{const{asChild:i,...l}=a,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Lv(e,t){e&&so.flushSync(()=>e.dispatchEvent(t))}var mo="Checkbox",[zv]=_t(mo),[Mv,Ri]=zv(mo);function Vv(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:a,disabled:s,form:i,name:l,onCheckedChange:c,required:d,value:u="on",internal_do_not_use_render:m}=e,[p,f]=cr({prop:r,defaultProp:a??!1,onChange:c,caller:mo}),[v,h]=g.useState(null),[x,y]=g.useState(null),b=g.useRef(!1),k=v?!!i||!!v.closest("form"):!0,w={checked:p,disabled:s,setChecked:f,control:v,setControl:h,name:l,form:i,value:u,hasConsumerStoppedPropagationRef:b,required:d,defaultChecked:Pr(a)?!1:a,isFormControl:k,bubbleInput:x,setBubbleInput:y};return o.jsx(Mv,{scope:t,...w,children:Bv(m)?m(w):n})}var zu="CheckboxTrigger",Mu=g.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},a)=>{const{control:s,value:i,disabled:l,checked:c,required:d,setControl:u,setChecked:m,hasConsumerStoppedPropagationRef:p,isFormControl:f,bubbleInput:v}=Ri(zu,e),h=je(a,u),x=g.useRef(c);return g.useEffect(()=>{const y=s==null?void 0:s.form;if(y){const b=()=>m(x.current);return y.addEventListener("reset",b),()=>y.removeEventListener("reset",b)}},[s,m]),o.jsx(we.button,{type:"button",role:"checkbox","aria-checked":Pr(c)?"mixed":c,"aria-required":d,"data-state":Wu(c),"data-disabled":l?"":void 0,disabled:l,value:i,...n,ref:h,onKeyDown:xe(t,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:xe(r,y=>{m(b=>Pr(b)?!0:!b),v&&f&&(p.current=y.isPropagationStopped(),p.current||y.stopPropagation())})})});Mu.displayName=zu;var Pi=g.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:a,defaultChecked:s,required:i,disabled:l,value:c,onCheckedChange:d,form:u,...m}=e;return o.jsx(Vv,{__scopeCheckbox:r,checked:a,defaultChecked:s,disabled:l,required:i,onCheckedChange:d,name:n,form:u,value:c,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(Mu,{...m,ref:t,__scopeCheckbox:r}),p&&o.jsx(Hu,{__scopeCheckbox:r})]})})});Pi.displayName=mo;var Vu="CheckboxIndicator",Bu=g.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...a}=e,s=Ri(Vu,r);return o.jsx(It,{present:n||Pr(s.checked)||s.checked===!0,children:o.jsx(we.span,{"data-state":Wu(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});Bu.displayName=Vu;var Uu="CheckboxBubbleInput",Hu=g.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:a,checked:s,defaultChecked:i,required:l,disabled:c,name:d,value:u,form:m,bubbleInput:p,setBubbleInput:f}=Ri(Uu,e),v=je(r,f),h=aa(s),x=oa(n);g.useEffect(()=>{const b=p;if(!b)return;const k=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(k,"checked").set,N=!a.current;if(h!==s&&w){const S=new Event("click",{bubbles:N});b.indeterminate=Pr(s),w.call(b,Pr(s)?!1:s),b.dispatchEvent(S)}},[p,h,s,a]);const y=g.useRef(Pr(s)?!1:s);return o.jsx(we.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??y.current,required:l,disabled:c,name:d,value:u,form:m,...t,tabIndex:-1,ref:v,style:{...t.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Hu.displayName=Uu;function Bv(e){return typeof e=="function"}function Pr(e){return e==="indeterminate"}function Wu(e){return Pr(e)?"indeterminate":e?"checked":"unchecked"}const rt=g.forwardRef(({className:e,...t},r)=>o.jsx(Pi,{ref:r,className:Y("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:o.jsx(Bu,{className:Y("flex items-center justify-center text-current"),children:o.jsx(O.Check,{className:"h-4 w-4"})})}));rt.displayName=Pi.displayName;function _i(e){const t=e+"CollectionProvider",[r,n]=_t(t),[a,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:x,children:y}=h,b=j.useRef(null),k=j.useRef(new Map).current;return o.jsx(a,{scope:x,itemMap:k,collectionRef:b,children:y})};i.displayName=t;const l=e+"CollectionSlot",c=Cn(l),d=j.forwardRef((h,x)=>{const{scope:y,children:b}=h,k=s(l,y),w=je(x,k.collectionRef);return o.jsx(c,{ref:w,children:b})});d.displayName=l;const u=e+"CollectionItemSlot",m="data-radix-collection-item",p=Cn(u),f=j.forwardRef((h,x)=>{const{scope:y,children:b,...k}=h,w=j.useRef(null),N=je(x,w),S=s(u,y);return j.useEffect(()=>(S.itemMap.set(w,{ref:w,...k}),()=>void S.itemMap.delete(w))),o.jsx(p,{[m]:"",ref:N,children:b})});f.displayName=u;function v(h){const x=s(e+"CollectionConsumer",h);return j.useCallback(()=>{const y=x.collectionRef.current;if(!y)return[];const b=Array.from(y.querySelectorAll(`[${m}]`));return Array.from(x.itemMap.values()).sort((k,w)=>b.indexOf(k.ref.current)-b.indexOf(w.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:d,ItemSlot:f},v,n]}var Uv=g[" useId ".trim().toString()]||(()=>{}),Hv=0;function yr(e){const[t,r]=g.useState(Uv());return lt(()=>{r(n=>n??String(Hv++))},[e]),t?`radix-${t}`:""}function pt(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}var Wv=g.createContext(void 0);function sa(e){const t=g.useContext(Wv);return e||t||"ltr"}var is="rovingFocusGroup.onEntryFocus",qv={bubbles:!1,cancelable:!0},ia="RovingFocusGroup",[Ws,qu,Gv]=_i(ia),[Xv,Gu]=_t(ia,[Gv]),[Zv,Kv]=Xv(ia),Xu=g.forwardRef((e,t)=>o.jsx(Ws.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Ws.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(Yv,{...e,ref:t})})}));Xu.displayName=ia;var Yv=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:a=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:u=!1,...m}=e,p=g.useRef(null),f=je(t,p),v=sa(s),[h,x]=cr({prop:i,defaultProp:l??null,onChange:c,caller:ia}),[y,b]=g.useState(!1),k=pt(d),w=qu(r),N=g.useRef(!1),[S,A]=g.useState(0);return g.useEffect(()=>{const C=p.current;if(C)return C.addEventListener(is,k),()=>C.removeEventListener(is,k)},[k]),o.jsx(Zv,{scope:r,orientation:n,dir:v,loop:a,currentTabStopId:h,onItemFocus:g.useCallback(C=>x(C),[x]),onItemShiftTab:g.useCallback(()=>b(!0),[]),onFocusableItemAdd:g.useCallback(()=>A(C=>C+1),[]),onFocusableItemRemove:g.useCallback(()=>A(C=>C-1),[]),children:o.jsx(we.div,{tabIndex:y||S===0?-1:0,"data-orientation":n,...m,ref:f,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&&!y){const $=new CustomEvent(is,qv);if(C.currentTarget.dispatchEvent($),!$.defaultPrevented){const I=w().filter(H=>H.focusable),L=I.find(H=>H.active),D=I.find(H=>H.id===h),z=[L,D,...I].filter(Boolean).map(H=>H.ref.current);Yu(z,u)}}N.current=!1}),onBlur:xe(e.onBlur,()=>b(!1))})})}),Zu="RovingFocusGroupItem",Ku=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:a=!1,tabStopId:s,children:i,...l}=e,c=yr(),d=s||c,u=Kv(Zu,r),m=u.currentTabStopId===d,p=qu(r),{onFocusableItemAdd:f,onFocusableItemRemove:v,currentTabStopId:h}=u;return g.useEffect(()=>{if(n)return f(),()=>v()},[n,f,v]),o.jsx(Ws.ItemSlot,{scope:r,id:d,focusable:n,active:a,children:o.jsx(we.span,{tabIndex:m?0:-1,"data-orientation":u.orientation,...l,ref:t,onMouseDown:xe(e.onMouseDown,x=>{n?u.onItemFocus(d):x.preventDefault()}),onFocus:xe(e.onFocus,()=>u.onItemFocus(d)),onKeyDown:xe(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){u.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const y=eb(x,u.orientation,u.dir);if(y!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let b=p().filter(k=>k.focusable).map(k=>k.ref.current);if(y==="last")b.reverse();else if(y==="prev"||y==="next"){y==="prev"&&b.reverse();const k=b.indexOf(x.currentTarget);b=u.loop?tb(b,k+1):b.slice(k+1)}setTimeout(()=>Yu(b))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:h!=null}):i})})});Ku.displayName=Zu;var Jv={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Qv(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function eb(e,t,r){const n=Qv(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Jv[n]}function Yu(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function tb(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var rb=Xu,nb=Ku,Ii="Radio",[ab,Ju]=_t(Ii),[ob,sb]=ab(Ii),Qu=g.forwardRef((e,t)=>{const{__scopeRadio:r,name:n,checked:a=!1,required:s,disabled:i,value:l="on",onCheck:c,form:d,...u}=e,[m,p]=g.useState(null),f=je(t,x=>p(x)),v=g.useRef(!1),h=m?d||!!m.closest("form"):!0;return o.jsxs(ob,{scope:r,checked:a,disabled:i,children:[o.jsx(we.button,{type:"button",role:"radio","aria-checked":a,"data-state":nm(a),"data-disabled":i?"":void 0,disabled:i,value:l,...u,ref:f,onClick:xe(e.onClick,x=>{a||c==null||c(),h&&(v.current=x.isPropagationStopped(),v.current||x.stopPropagation())})}),h&&o.jsx(rm,{control:m,bubbles:!v.current,name:n,value:l,checked:a,required:s,disabled:i,form:d,style:{transform:"translateX(-100%)"}})]})});Qu.displayName=Ii;var em="RadioIndicator",tm=g.forwardRef((e,t)=>{const{__scopeRadio:r,forceMount:n,...a}=e,s=sb(em,r);return o.jsx(It,{present:n||s.checked,children:o.jsx(we.span,{"data-state":nm(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:t})})});tm.displayName=em;var ib="RadioBubbleInput",rm=g.forwardRef(({__scopeRadio:e,control:t,checked:r,bubbles:n=!0,...a},s)=>{const i=g.useRef(null),l=je(i,s),c=aa(r),d=oa(t);return g.useEffect(()=>{const u=i.current;if(!u)return;const m=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==r&&p){const f=new Event("click",{bubbles:n});p.call(u,r),u.dispatchEvent(f)}},[c,r,n]),o.jsx(we.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});rm.displayName=ib;function nm(e){return e?"checked":"unchecked"}var lb=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],po="RadioGroup",[cb]=_t(po,[Gu,Ju]),am=Gu(),om=Ju(),[db,ub]=cb(po),sm=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,name:n,defaultValue:a,value:s,required:i=!1,disabled:l=!1,orientation:c,dir:d,loop:u=!0,onValueChange:m,...p}=e,f=am(r),v=sa(d),[h,x]=cr({prop:s,defaultProp:a??null,onChange:m,caller:po});return o.jsx(db,{scope:r,name:n,required:i,disabled:l,value:h,onValueChange:x,children:o.jsx(rb,{asChild:!0,...f,orientation:c,dir:v,loop:u,children:o.jsx(we.div,{role:"radiogroup","aria-required":i,"aria-orientation":c,"data-disabled":l?"":void 0,dir:v,...p,ref:t})})})});sm.displayName=po;var im="RadioGroupItem",lm=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:n,...a}=e,s=ub(im,r),i=s.disabled||n,l=am(r),c=om(r),d=g.useRef(null),u=je(t,d),m=s.value===a.value,p=g.useRef(!1);return g.useEffect(()=>{const f=h=>{lb.includes(h.key)&&(p.current=!0)},v=()=>p.current=!1;return document.addEventListener("keydown",f),document.addEventListener("keyup",v),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",v)}},[]),o.jsx(nb,{asChild:!0,...l,focusable:!i,active:m,children:o.jsx(Qu,{disabled:i,required:s.required,checked:m,...c,...a,name:s.name,ref:u,onCheck:()=>s.onValueChange(a.value),onKeyDown:xe(f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:xe(a.onFocus,()=>{var f;p.current&&((f=d.current)==null||f.click())})})})});lm.displayName=im;var mb="RadioGroupIndicator",cm=g.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...n}=e,a=om(r);return o.jsx(tm,{...a,...n,ref:t})});cm.displayName=mb;var dm=sm,um=lm,pb=cm;const Oi=g.forwardRef(({className:e,...t},r)=>o.jsx(dm,{className:Y("grid gap-2",e),...t,ref:r}));Oi.displayName=dm.displayName;const Fi=g.forwardRef(({className:e,...t},r)=>o.jsx(um,{ref:r,className:Y("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:o.jsx(pb,{className:"flex items-center justify-center",children:o.jsx(O.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Fi.displayName=um.displayName;var fo="Switch",[fb]=_t(fo),[hb,xb]=fb(fo),mm=g.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:a,defaultChecked:s,required:i,disabled:l,value:c="on",onCheckedChange:d,form:u,...m}=e,[p,f]=g.useState(null),v=je(t,k=>f(k)),h=g.useRef(!1),x=p?u||!!p.closest("form"):!0,[y,b]=cr({prop:a,defaultProp:s??!1,onChange:d,caller:fo});return o.jsxs(hb,{scope:r,checked:y,disabled:l,children:[o.jsx(we.button,{type:"button",role:"switch","aria-checked":y,"aria-required":i,"data-state":xm(y),"data-disabled":l?"":void 0,disabled:l,value:c,...m,ref:v,onClick:xe(e.onClick,k=>{b(w=>!w),x&&(h.current=k.isPropagationStopped(),h.current||k.stopPropagation())})}),x&&o.jsx(hm,{control:p,bubbles:!h.current,name:n,value:c,checked:y,required:i,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});mm.displayName=fo;var pm="SwitchThumb",fm=g.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,a=xb(pm,r);return o.jsx(we.span,{"data-state":xm(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});fm.displayName=pm;var gb="SwitchBubbleInput",hm=g.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...a},s)=>{const i=g.useRef(null),l=je(i,s),c=aa(r),d=oa(t);return g.useEffect(()=>{const u=i.current;if(!u)return;const m=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==r&&p){const f=new Event("click",{bubbles:n});p.call(u,r),u.dispatchEvent(f)}},[c,r,n]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});hm.displayName=gb;function xm(e){return e?"checked":"unchecked"}var gm=mm,vb=fm;const Li=g.forwardRef(({className:e,...t},r)=>o.jsx(gm,{ref:r,className:Y("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:o.jsx(vb,{className:Y("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")})}));Li.displayName=gm.displayName;function Jn(e,[t,r]){return Math.min(r,Math.max(t,e))}function bb(e,t=globalThis==null?void 0:globalThis.document){const r=pt(e);g.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var yb="DismissableLayer",qs="dismissableLayer.update",wb="dismissableLayer.pointerDownOutside",kb="dismissableLayer.focusOutside",dc,vm=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),la=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,d=g.useContext(vm),[u,m]=g.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=g.useState({}),v=je(t,A=>m(A)),h=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=h.indexOf(x),b=u?h.indexOf(u):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,w=b>=y,N=Nb(A=>{const C=A.target,E=[...d.branches].some($=>$.contains(C));!w||E||(a==null||a(A),i==null||i(A),A.defaultPrevented||l==null||l())},p),S=Sb(A=>{const C=A.target;[...d.branches].some(E=>E.contains(C))||(s==null||s(A),i==null||i(A),A.defaultPrevented||l==null||l())},p);return bb(A=>{b===d.layers.size-1&&(n==null||n(A),!A.defaultPrevented&&l&&(A.preventDefault(),l()))},p),g.useEffect(()=>{if(u)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(dc=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),uc(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=dc)}},[u,p,r,d]),g.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),uc())},[u,d]),g.useEffect(()=>{const A=()=>f({});return document.addEventListener(qs,A),()=>document.removeEventListener(qs,A)},[]),o.jsx(we.div,{...c,ref:v,style:{pointerEvents:k?w?"auto":"none":void 0,...e.style},onFocusCapture:xe(e.onFocusCapture,S.onFocusCapture),onBlurCapture:xe(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:xe(e.onPointerDownCapture,N.onPointerDownCapture)})});la.displayName=yb;var jb="DismissableLayerBranch",Cb=g.forwardRef((e,t)=>{const r=g.useContext(vm),n=g.useRef(null),a=je(t,n);return g.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),o.jsx(we.div,{...e,ref:a})});Cb.displayName=jb;function Nb(e,t=globalThis==null?void 0:globalThis.document){const r=pt(e),n=g.useRef(!1),a=g.useRef(()=>{});return g.useEffect(()=>{const s=l=>{if(l.target&&!n.current){let c=function(){bm(wb,r,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Sb(e,t=globalThis==null?void 0:globalThis.document){const r=pt(e),n=g.useRef(!1);return g.useEffect(()=>{const a=s=>{s.target&&!n.current&&bm(kb,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function uc(){const e=new CustomEvent(qs);document.dispatchEvent(e)}function bm(e,t,r,{discrete:n}){const a=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?Lv(a,s):a.dispatchEvent(s)}var ls=0;function zi(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??mc()),document.body.insertAdjacentElement("beforeend",e[1]??mc()),ls++,()=>{ls===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ls--}},[])}function mc(){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 cs="focusScope.autoFocusOnMount",ds="focusScope.autoFocusOnUnmount",pc={bubbles:!1,cancelable:!0},$b="FocusScope",ho=g.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...i}=e,[l,c]=g.useState(null),d=pt(a),u=pt(s),m=g.useRef(null),p=je(t,h=>c(h)),f=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(n){let h=function(k){if(f.paused||!l)return;const w=k.target;l.contains(w)?m.current=w:Ar(m.current,{select:!0})},x=function(k){if(f.paused||!l)return;const w=k.relatedTarget;w!==null&&(l.contains(w)||Ar(m.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const w of k)w.removedNodes.length>0&&Ar(l)};document.addEventListener("focusin",h),document.addEventListener("focusout",x);const b=new MutationObserver(y);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",x),b.disconnect()}}},[n,l,f.paused]),g.useEffect(()=>{if(l){hc.add(f);const h=document.activeElement;if(!l.contains(h)){const x=new CustomEvent(cs,pc);l.addEventListener(cs,d),l.dispatchEvent(x),x.defaultPrevented||(Eb(Pb(ym(l)),{select:!0}),document.activeElement===h&&Ar(l))}return()=>{l.removeEventListener(cs,d),setTimeout(()=>{const x=new CustomEvent(ds,pc);l.addEventListener(ds,u),l.dispatchEvent(x),x.defaultPrevented||Ar(h??document.body,{select:!0}),l.removeEventListener(ds,u),hc.remove(f)},0)}}},[l,d,u,f]);const v=g.useCallback(h=>{if(!r&&!n||f.paused)return;const x=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,y=document.activeElement;if(x&&y){const b=h.currentTarget,[k,w]=Tb(b);k&&w?!h.shiftKey&&y===w?(h.preventDefault(),r&&Ar(k,{select:!0})):h.shiftKey&&y===k&&(h.preventDefault(),r&&Ar(w,{select:!0})):y===b&&h.preventDefault()}},[r,n,f.paused]);return o.jsx(we.div,{tabIndex:-1,...i,ref:p,onKeyDown:v})});ho.displayName=$b;function Eb(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Ar(n,{select:t}),document.activeElement!==r)return}function Tb(e){const t=ym(e),r=fc(t,e),n=fc(t.reverse(),e);return[r,n]}function ym(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function fc(e,t){for(const r of e)if(!Ab(r,{upTo:t}))return r}function Ab(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 Db(e){return e instanceof HTMLInputElement&&"select"in e}function Ar(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Db(e)&&t&&e.select()}}var hc=Rb();function Rb(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=xc(e,t),e.unshift(t)},remove(t){var r;e=xc(e,t),(r=e[0])==null||r.resume()}}}function xc(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Pb(e){return e.filter(t=>t.tagName!=="A")}const _b=["top","right","bottom","left"],Or=Math.min,$t=Math.max,Ma=Math.round,ka=Math.floor,lr=e=>({x:e,y:e}),Ib={left:"right",right:"left",bottom:"top",top:"bottom"};function Gs(e,t,r){return $t(e,Or(t,r))}function wr(e,t){return typeof e=="function"?e(t):e}function kr(e){return e.split("-")[0]}function Rn(e){return e.split("-")[1]}function Mi(e){return e==="x"?"y":"x"}function Vi(e){return e==="y"?"height":"width"}function ir(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Bi(e){return Mi(ir(e))}function Ob(e,t,r){r===void 0&&(r=!1);const n=Rn(e),a=Bi(e),s=Vi(a);let i=a==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Va(i)),[i,Va(i)]}function Fb(e){const t=Va(e);return[Xs(e),t,Xs(t)]}function Xs(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const gc=["left","right"],vc=["right","left"],Lb=["top","bottom"],zb=["bottom","top"];function Mb(e,t,r){switch(e){case"top":case"bottom":return r?t?vc:gc:t?gc:vc;case"left":case"right":return t?Lb:zb;default:return[]}}function Vb(e,t,r,n){const a=Rn(e);let s=Mb(kr(e),r==="start",n);return a&&(s=s.map(i=>i+"-"+a),t&&(s=s.concat(s.map(Xs)))),s}function Va(e){const t=kr(e);return Ib[t]+e.slice(t.length)}function Bb(e){return{top:0,right:0,bottom:0,left:0,...e}}function wm(e){return typeof e!="number"?Bb(e):{top:e,right:e,bottom:e,left:e}}function Ba(e){const{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function bc(e,t,r){let{reference:n,floating:a}=e;const s=ir(t),i=Bi(t),l=Vi(i),c=kr(t),d=s==="y",u=n.x+n.width/2-a.width/2,m=n.y+n.height/2-a.height/2,p=n[l]/2-a[l]/2;let f;switch(c){case"top":f={x:u,y:n.y-a.height};break;case"bottom":f={x:u,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:m};break;case"left":f={x:n.x-a.width,y:m};break;default:f={x:n.x,y:n.y}}switch(Rn(t)){case"start":f[i]-=p*(r&&d?-1:1);break;case"end":f[i]+=p*(r&&d?-1:1);break}return f}async function Ub(e,t){var r;t===void 0&&(t={});const{x:n,y:a,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:m="floating",altBoundary:p=!1,padding:f=0}=wr(t,e),v=wm(f),h=l[p?m==="floating"?"reference":"floating":m],x=Ba(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(h)))==null||r?h:h.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),y=m==="floating"?{x:n,y:a,width:i.floating.width,height:i.floating.height}:i.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),k=await(s.isElement==null?void 0:s.isElement(b))?await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},w=Ba(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:b,strategy:c}):y);return{top:(x.top-w.top+v.top)/k.y,bottom:(w.bottom-x.bottom+v.bottom)/k.y,left:(x.left-w.left+v.left)/k.x,right:(w.right-x.right+v.right)/k.x}}const Hb=50,Wb=async(e,t,r)=>{const{placement:n="bottom",strategy:a="absolute",middleware:s=[],platform:i}=r,l=i.detectOverflow?i:{...i,detectOverflow:Ub},c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:u,y:m}=bc(d,n,c),p=n,f=0;const v={};for(let h=0;h<s.length;h++){const x=s[h];if(!x)continue;const{name:y,fn:b}=x,{x:k,y:w,data:N,reset:S}=await b({x:u,y:m,initialPlacement:n,placement:p,strategy:a,middlewareData:v,rects:d,platform:l,elements:{reference:e,floating:t}});u=k??u,m=w??m,v[y]={...v[y],...N},S&&f<Hb&&(f++,typeof S=="object"&&(S.placement&&(p=S.placement),S.rects&&(d=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:a}):S.rects),{x:u,y:m}=bc(d,p,c)),h=-1)}return{x:u,y:m,placement:p,strategy:a,middlewareData:v}},qb=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:a,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=wr(e,t)||{};if(d==null)return{};const m=wm(u),p={x:r,y:n},f=Bi(a),v=Vi(f),h=await i.getDimensions(d),x=f==="y",y=x?"top":"left",b=x?"bottom":"right",k=x?"clientHeight":"clientWidth",w=s.reference[v]+s.reference[f]-p[f]-s.floating[v],N=p[f]-s.reference[f],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let A=S?S[k]:0;(!A||!await(i.isElement==null?void 0:i.isElement(S)))&&(A=l.floating[k]||s.floating[v]);const C=w/2-N/2,E=A/2-h[v]/2-1,$=Or(m[y],E),I=Or(m[b],E),L=$,D=A-h[v]-I,z=A/2-h[v]/2+C,H=Gs(L,z,D),U=!c.arrow&&Rn(a)!=null&&z!==H&&s.reference[v]/2-(z<L?$:I)-h[v]/2<0,Z=U?z<L?z-L:z-D:0;return{[f]:p[f]+Z,data:{[f]:H,centerOffset:z-H-Z,...U&&{alignmentOffset:Z}},reset:U}}}),Gb=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:a,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:m=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:h=!0,...x}=wr(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const y=kr(a),b=ir(l),k=kr(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(d.floating)),N=p||(k||!h?[Va(l)]:Fb(l)),S=v!=="none";!p&&S&&N.push(...Vb(l,h,v,w));const A=[l,...N],C=await c.detectOverflow(t,x),E=[];let $=((n=s.flip)==null?void 0:n.overflows)||[];if(u&&E.push(C[y]),m){const z=Ob(a,i,w);E.push(C[z[0]],C[z[1]])}if($=[...$,{placement:a,overflows:E}],!E.every(z=>z<=0)){var I,L;const z=(((I=s.flip)==null?void 0:I.index)||0)+1,H=A[z];if(H&&(!(m==="alignment"&&b!==ir(H))||$.every(Z=>ir(Z.placement)===b?Z.overflows[0]>0:!0)))return{data:{index:z,overflows:$},reset:{placement:H}};let U=(L=$.filter(Z=>Z.overflows[0]<=0).sort((Z,V)=>Z.overflows[1]-V.overflows[1])[0])==null?void 0:L.placement;if(!U)switch(f){case"bestFit":{var D;const Z=(D=$.filter(V=>{if(S){const M=ir(V.placement);return M===b||M==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(M=>M>0).reduce((M,R)=>M+R,0)]).sort((V,M)=>V[1]-M[1])[0])==null?void 0:D[0];Z&&(U=Z);break}case"initialPlacement":U=l;break}if(a!==U)return{reset:{placement:U}}}return{}}}};function yc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function wc(e){return _b.some(t=>e[t]>=0)}const Xb=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:a="referenceHidden",...s}=wr(e,t);switch(a){case"referenceHidden":{const i=await n.detectOverflow(t,{...s,elementContext:"reference"}),l=yc(i,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:wc(l)}}}case"escaped":{const i=await n.detectOverflow(t,{...s,altBoundary:!0}),l=yc(i,r.floating);return{data:{escapedOffsets:l,escaped:wc(l)}}}default:return{}}}}},km=new Set(["left","top"]);async function Zb(e,t){const{placement:r,platform:n,elements:a}=e,s=await(n.isRTL==null?void 0:n.isRTL(a.floating)),i=kr(r),l=Rn(r),c=ir(r)==="y",d=km.has(i)?-1:1,u=s&&c?-1:1,m=wr(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&typeof v=="number"&&(f=l==="end"?v*-1:v),c?{x:f*u,y:p*d}:{x:p*d,y:f*u}}const Kb=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:a,y:s,placement:i,middlewareData:l}=t,c=await Zb(t,e);return i===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:a+c.x,y:s+c.y,data:{...c,placement:i}}}}},Yb=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:a,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:b,y:k}=y;return{x:b,y:k}}},...d}=wr(e,t),u={x:r,y:n},m=await s.detectOverflow(t,d),p=ir(kr(a)),f=Mi(p);let v=u[f],h=u[p];if(i){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",k=v+m[y],w=v-m[b];v=Gs(k,v,w)}if(l){const y=p==="y"?"top":"left",b=p==="y"?"bottom":"right",k=h+m[y],w=h-m[b];h=Gs(k,h,w)}const x=c.fn({...t,[f]:v,[p]:h});return{...x,data:{x:x.x-r,y:x.y-n,enabled:{[f]:i,[p]:l}}}}}},Jb=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:a,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=wr(e,t),u={x:r,y:n},m=ir(a),p=Mi(m);let f=u[p],v=u[m];const h=wr(l,t),x=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const k=p==="y"?"height":"width",w=s.reference[p]-s.floating[k]+x.mainAxis,N=s.reference[p]+s.reference[k]-x.mainAxis;f<w?f=w:f>N&&(f=N)}if(d){var y,b;const k=p==="y"?"width":"height",w=km.has(kr(a)),N=s.reference[m]-s.floating[k]+(w&&((y=i.offset)==null?void 0:y[m])||0)+(w?0:x.crossAxis),S=s.reference[m]+s.reference[k]+(w?0:((b=i.offset)==null?void 0:b[m])||0)-(w?x.crossAxis:0);v<N?v=N:v>S&&(v=S)}return{[p]:f,[m]:v}}}},Qb=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:a,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...d}=wr(e,t),u=await i.detectOverflow(t,d),m=kr(a),p=Rn(a),f=ir(a)==="y",{width:v,height:h}=s.floating;let x,y;m==="top"||m==="bottom"?(x=m,y=p===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(y=m,x=p==="end"?"top":"bottom");const b=h-u.top-u.bottom,k=v-u.left-u.right,w=Or(h-u[x],b),N=Or(v-u[y],k),S=!t.middlewareData.shift;let A=w,C=N;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(C=k),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(A=b),S&&!p){const $=$t(u.left,0),I=$t(u.right,0),L=$t(u.top,0),D=$t(u.bottom,0);f?C=v-2*($!==0||I!==0?$+I:$t(u.left,u.right)):A=h-2*(L!==0||D!==0?L+D:$t(u.top,u.bottom))}await c({...t,availableWidth:C,availableHeight:A});const E=await i.getDimensions(l.floating);return v!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}};function xo(){return typeof window<"u"}function Pn(e){return jm(e)?(e.nodeName||"").toLowerCase():"#document"}function At(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mr(e){var t;return(t=(jm(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function jm(e){return xo()?e instanceof Node||e instanceof At(e).Node:!1}function Yt(e){return xo()?e instanceof Element||e instanceof At(e).Element:!1}function jr(e){return xo()?e instanceof HTMLElement||e instanceof At(e).HTMLElement:!1}function kc(e){return!xo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof At(e).ShadowRoot}function ca(e){const{overflow:t,overflowX:r,overflowY:n,display:a}=Jt(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&a!=="inline"&&a!=="contents"}function ey(e){return/^(table|td|th)$/.test(Pn(e))}function go(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const ty=/transform|translate|scale|rotate|perspective|filter/,ry=/paint|layout|strict|content/,qr=e=>!!e&&e!=="none";let us;function Ui(e){const t=Yt(e)?Jt(e):e;return qr(t.transform)||qr(t.translate)||qr(t.scale)||qr(t.rotate)||qr(t.perspective)||!Hi()&&(qr(t.backdropFilter)||qr(t.filter))||ty.test(t.willChange||"")||ry.test(t.contain||"")}function ny(e){let t=Fr(e);for(;jr(t)&&!Nn(t);){if(Ui(t))return t;if(go(t))return null;t=Fr(t)}return null}function Hi(){return us==null&&(us=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),us}function Nn(e){return/^(html|body|#document)$/.test(Pn(e))}function Jt(e){return At(e).getComputedStyle(e)}function vo(e){return Yt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Fr(e){if(Pn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||kc(e)&&e.host||mr(e);return kc(t)?t.host:t}function Cm(e){const t=Fr(e);return Nn(t)?e.ownerDocument?e.ownerDocument.body:e.body:jr(t)&&ca(t)?t:Cm(t)}function Qn(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const a=Cm(e),s=a===((n=e.ownerDocument)==null?void 0:n.body),i=At(a);if(s){const l=Zs(i);return t.concat(i,i.visualViewport||[],ca(a)?a:[],l&&r?Qn(l):[])}else return t.concat(a,Qn(a,[],r))}function Zs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Nm(e){const t=Jt(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const a=jr(e),s=a?e.offsetWidth:r,i=a?e.offsetHeight:n,l=Ma(r)!==s||Ma(n)!==i;return l&&(r=s,n=i),{width:r,height:n,$:l}}function Wi(e){return Yt(e)?e:e.contextElement}function wn(e){const t=Wi(e);if(!jr(t))return lr(1);const r=t.getBoundingClientRect(),{width:n,height:a,$:s}=Nm(t);let i=(s?Ma(r.width):r.width)/n,l=(s?Ma(r.height):r.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const ay=lr(0);function Sm(e){const t=At(e);return!Hi()||!t.visualViewport?ay:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function oy(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==At(e)?!1:t}function Qr(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const a=e.getBoundingClientRect(),s=Wi(e);let i=lr(1);t&&(n?Yt(n)&&(i=wn(n)):i=wn(e));const l=oy(s,r,n)?Sm(s):lr(0);let c=(a.left+l.x)/i.x,d=(a.top+l.y)/i.y,u=a.width/i.x,m=a.height/i.y;if(s){const p=At(s),f=n&&Yt(n)?At(n):n;let v=p,h=Zs(v);for(;h&&n&&f!==v;){const x=wn(h),y=h.getBoundingClientRect(),b=Jt(h),k=y.left+(h.clientLeft+parseFloat(b.paddingLeft))*x.x,w=y.top+(h.clientTop+parseFloat(b.paddingTop))*x.y;c*=x.x,d*=x.y,u*=x.x,m*=x.y,c+=k,d+=w,v=At(h),h=Zs(v)}}return Ba({width:u,height:m,x:c,y:d})}function bo(e,t){const r=vo(e).scrollLeft;return t?t.left+r:Qr(mr(e)).left+r}function $m(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-bo(e,r),a=r.top+t.scrollTop;return{x:n,y:a}}function sy(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e;const s=a==="fixed",i=mr(n),l=t?go(t.floating):!1;if(n===i||l&&s)return r;let c={scrollLeft:0,scrollTop:0},d=lr(1);const u=lr(0),m=jr(n);if((m||!m&&!s)&&((Pn(n)!=="body"||ca(i))&&(c=vo(n)),m)){const f=Qr(n);d=wn(n),u.x=f.x+n.clientLeft,u.y=f.y+n.clientTop}const p=i&&!m&&!s?$m(i,c):lr(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-c.scrollLeft*d.x+u.x+p.x,y:r.y*d.y-c.scrollTop*d.y+u.y+p.y}}function iy(e){return Array.from(e.getClientRects())}function ly(e){const t=mr(e),r=vo(e),n=e.ownerDocument.body,a=$t(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=$t(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+bo(e);const l=-r.scrollTop;return Jt(n).direction==="rtl"&&(i+=$t(t.clientWidth,n.clientWidth)-a),{width:a,height:s,x:i,y:l}}const jc=25;function cy(e,t){const r=At(e),n=mr(e),a=r.visualViewport;let s=n.clientWidth,i=n.clientHeight,l=0,c=0;if(a){s=a.width,i=a.height;const u=Hi();(!u||u&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}const d=bo(n);if(d<=0){const u=n.ownerDocument,m=u.body,p=getComputedStyle(m),f=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,v=Math.abs(n.clientWidth-m.clientWidth-f);v<=jc&&(s-=v)}else d<=jc&&(s+=d);return{width:s,height:i,x:l,y:c}}function dy(e,t){const r=Qr(e,!0,t==="fixed"),n=r.top+e.clientTop,a=r.left+e.clientLeft,s=jr(e)?wn(e):lr(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=a*s.x,d=n*s.y;return{width:i,height:l,x:c,y:d}}function Cc(e,t,r){let n;if(t==="viewport")n=cy(e,r);else if(t==="document")n=ly(mr(e));else if(Yt(t))n=dy(t,r);else{const a=Sm(e);n={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Ba(n)}function Em(e,t){const r=Fr(e);return r===t||!Yt(r)||Nn(r)?!1:Jt(r).position==="fixed"||Em(r,t)}function uy(e,t){const r=t.get(e);if(r)return r;let n=Qn(e,[],!1).filter(l=>Yt(l)&&Pn(l)!=="body"),a=null;const s=Jt(e).position==="fixed";let i=s?Fr(e):e;for(;Yt(i)&&!Nn(i);){const l=Jt(i),c=Ui(i);!c&&l.position==="fixed"&&(a=null),(s?!c&&!a:!c&&l.position==="static"&&a&&(a.position==="absolute"||a.position==="fixed")||ca(i)&&!c&&Em(e,i))?n=n.filter(d=>d!==i):a=l,i=Fr(i)}return t.set(e,n),n}function my(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e;const s=[...r==="clippingAncestors"?go(t)?[]:uy(t,this._c):[].concat(r),n],i=Cc(t,s[0],a);let l=i.top,c=i.right,d=i.bottom,u=i.left;for(let m=1;m<s.length;m++){const p=Cc(t,s[m],a);l=$t(p.top,l),c=Or(p.right,c),d=Or(p.bottom,d),u=$t(p.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function py(e){const{width:t,height:r}=Nm(e);return{width:t,height:r}}function fy(e,t,r){const n=jr(t),a=mr(t),s=r==="fixed",i=Qr(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=lr(0);function d(){c.x=bo(a)}if(n||!n&&!s)if((Pn(t)!=="body"||ca(a))&&(l=vo(t)),n){const f=Qr(t,!0,s,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else a&&d();s&&!n&&a&&d();const u=a&&!n&&!s?$m(a,l):lr(0),m=i.left+l.scrollLeft-c.x-u.x,p=i.top+l.scrollTop-c.y-u.y;return{x:m,y:p,width:i.width,height:i.height}}function ms(e){return Jt(e).position==="static"}function Nc(e,t){if(!jr(e)||Jt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return mr(e)===r&&(r=r.ownerDocument.body),r}function Tm(e,t){const r=At(e);if(go(e))return r;if(!jr(e)){let a=Fr(e);for(;a&&!Nn(a);){if(Yt(a)&&!ms(a))return a;a=Fr(a)}return r}let n=Nc(e,t);for(;n&&ey(n)&&ms(n);)n=Nc(n,t);return n&&Nn(n)&&ms(n)&&!Ui(n)?r:n||ny(e)||r}const hy=async function(e){const t=this.getOffsetParent||Tm,r=this.getDimensions,n=await r(e.floating);return{reference:fy(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function xy(e){return Jt(e).direction==="rtl"}const gy={convertOffsetParentRelativeRectToViewportRelativeRect:sy,getDocumentElement:mr,getClippingRect:my,getOffsetParent:Tm,getElementRects:hy,getClientRects:iy,getDimensions:py,getScale:wn,isElement:Yt,isRTL:xy};function Am(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function vy(e,t){let r=null,n;const a=mr(e);function s(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:u,top:m,width:p,height:f}=d;if(l||t(),!p||!f)return;const v=ka(m),h=ka(a.clientWidth-(u+p)),x=ka(a.clientHeight-(m+f)),y=ka(u),b={rootMargin:-v+"px "+-h+"px "+-x+"px "+-y+"px",threshold:$t(0,Or(1,c))||1};let k=!0;function w(N){const S=N[0].intersectionRatio;if(S!==c){if(!k)return i();S?i(!1,S):n=setTimeout(()=>{i(!1,1e-7)},1e3)}S===1&&!Am(d,e.getBoundingClientRect())&&i(),k=!1}try{r=new IntersectionObserver(w,{...b,root:a.ownerDocument})}catch{r=new IntersectionObserver(w,b)}r.observe(e)}return i(!0),s}function by(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,d=Wi(e),u=a||s?[...d?Qn(d):[],...t?Qn(t):[]]:[];u.forEach(y=>{a&&y.addEventListener("scroll",r,{passive:!0}),s&&y.addEventListener("resize",r)});const m=d&&l?vy(d,r):null;let p=-1,f=null;i&&(f=new ResizeObserver(y=>{let[b]=y;b&&b.target===d&&f&&t&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var k;(k=f)==null||k.observe(t)})),r()}),d&&!c&&f.observe(d),t&&f.observe(t));let v,h=c?Qr(e):null;c&&x();function x(){const y=Qr(e);h&&!Am(h,y)&&r(),h=y,v=requestAnimationFrame(x)}return r(),()=>{var y;u.forEach(b=>{a&&b.removeEventListener("scroll",r),s&&b.removeEventListener("resize",r)}),m==null||m(),(y=f)==null||y.disconnect(),f=null,c&&cancelAnimationFrame(v)}}const yy=Kb,wy=Yb,ky=Gb,jy=Qb,Cy=Xb,Sc=qb,Ny=Jb,Sy=(e,t,r)=>{const n=new Map,a={platform:gy,...r},s={...a.platform,_c:n};return Wb(e,t,{...a,platform:s})};var $y=typeof document<"u",Ey=function(){},Ia=$y?j.useLayoutEffect:Ey;function Ua(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,n,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!Ua(e[n],t[n]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,a[n]))return!1;for(n=r;n--!==0;){const s=a[n];if(!(s==="_owner"&&e.$$typeof)&&!Ua(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Dm(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $c(e,t){const r=Dm(e);return Math.round(t*r)/r}function ps(e){const t=g.useRef(e);return Ia(()=>{t.current=e}),t}function Ty(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,m]=g.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=g.useState(n);Ua(p,n)||f(n);const[v,h]=g.useState(null),[x,y]=g.useState(null),b=g.useCallback(V=>{V!==S.current&&(S.current=V,h(V))},[]),k=g.useCallback(V=>{V!==A.current&&(A.current=V,y(V))},[]),w=s||v,N=i||x,S=g.useRef(null),A=g.useRef(null),C=g.useRef(u),E=c!=null,$=ps(c),I=ps(a),L=ps(d),D=g.useCallback(()=>{if(!S.current||!A.current)return;const V={placement:t,strategy:r,middleware:p};I.current&&(V.platform=I.current),Sy(S.current,A.current,V).then(M=>{const R={...M,isPositioned:L.current!==!1};z.current&&!Ua(C.current,R)&&(C.current=R,so.flushSync(()=>{m(R)}))})},[p,t,r,I,L]);Ia(()=>{d===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,m(V=>({...V,isPositioned:!1})))},[d]);const z=g.useRef(!1);Ia(()=>(z.current=!0,()=>{z.current=!1}),[]),Ia(()=>{if(w&&(S.current=w),N&&(A.current=N),w&&N){if($.current)return $.current(w,N,D);D()}},[w,N,D,$,E]);const H=g.useMemo(()=>({reference:S,floating:A,setReference:b,setFloating:k}),[b,k]),U=g.useMemo(()=>({reference:w,floating:N}),[w,N]),Z=g.useMemo(()=>{const V={position:r,left:0,top:0};if(!U.floating)return V;const M=$c(U.floating,u.x),R=$c(U.floating,u.y);return l?{...V,transform:"translate("+M+"px, "+R+"px)",...Dm(U.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:M,top:R}},[r,l,U.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:D,refs:H,elements:U,floatingStyles:Z}),[u,D,H,U,Z])}const Ay=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:a}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?Sc({element:n.current,padding:a}).fn(r):{}:n?Sc({element:n,padding:a}).fn(r):{}}}},Dy=(e,t)=>{const r=yy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Ry=(e,t)=>{const r=wy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Py=(e,t)=>({fn:Ny(e).fn,options:[e,t]}),_y=(e,t)=>{const r=ky(e);return{name:r.name,fn:r.fn,options:[e,t]}},Iy=(e,t)=>{const r=jy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Oy=(e,t)=>{const r=Cy(e);return{name:r.name,fn:r.fn,options:[e,t]}},Fy=(e,t)=>{const r=Ay(e);return{name:r.name,fn:r.fn,options:[e,t]}};var Ly="Arrow",Rm=g.forwardRef((e,t)=>{const{children:r,width:n=10,height:a=5,...s}=e;return o.jsx(we.svg,{...s,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});Rm.displayName=Ly;var zy=Rm,qi="Popper",[Pm,_n]=_t(qi),[My,_m]=Pm(qi),Im=e=>{const{__scopePopper:t,children:r}=e,[n,a]=g.useState(null);return o.jsx(My,{scope:t,anchor:n,onAnchorChange:a,children:r})};Im.displayName=qi;var Om="PopperAnchor",Fm=g.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...a}=e,s=_m(Om,r),i=g.useRef(null),l=je(t,i),c=g.useRef(null);return g.useEffect(()=>{const d=c.current;c.current=(n==null?void 0:n.current)||i.current,d!==c.current&&s.onAnchorChange(c.current)}),n?null:o.jsx(we.div,{...a,ref:l})});Fm.displayName=Om;var Gi="PopperContent",[Vy,By]=Pm(Gi),Lm=g.forwardRef((e,t)=>{var r,n,a,s,i,l;const{__scopePopper:c,side:d="bottom",sideOffset:u=0,align:m="center",alignOffset:p=0,arrowPadding:f=0,avoidCollisions:v=!0,collisionBoundary:h=[],collisionPadding:x=0,sticky:y="partial",hideWhenDetached:b=!1,updatePositionStrategy:k="optimized",onPlaced:w,...N}=e,S=_m(Gi,c),[A,C]=g.useState(null),E=je(t,ye=>C(ye)),[$,I]=g.useState(null),L=oa($),D=(L==null?void 0:L.width)??0,z=(L==null?void 0:L.height)??0,H=d+(m!=="center"?"-"+m:""),U=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},Z=Array.isArray(h)?h:[h],V=Z.length>0,M={padding:U,boundary:Z.filter(Hy),altBoundary:V},{refs:R,floatingStyles:oe,placement:ge,isPositioned:q,middlewareData:G}=Ty({strategy:"fixed",placement:H,whileElementsMounted:(...ye)=>by(...ye,{animationFrame:k==="always"}),elements:{reference:S.anchor},middleware:[Dy({mainAxis:u+z,alignmentAxis:p}),v&&Ry({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?Py():void 0,...M}),v&&_y({...M}),Iy({...M,apply:({elements:ye,rects:be,availableWidth:Fe,availableHeight:Le})=>{const{width:Ve,height:Ct}=be.reference,Me=ye.floating.style;Me.setProperty("--radix-popper-available-width",`${Fe}px`),Me.setProperty("--radix-popper-available-height",`${Le}px`),Me.setProperty("--radix-popper-anchor-width",`${Ve}px`),Me.setProperty("--radix-popper-anchor-height",`${Ct}px`)}}),$&&Fy({element:$,padding:f}),Wy({arrowWidth:D,arrowHeight:z}),b&&Oy({strategy:"referenceHidden",...M})]}),[ne,W]=Vm(ge),X=pt(w);lt(()=>{q&&(X==null||X())},[q,X]);const re=(r=G.arrow)==null?void 0:r.x,K=(n=G.arrow)==null?void 0:n.y,J=((a=G.arrow)==null?void 0:a.centerOffset)!==0,[ce,se]=g.useState();return lt(()=>{A&&se(window.getComputedStyle(A).zIndex)},[A]),o.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...oe,transform:q?oe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[(s=G.transformOrigin)==null?void 0:s.x,(i=G.transformOrigin)==null?void 0:i.y].join(" "),...((l=G.hide)==null?void 0:l.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(Vy,{scope:c,placedSide:ne,onArrowChange:I,arrowX:re,arrowY:K,shouldHideArrow:J,children:o.jsx(we.div,{"data-side":ne,"data-align":W,...N,ref:E,style:{...N.style,animation:q?void 0:"none"}})})})});Lm.displayName=Gi;var zm="PopperArrow",Uy={top:"bottom",right:"left",bottom:"top",left:"right"},Mm=g.forwardRef(function(e,t){const{__scopePopper:r,...n}=e,a=By(zm,r),s=Uy[a.placedSide];return o.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:o.jsx(zy,{...n,ref:t,style:{...n.style,display:"block"}})})});Mm.displayName=zm;function Hy(e){return e!==null}var Wy=e=>({name:"transformOrigin",options:e,fn(t){var r,n,a;const{placement:s,rects:i,middlewareData:l}=t,c=((r=l.arrow)==null?void 0:r.centerOffset)!==0,d=c?0:e.arrowWidth,u=c?0:e.arrowHeight,[m,p]=Vm(s),f={start:"0%",center:"50%",end:"100%"}[p],v=(((n=l.arrow)==null?void 0:n.x)??0)+d/2,h=(((a=l.arrow)==null?void 0:a.y)??0)+u/2;let x="",y="";return m==="bottom"?(x=c?f:`${v}px`,y=`${-u}px`):m==="top"?(x=c?f:`${v}px`,y=`${i.floating.height+u}px`):m==="right"?(x=`${-u}px`,y=c?f:`${h}px`):m==="left"&&(x=`${i.floating.width+u}px`,y=c?f:`${h}px`),{data:{x,y}}}});function Vm(e){const[t,r="center"]=e.split("-");return[t,r]}var Xi=Im,yo=Fm,Zi=Lm,Ki=Mm,qy="Portal",wo=g.forwardRef((e,t)=>{var r;const{container:n,...a}=e,[s,i]=g.useState(!1);lt(()=>i(!0),[]);const l=n||s&&((r=globalThis==null?void 0:globalThis.document)==null?void 0:r.body);return l?yi.createPortal(o.jsx(we.div,{...a,ref:t}),l):null});wo.displayName=qy;var Bm=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"}),Gy="VisuallyHidden",Um=g.forwardRef((e,t)=>o.jsx(we.span,{...e,ref:t,style:{...Bm,...e.style}}));Um.displayName=Gy;var Xy=Um,Zy=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},cn=new WeakMap,ja=new WeakMap,Ca={},fs=0,Hm=function(e){return e&&(e.host||Hm(e.parentNode))},Ky=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Hm(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Yy=function(e,t,r,n){var a=Ky(t,Array.isArray(e)?e:[e]);Ca[r]||(Ca[r]=new WeakMap);var s=Ca[r],i=[],l=new Set,c=new Set(a),d=function(m){!m||l.has(m)||(l.add(m),d(m.parentNode))};a.forEach(d);var u=function(m){!m||c.has(m)||Array.prototype.forEach.call(m.children,function(p){if(l.has(p))u(p);else try{var f=p.getAttribute(n),v=f!==null&&f!=="false",h=(cn.get(p)||0)+1,x=(s.get(p)||0)+1;cn.set(p,h),s.set(p,x),i.push(p),h===1&&v&&ja.set(p,!0),x===1&&p.setAttribute(r,"true"),v||p.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return u(t),l.clear(),fs++,function(){i.forEach(function(m){var p=cn.get(m)-1,f=s.get(m)-1;cn.set(m,p),s.set(m,f),p||(ja.has(m)||m.removeAttribute(n),ja.delete(m)),f||m.removeAttribute(r)}),fs--,fs||(cn=new WeakMap,cn=new WeakMap,ja=new WeakMap,Ca={})}},Yi=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=Zy(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),Yy(n,a,r,"aria-hidden")):function(){return null}},sr=function(){return sr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},sr.apply(this,arguments)};function Wm(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function Jy(e,t,r){for(var n=0,a=t.length,s;n<a;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}var Oa="right-scroll-bar-position",Fa="width-before-scroll-bar",Qy="with-scroll-bars-hidden",e0="--removed-body-scroll-bar-size";function hs(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function t0(e,t){var r=j.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var a=r.value;a!==n&&(r.value=n,r.callback(n,a))}}}})[0];return r.callback=t,r.facade}var r0=typeof window<"u"?g.useLayoutEffect:g.useEffect,Ec=new WeakMap;function n0(e,t){var r=t0(null,function(n){return e.forEach(function(a){return hs(a,n)})});return r0(function(){var n=Ec.get(r);if(n){var a=new Set(n),s=new Set(e),i=r.current;a.forEach(function(l){s.has(l)||hs(l,null)}),s.forEach(function(l){a.has(l)||hs(l,i)})}Ec.set(r,e)},[e]),r}function a0(e){return e}function o0(e,t){t===void 0&&(t=a0);var r=[],n=!1,a={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(s){var i=t(s,n);return r.push(i),function(){r=r.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(n=!0;r.length;){var i=r;r=[],i.forEach(s)}r={push:function(l){return s(l)},filter:function(){return r}}},assignMedium:function(s){n=!0;var i=[];if(r.length){var l=r;r=[],l.forEach(s),i=r}var c=function(){var u=i;i=[],u.forEach(s)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(u){i.push(u),d()},filter:function(u){return i=i.filter(u),r}}}};return a}function s0(e){e===void 0&&(e={});var t=o0(null);return t.options=sr({async:!0,ssr:!1},e),t}var qm=function(e){var t=e.sideCar,r=Wm(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return g.createElement(n,sr({},r))};qm.isSideCarExport=!0;function i0(e,t){return e.useMedium(t),qm}var Gm=s0(),xs=function(){},ko=g.forwardRef(function(e,t){var r=g.useRef(null),n=g.useState({onScrollCapture:xs,onWheelCapture:xs,onTouchMoveCapture:xs}),a=n[0],s=n[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,m=e.shards,p=e.sideCar,f=e.noRelative,v=e.noIsolation,h=e.inert,x=e.allowPinchZoom,y=e.as,b=y===void 0?"div":y,k=e.gapMode,w=Wm(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=p,S=n0([r,t]),A=sr(sr({},w),a);return g.createElement(g.Fragment,null,u&&g.createElement(N,{sideCar:Gm,removeScrollBar:d,shards:m,noRelative:f,noIsolation:v,inert:h,setCallbacks:s,allowPinchZoom:!!x,lockRef:r,gapMode:k}),i?g.cloneElement(g.Children.only(l),sr(sr({},A),{ref:S})):g.createElement(b,sr({},A,{className:c,ref:S}),l))});ko.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ko.classNames={fullWidth:Fa,zeroRight:Oa};var l0=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function c0(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=l0();return t&&e.setAttribute("nonce",t),e}function d0(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function u0(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var m0=function(){var e=0,t=null;return{add:function(r){e==0&&(t=c0())&&(d0(t,r),u0(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},p0=function(){var e=m0();return function(t,r){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Xm=function(){var e=p0(),t=function(r){var n=r.styles,a=r.dynamic;return e(n,a),null};return t},f0={left:0,top:0,right:0,gap:0},gs=function(e){return parseInt(e||"",10)||0},h0=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[gs(r),gs(n),gs(a)]},x0=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return f0;var t=h0(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},g0=Xm(),kn="data-scroll-locked",v0=function(e,t,r,n){var a=e.left,s=e.top,i=e.right,l=e.gap;return r===void 0&&(r="margin"),`
31
+ .`.concat(Qy,` {
32
32
  overflow: hidden `).concat(n,`;
33
33
  padding-right: `).concat(l,"px ").concat(n,`;
34
34
  }
35
- body[`).concat(jn,`] {
35
+ body[`).concat(kn,`] {
36
36
  overflow: hidden `).concat(n,`;
37
37
  overscroll-behavior: contain;
38
38
  `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
@@ -45,41 +45,41 @@ React keys must be passed directly to JSX without using spread:
45
45
  `),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),`
46
46
  }
47
47
 
48
- .`).concat(_a,` {
48
+ .`).concat(Oa,` {
49
49
  right: `).concat(l,"px ").concat(n,`;
50
50
  }
51
51
 
52
- .`).concat(Ia,` {
52
+ .`).concat(Fa,` {
53
53
  margin-right: `).concat(l,"px ").concat(n,`;
54
54
  }
55
55
 
56
- .`).concat(_a," .").concat(_a,` {
56
+ .`).concat(Oa," .").concat(Oa,` {
57
57
  right: 0 `).concat(n,`;
58
58
  }
59
59
 
60
- .`).concat(Ia," .").concat(Ia,` {
60
+ .`).concat(Fa," .").concat(Fa,` {
61
61
  margin-right: 0 `).concat(n,`;
62
62
  }
63
63
 
64
- body[`).concat(jn,`] {
65
- `).concat(Jy,": ").concat(l,`px;
64
+ body[`).concat(kn,`] {
65
+ `).concat(e0,": ").concat(l,`px;
66
66
  }
67
- `)},Nc=function(){var e=parseInt(document.body.getAttribute(jn)||"0",10);return isFinite(e)?e:0},g0=function(){g.useEffect(function(){return document.body.setAttribute(jn,(Nc()+1).toString()),function(){var e=Nc()-1;e<=0?document.body.removeAttribute(jn):document.body.setAttribute(jn,e.toString())}},[])},v0=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=n===void 0?"margin":n;g0();var s=g.useMemo(function(){return f0(a)},[a]);return g.createElement(h0,{styles:x0(s,!t,a,r?"":"!important")})},qs=!1;if(typeof window<"u")try{var ka=Object.defineProperty({},"passive",{get:function(){return qs=!0,!0}});window.addEventListener("test",ka,ka),window.removeEventListener("test",ka,ka)}catch{qs=!1}var dn=qs?{passive:!1}:!1,b0=function(e){return e.tagName==="TEXTAREA"},Wm=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!b0(e)&&r[t]==="visible")},y0=function(e){return Wm(e,"overflowY")},w0=function(e){return Wm(e,"overflowX")},Sc=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=qm(e,n);if(a){var s=Gm(e,n),i=s[1],l=s[2];if(i>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},j0=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},k0=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},qm=function(e,t){return e==="v"?y0(t):w0(t)},Gm=function(e,t){return e==="v"?j0(t):k0(t)},C0=function(e,t){return e==="h"&&t==="rtl"?-1:1},N0=function(e,t,r,n,a){var s=C0(e,window.getComputedStyle(t).direction),i=s*n,l=r.target,c=t.contains(l),d=!1,u=i>0,m=0,p=0;do{if(!l)break;var f=Gm(e,l),v=f[0],h=f[1],x=f[2],b=h-x-s*v;(v||b)&&qm(e,l)&&(m+=b,p+=v);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(u&&Math.abs(m)<1||!u&&Math.abs(p)<1)&&(d=!0),d},Ca=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},$c=function(e){return[e.deltaX,e.deltaY]},Ec=function(e){return e&&"current"in e?e.current:e},S0=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$0=function(e){return`
67
+ `)},Tc=function(){var e=parseInt(document.body.getAttribute(kn)||"0",10);return isFinite(e)?e:0},b0=function(){g.useEffect(function(){return document.body.setAttribute(kn,(Tc()+1).toString()),function(){var e=Tc()-1;e<=0?document.body.removeAttribute(kn):document.body.setAttribute(kn,e.toString())}},[])},y0=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=n===void 0?"margin":n;b0();var s=g.useMemo(function(){return x0(a)},[a]);return g.createElement(g0,{styles:v0(s,!t,a,r?"":"!important")})},Ks=!1;if(typeof window<"u")try{var Na=Object.defineProperty({},"passive",{get:function(){return Ks=!0,!0}});window.addEventListener("test",Na,Na),window.removeEventListener("test",Na,Na)}catch{Ks=!1}var dn=Ks?{passive:!1}:!1,w0=function(e){return e.tagName==="TEXTAREA"},Zm=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!w0(e)&&r[t]==="visible")},k0=function(e){return Zm(e,"overflowY")},j0=function(e){return Zm(e,"overflowX")},Ac=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=Km(e,n);if(a){var s=Ym(e,n),i=s[1],l=s[2];if(i>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},C0=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},N0=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Km=function(e,t){return e==="v"?k0(t):j0(t)},Ym=function(e,t){return e==="v"?C0(t):N0(t)},S0=function(e,t){return e==="h"&&t==="rtl"?-1:1},$0=function(e,t,r,n,a){var s=S0(e,window.getComputedStyle(t).direction),i=s*n,l=r.target,c=t.contains(l),d=!1,u=i>0,m=0,p=0;do{if(!l)break;var f=Ym(e,l),v=f[0],h=f[1],x=f[2],y=h-x-s*v;(v||y)&&Km(e,l)&&(m+=y,p+=v);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(u&&Math.abs(m)<1||!u&&Math.abs(p)<1)&&(d=!0),d},Sa=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Dc=function(e){return[e.deltaX,e.deltaY]},Rc=function(e){return e&&"current"in e?e.current:e},E0=function(e,t){return e[0]===t[0]&&e[1]===t[1]},T0=function(e){return`
68
68
  .block-interactivity-`.concat(e,` {pointer-events: none;}
69
69
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
70
- `)},E0=0,un=[];function T0(e){var t=g.useRef([]),r=g.useRef([0,0]),n=g.useRef(),a=g.useState(E0++)[0],s=g.useState(Hm)[0],i=g.useRef(e);g.useEffect(function(){i.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var h=Ky([e.lockRef.current],(e.shards||[]).map(Ec)).filter(Boolean);return h.forEach(function(x){return x.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),h.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=g.useCallback(function(h,x){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var b=Ca(h),y=r.current,j="deltaX"in h?h.deltaX:y[0]-b[0],w="deltaY"in h?h.deltaY:y[1]-b[1],C,S=h.target,$=Math.abs(j)>Math.abs(w)?"h":"v";if("touches"in h&&$==="h"&&S.type==="range")return!1;var k=window.getSelection(),E=k&&k.anchorNode,T=E?E===S||E.contains(S):!1;if(T)return!1;var O=Sc($,S);if(!O)return!0;if(O?C=$:(C=$==="v"?"h":"v",O=Sc($,S)),!O)return!1;if(!n.current&&"changedTouches"in h&&(j||w)&&(n.current=C),!C)return!0;var L=n.current||C;return N0(L,x,h,L==="h"?j:w)},[]),c=g.useCallback(function(h){var x=h;if(!(!un.length||un[un.length-1]!==s)){var b="deltaY"in x?$c(x):Ca(x),y=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&S0(C.delta,b)})[0];if(y&&y.should){x.cancelable&&x.preventDefault();return}if(!y){var j=(i.current.shards||[]).map(Ec).filter(Boolean).filter(function(C){return C.contains(x.target)}),w=j.length>0?l(x,j[0]):!i.current.noIsolation;w&&x.cancelable&&x.preventDefault()}}},[]),d=g.useCallback(function(h,x,b,y){var j={name:h,delta:x,target:b,should:y,shadowParent:A0(b)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(w){return w!==j})},1)},[]),u=g.useCallback(function(h){r.current=Ca(h),n.current=void 0},[]),m=g.useCallback(function(h){d(h.type,$c(h),h.target,l(h,e.lockRef.current))},[]),p=g.useCallback(function(h){d(h.type,Ca(h),h.target,l(h,e.lockRef.current))},[]);g.useEffect(function(){return un.push(s),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:p}),document.addEventListener("wheel",c,dn),document.addEventListener("touchmove",c,dn),document.addEventListener("touchstart",u,dn),function(){un=un.filter(function(h){return h!==s}),document.removeEventListener("wheel",c,dn),document.removeEventListener("touchmove",c,dn),document.removeEventListener("touchstart",u,dn)}},[]);var f=e.removeScrollBar,v=e.inert;return g.createElement(g.Fragment,null,v?g.createElement(s,{styles:$0(a)}):null,f?g.createElement(v0,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function A0(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const D0=o0(Um,T0);var wo=g.forwardRef(function(e,t){return g.createElement(yo,sr({},e,{ref:t,sideCar:D0}))});wo.classNames=yo.classNames;var R0=[" ","Enter","ArrowUp","ArrowDown"],P0=[" ","Enter"],en="Select",[jo,ko,_0]=Ai(en),[In]=_t(en,[_0,_n]),Co=_n(),[I0,Lr]=In(en),[O0,F0]=In(en),Xm=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:a,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:d,name:u,autoComplete:m,disabled:p,required:f,form:v}=e,h=Co(t),[x,b]=g.useState(null),[y,j]=g.useState(null),[w,C]=g.useState(!1),S=oa(d),[$,k]=cr({prop:n,defaultProp:a??!1,onChange:s,caller:en}),[E,T]=cr({prop:i,defaultProp:l,onChange:c,caller:en}),O=g.useRef(null),L=x?v||!!x.closest("form"):!0,[A,z]=g.useState(new Set),X=Array.from(A).map(q=>q.props.value).join(";");return o.jsx(Hi,{...h,children:o.jsxs(I0,{required:f,scope:t,trigger:x,onTriggerChange:b,valueNode:y,onValueNodeChange:j,valueNodeHasChildren:w,onValueNodeHasChildrenChange:C,contentId:yr(),value:E,onValueChange:T,open:$,onOpenChange:k,dir:S,triggerPointerDownPosRef:O,disabled:p,children:[o.jsx(jo.Provider,{scope:t,children:o.jsx(O0,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(q=>{z(Z=>new Set(Z).add(q))},[]),onNativeOptionRemove:g.useCallback(q=>{z(Z=>{const V=new Set(Z);return V.delete(q),V})},[]),children:r})}),L?o.jsxs(vp,{"aria-hidden":!0,required:f,tabIndex:-1,name:u,autoComplete:m,value:E,onChange:q=>T(q.target.value),disabled:p,form:v,children:[E===void 0?o.jsx("option",{value:""}):null,Array.from(A)]},X):null]})})};Xm.displayName=en;var Zm="SelectTrigger",Km=g.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...a}=e,s=Co(r),i=Lr(Zm,r),l=i.disabled||n,c=ke(t,i.onTriggerChange),d=ko(r),u=g.useRef("touch"),[m,p,f]=yp(h=>{const x=d().filter(j=>!j.disabled),b=x.find(j=>j.value===i.value),y=wp(x,h,b);y!==void 0&&i.onValueChange(y.value)}),v=h=>{l||(i.onOpenChange(!0),f()),h&&(i.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return o.jsx(vo,{asChild:!0,...s,children:o.jsx(we.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":bp(i.value)?"":void 0,...a,ref:c,onClick:ge(a.onClick,h=>{h.currentTarget.focus(),u.current!=="mouse"&&v(h)}),onPointerDown:ge(a.onPointerDown,h=>{u.current=h.pointerType;const x=h.target;x.hasPointerCapture(h.pointerId)&&x.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(v(h),h.preventDefault())}),onKeyDown:ge(a.onKeyDown,h=>{const x=m.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&p(h.key),!(x&&h.key===" ")&&R0.includes(h.key)&&(v(),h.preventDefault())})})})});Km.displayName=Zm;var Ym="SelectValue",Jm=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,children:s,placeholder:i="",...l}=e,c=Lr(Ym,r),{onValueNodeHasChildrenChange:d}=c,u=s!==void 0,m=ke(t,c.onValueNodeChange);return lt(()=>{d(u)},[d,u]),o.jsx(we.span,{...l,ref:m,style:{pointerEvents:"none"},children:bp(c.value)?o.jsx(o.Fragment,{children:i}):s})});Jm.displayName=Ym;var z0="SelectIcon",Qm=g.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...a}=e;return o.jsx(we.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});Qm.displayName=z0;var L0="SelectPortal",ep=e=>o.jsx(bo,{asChild:!0,...e});ep.displayName=L0;var tn="SelectContent",tp=g.forwardRef((e,t)=>{const r=Lr(tn,e.__scopeSelect),[n,a]=g.useState();if(lt(()=>{a(new DocumentFragment)},[]),!r.open){const s=n;return s?ao.createPortal(o.jsx(rp,{scope:e.__scopeSelect,children:o.jsx(jo.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),s):null}return o.jsx(np,{...e,ref:t})});tp.displayName=tn;var Wt=10,[rp,Mr]=In(tn),M0="SelectContentImpl",V0=Cn("SelectContent.RemoveScroll"),np=g.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:m,collisionBoundary:p,collisionPadding:f,sticky:v,hideWhenDetached:h,avoidCollisions:x,...b}=e,y=Lr(tn,r),[j,w]=g.useState(null),[C,S]=g.useState(null),$=ke(t,G=>w(G)),[k,E]=g.useState(null),[T,O]=g.useState(null),L=ko(r),[A,z]=g.useState(!1),X=g.useRef(!1);g.useEffect(()=>{if(j)return Gi(j)},[j]),Ii();const q=g.useCallback(G=>{const[ne,...J]=L().map(be=>be.ref.current),[te]=J.slice(-1),ce=document.activeElement;for(const be of G)if(be===ce||(be==null||be.scrollIntoView({block:"nearest"}),be===ne&&C&&(C.scrollTop=0),be===te&&C&&(C.scrollTop=C.scrollHeight),be==null||be.focus(),document.activeElement!==ce))return},[L,C]),Z=g.useCallback(()=>q([k,j]),[q,k,j]);g.useEffect(()=>{A&&Z()},[A,Z]);const{onOpenChange:V,triggerPointerDownPosRef:M}=y;g.useEffect(()=>{if(j){let G={x:0,y:0};const ne=te=>{var ce,be;G={x:Math.abs(Math.round(te.pageX)-(((ce=M.current)==null?void 0:ce.x)??0)),y:Math.abs(Math.round(te.pageY)-(((be=M.current)==null?void 0:be.y)??0))}},J=te=>{G.x<=10&&G.y<=10?te.preventDefault():j.contains(te.target)||V(!1),document.removeEventListener("pointermove",ne),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",ne),document.addEventListener("pointerup",J,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ne),document.removeEventListener("pointerup",J,{capture:!0})}}},[j,V,M]),g.useEffect(()=>{const G=()=>V(!1);return window.addEventListener("blur",G),window.addEventListener("resize",G),()=>{window.removeEventListener("blur",G),window.removeEventListener("resize",G)}},[V]);const[_,se]=yp(G=>{const ne=L().filter(ce=>!ce.disabled),J=ne.find(ce=>ce.ref.current===document.activeElement),te=wp(ne,G,J);te&&setTimeout(()=>te.ref.current.focus())}),U=g.useCallback((G,ne,J)=>{const te=!X.current&&!J;(y.value!==void 0&&y.value===ne||te)&&(E(G),te&&(X.current=!0))},[y.value]),Q=g.useCallback(()=>j==null?void 0:j.focus(),[j]),Y=g.useCallback((G,ne,J)=>{const te=!X.current&&!J;(y.value!==void 0&&y.value===ne||te)&&O(G)},[y.value]),H=n==="popper"?Gs:ap,W=H===Gs?{side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:m,collisionBoundary:p,collisionPadding:f,sticky:v,hideWhenDetached:h,avoidCollisions:x}:{};return o.jsx(rp,{scope:r,content:j,viewport:C,onViewportChange:S,itemRefCallback:U,selectedItem:k,onItemLeave:Q,itemTextRefCallback:Y,focusSelectedItem:Z,selectedItemText:T,position:n,isPositioned:A,searchRef:_,children:o.jsx(wo,{as:V0,allowPinchZoom:!0,children:o.jsx(po,{asChild:!0,trapped:y.open,onMountAutoFocus:G=>{G.preventDefault()},onUnmountAutoFocus:ge(a,G=>{var ne;(ne=y.trigger)==null||ne.focus({preventScroll:!0}),G.preventDefault()}),children:o.jsx(ia,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:G=>G.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:o.jsx(H,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:G=>G.preventDefault(),...b,...W,onPlaced:()=>z(!0),ref:$,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:ge(b.onKeyDown,G=>{const ne=G.ctrlKey||G.altKey||G.metaKey;if(G.key==="Tab"&&G.preventDefault(),!ne&&G.key.length===1&&se(G.key),["ArrowUp","ArrowDown","Home","End"].includes(G.key)){let J=L().filter(te=>!te.disabled).map(te=>te.ref.current);if(["ArrowUp","End"].includes(G.key)&&(J=J.slice().reverse()),["ArrowUp","ArrowDown"].includes(G.key)){const te=G.target,ce=J.indexOf(te);J=J.slice(ce+1)}setTimeout(()=>q(J)),G.preventDefault()}})})})})})})});np.displayName=M0;var B0="SelectItemAlignedPosition",ap=g.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...a}=e,s=Lr(tn,r),i=Mr(tn,r),[l,c]=g.useState(null),[d,u]=g.useState(null),m=ke(t,$=>u($)),p=ko(r),f=g.useRef(!1),v=g.useRef(!0),{viewport:h,selectedItem:x,selectedItemText:b,focusSelectedItem:y}=i,j=g.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&h&&x&&b){const $=s.trigger.getBoundingClientRect(),k=d.getBoundingClientRect(),E=s.valueNode.getBoundingClientRect(),T=b.getBoundingClientRect();if(s.dir!=="rtl"){const te=T.left-k.left,ce=E.left-te,be=$.left-ce,Ce=$.width+be,ve=Math.max(Ce,k.width),me=window.innerWidth-Wt,Te=Yn(ce,[Wt,Math.max(Wt,me-ve)]);l.style.minWidth=Ce+"px",l.style.left=Te+"px"}else{const te=k.right-T.right,ce=window.innerWidth-E.right-te,be=window.innerWidth-$.right-ce,Ce=$.width+be,ve=Math.max(Ce,k.width),me=window.innerWidth-Wt,Te=Yn(ce,[Wt,Math.max(Wt,me-ve)]);l.style.minWidth=Ce+"px",l.style.right=Te+"px"}const O=p(),L=window.innerHeight-Wt*2,A=h.scrollHeight,z=window.getComputedStyle(d),X=parseInt(z.borderTopWidth,10),q=parseInt(z.paddingTop,10),Z=parseInt(z.borderBottomWidth,10),V=parseInt(z.paddingBottom,10),M=X+q+A+V+Z,_=Math.min(x.offsetHeight*5,M),se=window.getComputedStyle(h),U=parseInt(se.paddingTop,10),Q=parseInt(se.paddingBottom,10),Y=$.top+$.height/2-Wt,H=L-Y,W=x.offsetHeight/2,G=x.offsetTop+W,ne=X+q+G,J=M-ne;if(ne<=Y){const te=O.length>0&&x===O[O.length-1].ref.current;l.style.bottom="0px";const ce=d.clientHeight-h.offsetTop-h.offsetHeight,be=Math.max(H,W+(te?Q:0)+ce+Z),Ce=ne+be;l.style.height=Ce+"px"}else{const te=O.length>0&&x===O[0].ref.current;l.style.top="0px";const ce=Math.max(Y,X+h.offsetTop+(te?U:0)+W)+J;l.style.height=ce+"px",h.scrollTop=ne-Y+h.offsetTop}l.style.margin=`${Wt}px 0`,l.style.minHeight=_+"px",l.style.maxHeight=L+"px",n==null||n(),requestAnimationFrame(()=>f.current=!0)}},[p,s.trigger,s.valueNode,l,d,h,x,b,s.dir,n]);lt(()=>j(),[j]);const[w,C]=g.useState();lt(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]);const S=g.useCallback($=>{$&&v.current===!0&&(j(),y==null||y(),v.current=!1)},[j,y]);return o.jsx(H0,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:f,onScrollButtonChange:S,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:o.jsx(we.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});ap.displayName=B0;var U0="SelectPopperPosition",Gs=g.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:a=Wt,...s}=e,i=Co(r);return o.jsx(Wi,{...i,...s,ref:t,align:n,collisionPadding:a,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)"}})});Gs.displayName=U0;var[H0,Xi]=In(tn,{}),Xs="SelectViewport",op=g.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...a}=e,s=Mr(Xs,r),i=Xi(Xs,r),l=ke(t,s.onViewportChange),c=g.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),o.jsx(jo.Slot,{scope:r,children:o.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:ge(a.onScroll,d=>{const u=d.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:p}=i;if(p!=null&&p.current&&m){const f=Math.abs(c.current-u.scrollTop);if(f>0){const v=window.innerHeight-Wt*2,h=parseFloat(m.style.minHeight),x=parseFloat(m.style.height),b=Math.max(h,x);if(b<v){const y=b+f,j=Math.min(v,y),w=y-j;m.style.height=j+"px",m.style.bottom==="0px"&&(u.scrollTop=w>0?w:0,m.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});op.displayName=Xs;var sp="SelectGroup",[W0,q0]=In(sp),G0=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=yr();return o.jsx(W0,{scope:r,id:a,children:o.jsx(we.div,{role:"group","aria-labelledby":a,...n,ref:t})})});G0.displayName=sp;var ip="SelectLabel",lp=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=q0(ip,r);return o.jsx(we.div,{id:a.id,...n,ref:t})});lp.displayName=ip;var Ba="SelectItem",[X0,cp]=In(Ba),dp=g.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:a=!1,textValue:s,...i}=e,l=Lr(Ba,r),c=Mr(Ba,r),d=l.value===n,[u,m]=g.useState(s??""),[p,f]=g.useState(!1),v=ke(t,y=>{var j;return(j=c.itemRefCallback)==null?void 0:j.call(c,y,n,a)}),h=yr(),x=g.useRef("touch"),b=()=>{a||(l.onValueChange(n),l.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(X0,{scope:r,value:n,disabled:a,textId:h,isSelected:d,onItemTextChange:g.useCallback(y=>{m(j=>j||((y==null?void 0:y.textContent)??"").trim())},[]),children:o.jsx(jo.ItemSlot,{scope:r,value:n,disabled:a,textValue:u,children:o.jsx(we.div,{role:"option","aria-labelledby":h,"data-highlighted":p?"":void 0,"aria-selected":d&&p,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...i,ref:v,onFocus:ge(i.onFocus,()=>f(!0)),onBlur:ge(i.onBlur,()=>f(!1)),onClick:ge(i.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:ge(i.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:ge(i.onPointerDown,y=>{x.current=y.pointerType}),onPointerMove:ge(i.onPointerMove,y=>{var j;x.current=y.pointerType,a?(j=c.onItemLeave)==null||j.call(c):x.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ge(i.onPointerLeave,y=>{var j;y.currentTarget===document.activeElement&&((j=c.onItemLeave)==null||j.call(c))}),onKeyDown:ge(i.onKeyDown,y=>{var j;((j=c.searchRef)==null?void 0:j.current)!==""&&y.key===" "||(P0.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});dp.displayName=Ba;var Wn="SelectItemText",up=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,...s}=e,i=Lr(Wn,r),l=Mr(Wn,r),c=cp(Wn,r),d=F0(Wn,r),[u,m]=g.useState(null),p=ke(t,b=>m(b),c.onItemTextChange,b=>{var y;return(y=l.itemTextRefCallback)==null?void 0:y.call(l,b,c.value,c.disabled)}),f=u==null?void 0:u.textContent,v=g.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:f},c.value),[c.disabled,c.value,f]),{onNativeOptionAdd:h,onNativeOptionRemove:x}=d;return lt(()=>(h(v),()=>x(v)),[h,x,v]),o.jsxs(o.Fragment,{children:[o.jsx(we.span,{id:c.textId,...s,ref:p}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?ao.createPortal(s.children,i.valueNode):null]})});up.displayName=Wn;var mp="SelectItemIndicator",pp=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return cp(mp,r).isSelected?o.jsx(we.span,{"aria-hidden":!0,...n,ref:t}):null});pp.displayName=mp;var Zs="SelectScrollUpButton",fp=g.forwardRef((e,t)=>{const r=Mr(Zs,e.__scopeSelect),n=Xi(Zs,e.__scopeSelect),[a,s]=g.useState(!1),i=ke(t,n.onScrollButtonChange);return lt(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollTop>0;s(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),a?o.jsx(xp,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});fp.displayName=Zs;var Ks="SelectScrollDownButton",hp=g.forwardRef((e,t)=>{const r=Mr(Ks,e.__scopeSelect),n=Xi(Ks,e.__scopeSelect),[a,s]=g.useState(!1),i=ke(t,n.onScrollButtonChange);return lt(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<d;s(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),a?o.jsx(xp,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});hp.displayName=Ks;var xp=g.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...a}=e,s=Mr("SelectScrollButton",r),i=g.useRef(null),l=ko(r),c=g.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return g.useEffect(()=>()=>c(),[c]),lt(()=>{var d;const u=l().find(m=>m.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),o.jsx(we.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:ge(a.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:ge(a.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:ge(a.onPointerLeave,()=>{c()})})}),Z0="SelectSeparator",gp=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return o.jsx(we.div,{"aria-hidden":!0,...n,ref:t})});gp.displayName=Z0;var Ys="SelectArrow",K0=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=Co(r),s=Lr(Ys,r),i=Mr(Ys,r);return s.open&&i.position==="popper"?o.jsx(qi,{...a,...n,ref:t}):null});K0.displayName=Ys;var Y0="SelectBubbleInput",vp=g.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const a=g.useRef(null),s=ke(n,a),i=na(t);return g.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const u=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(we.select,{...r,style:{...zm,...r.style},ref:s,defaultValue:t})});vp.displayName=Y0;function bp(e){return e===""||e===void 0}function yp(e){const t=ft(e),r=g.useRef(""),n=g.useRef(0),a=g.useCallback(i=>{const l=r.current+i;t(l),function c(d){r.current=d,window.clearTimeout(n.current),d!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),s=g.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,a,s]}function wp(e,t,r){const n=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let s=J0(e,Math.max(a,0));n.length===1&&(s=s.filter(l=>l!==r));const i=s.find(l=>l.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==r?i:void 0}function J0(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Q0=Xm,jp=Km,ew=Jm,tw=Qm,rw=ep,kp=tp,nw=op,Cp=lp,Np=dp,aw=up,ow=pp,Sp=fp,$p=hp,Ep=gp;const Vt=Q0,Bt=ew,Dt=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(jp,{ref:n,className:K("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,o.jsx(tw,{asChild:!0,children:o.jsx(I.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));Dt.displayName=jp.displayName;const Tp=g.forwardRef(({className:e,...t},r)=>o.jsx(Sp,{ref:r,className:K("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(I.ChevronUp,{className:"h-4 w-4"})}));Tp.displayName=Sp.displayName;const Ap=g.forwardRef(({className:e,...t},r)=>o.jsx($p,{ref:r,className:K("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(I.ChevronDown,{className:"h-4 w-4"})}));Ap.displayName=$p.displayName;const Rt=g.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>o.jsx(rw,{children:o.jsxs(kp,{ref:a,className:K("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,...n,children:[o.jsx(Tp,{}),o.jsx(nw,{className:K("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(Ap,{})]})}));Rt.displayName=kp.displayName;const sw=g.forwardRef(({className:e,...t},r)=>o.jsx(Cp,{ref:r,className:K("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));sw.displayName=Cp.displayName;const Xe=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Np,{ref:n,className:K("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(ow,{children:o.jsx(I.Check,{className:"h-4 w-4"})})}),o.jsx(aw,{children:t})]}));Xe.displayName=Np.displayName;const iw=g.forwardRef(({className:e,...t},r)=>o.jsx(Ep,{ref:r,className:K("-mx-1 my-1 h-px bg-muted",e),...t}));iw.displayName=Ep.displayName;var Dp=["PageUp","PageDown"],Rp=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Pp={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},On="Slider",[Js,lw,cw]=Ai(On),[_p]=_t(On,[cw]),[dw,No]=_p(On),Ip=g.forwardRef((e,t)=>{const{name:r,min:n=0,max:a=100,step:s=1,orientation:i="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[n],value:u,onValueChange:m=()=>{},onValueCommit:p=()=>{},inverted:f=!1,form:v,...h}=e,x=g.useRef(new Set),b=g.useRef(0),y=i==="horizontal"?uw:mw,[j=[],w]=cr({prop:u,defaultProp:d,onChange:T=>{var O;(O=[...x.current][b.current])==null||O.focus(),m(T)}}),C=g.useRef(j);function S(T){const O=gw(j,T);E(T,O)}function $(T){E(T,b.current)}function k(){const T=C.current[b.current];j[b.current]!==T&&p(j)}function E(T,O,{commit:L}={commit:!1}){const A=ww(s),z=jw(Math.round((T-n)/s)*s+n,A),X=Yn(z,[n,a]);w((q=[])=>{const Z=hw(q,X,O);if(yw(Z,c*s)){b.current=Z.indexOf(X);const V=String(Z)!==String(q);return V&&L&&p(Z),V?Z:q}else return q})}return o.jsx(dw,{scope:e.__scopeSlider,name:r,disabled:l,min:n,max:a,valueIndexToChangeRef:b,thumbs:x.current,values:j,orientation:i,form:v,children:o.jsx(Js.Provider,{scope:e.__scopeSlider,children:o.jsx(Js.Slot,{scope:e.__scopeSlider,children:o.jsx(y,{"aria-disabled":l,"data-disabled":l?"":void 0,...h,ref:t,onPointerDown:ge(h.onPointerDown,()=>{l||(C.current=j)}),min:n,max:a,inverted:f,onSlideStart:l?void 0:S,onSlideMove:l?void 0:$,onSlideEnd:l?void 0:k,onHomeKeyDown:()=>!l&&E(n,0,{commit:!0}),onEndKeyDown:()=>!l&&E(a,j.length-1,{commit:!0}),onStepKeyDown:({event:T,direction:O})=>{if(!l){const L=Dp.includes(T.key)||T.shiftKey&&Rp.includes(T.key)?10:1,A=b.current,z=j[A],X=s*L*O;E(z+X,A,{commit:!0})}}})})})})});Ip.displayName=On;var[Op,Fp]=_p(On,{startEdge:"left",endEdge:"right",size:"width",direction:1}),uw=g.forwardRef((e,t)=>{const{min:r,max:n,dir:a,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...u}=e,[m,p]=g.useState(null),f=ke(t,j=>p(j)),v=g.useRef(void 0),h=oa(a),x=h==="ltr",b=x&&!s||!x&&s;function y(j){const w=v.current||m.getBoundingClientRect(),C=[0,w.width],S=Zi(C,b?[r,n]:[n,r]);return v.current=w,S(j-w.left)}return o.jsx(Op,{scope:e.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:o.jsx(zp,{dir:h,"data-orientation":"horizontal",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:j=>{const w=y(j.clientX);i==null||i(w)},onSlideMove:j=>{const w=y(j.clientX);l==null||l(w)},onSlideEnd:()=>{v.current=void 0,c==null||c()},onStepKeyDown:j=>{const w=Pp[b?"from-left":"from-right"].includes(j.key);d==null||d({event:j,direction:w?-1:1})}})})}),mw=g.forwardRef((e,t)=>{const{min:r,max:n,inverted:a,onSlideStart:s,onSlideMove:i,onSlideEnd:l,onStepKeyDown:c,...d}=e,u=g.useRef(null),m=ke(t,u),p=g.useRef(void 0),f=!a;function v(h){const x=p.current||u.current.getBoundingClientRect(),b=[0,x.height],y=Zi(b,f?[n,r]:[r,n]);return p.current=x,y(h-x.top)}return o.jsx(Op,{scope:e.__scopeSlider,startEdge:f?"bottom":"top",endEdge:f?"top":"bottom",size:"height",direction:f?1:-1,children:o.jsx(zp,{"data-orientation":"vertical",...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{const x=v(h.clientY);s==null||s(x)},onSlideMove:h=>{const x=v(h.clientY);i==null||i(x)},onSlideEnd:()=>{p.current=void 0,l==null||l()},onStepKeyDown:h=>{const x=Pp[f?"from-bottom":"from-top"].includes(h.key);c==null||c({event:h,direction:x?-1:1})}})})}),zp=g.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:n,onSlideMove:a,onSlideEnd:s,onHomeKeyDown:i,onEndKeyDown:l,onStepKeyDown:c,...d}=e,u=No(On,r);return o.jsx(we.span,{...d,ref:t,onKeyDown:ge(e.onKeyDown,m=>{m.key==="Home"?(i(m),m.preventDefault()):m.key==="End"?(l(m),m.preventDefault()):Dp.concat(Rp).includes(m.key)&&(c(m),m.preventDefault())}),onPointerDown:ge(e.onPointerDown,m=>{const p=m.target;p.setPointerCapture(m.pointerId),m.preventDefault(),u.thumbs.has(p)?p.focus():n(m)}),onPointerMove:ge(e.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:ge(e.onPointerUp,m=>{const p=m.target;p.hasPointerCapture(m.pointerId)&&(p.releasePointerCapture(m.pointerId),s(m))})})}),Lp="SliderTrack",Mp=g.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,a=No(Lp,r);return o.jsx(we.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...n,ref:t})});Mp.displayName=Lp;var Qs="SliderRange",Vp=g.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,a=No(Qs,r),s=Fp(Qs,r),i=g.useRef(null),l=ke(t,i),c=a.values.length,d=a.values.map(p=>Hp(p,a.min,a.max)),u=c>1?Math.min(...d):0,m=100-Math.max(...d);return o.jsx(we.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...n,ref:l,style:{...e.style,[s.startEdge]:u+"%",[s.endEdge]:m+"%"}})});Vp.displayName=Qs;var ei="SliderThumb",Bp=g.forwardRef((e,t)=>{const r=lw(e.__scopeSlider),[n,a]=g.useState(null),s=ke(t,l=>a(l)),i=g.useMemo(()=>n?r().findIndex(l=>l.ref.current===n):-1,[r,n]);return o.jsx(pw,{...e,ref:s,index:i})}),pw=g.forwardRef((e,t)=>{const{__scopeSlider:r,index:n,name:a,...s}=e,i=No(ei,r),l=Fp(ei,r),[c,d]=g.useState(null),u=ke(t,y=>d(y)),m=c?i.form||!!c.closest("form"):!0,p=aa(c),f=i.values[n],v=f===void 0?0:Hp(f,i.min,i.max),h=xw(n,i.values.length),x=p==null?void 0:p[l.size],b=x?vw(x,v,l.direction):0;return g.useEffect(()=>{if(c)return i.thumbs.add(c),()=>{i.thumbs.delete(c)}},[c,i.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${v}% + ${b}px)`},children:[o.jsx(Js.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(we.span,{role:"slider","aria-label":e["aria-label"]||h,"aria-valuemin":i.min,"aria-valuenow":f,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...s,ref:u,style:f===void 0?{display:"none"}:e.style,onFocus:ge(e.onFocus,()=>{i.valueIndexToChangeRef.current=n})})}),m&&o.jsx(Up,{name:a??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:f},n)]})});Bp.displayName=ei;var fw="RadioBubbleInput",Up=g.forwardRef(({__scopeSlider:e,value:t,...r},n)=>{const a=g.useRef(null),s=ke(a,n),i=na(t);return g.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const u=new Event("input",{bubbles:!0});d.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(we.input,{style:{display:"none"},...r,ref:s,defaultValue:t})});Up.displayName=fw;function hw(e=[],t,r){const n=[...e];return n[r]=t,n.sort((a,s)=>a-s)}function Hp(e,t,r){const n=100/(r-t)*(e-t);return Yn(n,[0,100])}function xw(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function gw(e,t){if(e.length===1)return 0;const r=e.map(a=>Math.abs(a-t)),n=Math.min(...r);return r.indexOf(n)}function vw(e,t,r){const n=e/2,a=Zi([0,50],[0,n]);return(n-a(t)*r)*r}function bw(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function yw(e,t){if(t>0){const r=bw(e);return Math.min(...r)>=t}return!0}function Zi(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function ww(e){return(String(e).split(".")[1]||"").length}function jw(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var Wp=Ip,kw=Mp,Cw=Vp,Nw=Bp;const So=g.forwardRef(({className:e,...t},r)=>o.jsxs(Wp,{ref:r,className:K("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(kw,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:o.jsx(Cw,{className:"absolute h-full bg-primary"})}),o.jsx(Nw,{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"})]}));So.displayName=Wp.displayName;const Sw=g.forwardRef(({className:e,type:t="date",...r},n)=>o.jsx("input",{ref:n,type:t,className:K("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}));Sw.displayName="DateInput";function $w(e,t=[]){let r=[];function n(s,i){const l=g.createContext(i);l.displayName=s+"Context";const c=r.length;r=[...r,i];const d=m=>{var p;const{scope:f,children:v,...h}=m,x=((p=f==null?void 0:f[e])==null?void 0:p[c])||l,b=g.useMemo(()=>h,Object.values(h));return o.jsx(x.Provider,{value:b,children:v})};d.displayName=s+"Provider";function u(m,p){var f;const v=((f=p==null?void 0:p[e])==null?void 0:f[c])||l,h=g.useContext(v);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[d,u]}const a=()=>{const s=r.map(i=>g.createContext(i));return function(i){const l=(i==null?void 0:i[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return a.scopeName=e,[n,Ew(a,...t)]}function Ew(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(a){const s=n.reduce((i,{useScope:l,scopeName:c})=>{const d=l(a)[`__scope${c}`];return{...i,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var Ki="Progress",Yi=100,[Tw]=$w(Ki),[Aw,Dw]=Tw(Ki),qp=g.forwardRef((e,t)=>{const{__scopeProgress:r,value:n=null,max:a,getValueLabel:s=Rw,...i}=e;(a||a===0)&&!Tc(a)&&console.error(Pw(`${a}`,"Progress"));const l=Tc(a)?a:Yi;n!==null&&!Ac(n,l)&&console.error(_w(`${n}`,"Progress"));const c=Ac(n,l)?n:null,d=Ua(c)?s(c,l):void 0;return o.jsx(Aw,{scope:r,value:c,max:l,children:o.jsx(lo.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Ua(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":Zp(c,l),"data-value":c??void 0,"data-max":l,...i,ref:t})})});qp.displayName=Ki;var Gp="ProgressIndicator",Xp=g.forwardRef((e,t)=>{const{__scopeProgress:r,...n}=e,a=Dw(Gp,r);return o.jsx(lo.div,{"data-state":Zp(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:t})});Xp.displayName=Gp;function Rw(e,t){return`${Math.round(e/t*100)}%`}function Zp(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Ua(e){return typeof e=="number"}function Tc(e){return Ua(e)&&!isNaN(e)&&e>0}function Ac(e,t){return Ua(e)&&!isNaN(e)&&e<=t&&e>=0}function Pw(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Yi}\`.`}function _w(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
70
+ `)},A0=0,un=[];function D0(e){var t=g.useRef([]),r=g.useRef([0,0]),n=g.useRef(),a=g.useState(A0++)[0],s=g.useState(Xm)[0],i=g.useRef(e);g.useEffect(function(){i.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var h=Jy([e.lockRef.current],(e.shards||[]).map(Rc)).filter(Boolean);return h.forEach(function(x){return x.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),h.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=g.useCallback(function(h,x){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var y=Sa(h),b=r.current,k="deltaX"in h?h.deltaX:b[0]-y[0],w="deltaY"in h?h.deltaY:b[1]-y[1],N,S=h.target,A=Math.abs(k)>Math.abs(w)?"h":"v";if("touches"in h&&A==="h"&&S.type==="range")return!1;var C=window.getSelection(),E=C&&C.anchorNode,$=E?E===S||E.contains(S):!1;if($)return!1;var I=Ac(A,S);if(!I)return!0;if(I?N=A:(N=A==="v"?"h":"v",I=Ac(A,S)),!I)return!1;if(!n.current&&"changedTouches"in h&&(k||w)&&(n.current=N),!N)return!0;var L=n.current||N;return $0(L,x,h,L==="h"?k:w)},[]),c=g.useCallback(function(h){var x=h;if(!(!un.length||un[un.length-1]!==s)){var y="deltaY"in x?Dc(x):Sa(x),b=t.current.filter(function(N){return N.name===x.type&&(N.target===x.target||x.target===N.shadowParent)&&E0(N.delta,y)})[0];if(b&&b.should){x.cancelable&&x.preventDefault();return}if(!b){var k=(i.current.shards||[]).map(Rc).filter(Boolean).filter(function(N){return N.contains(x.target)}),w=k.length>0?l(x,k[0]):!i.current.noIsolation;w&&x.cancelable&&x.preventDefault()}}},[]),d=g.useCallback(function(h,x,y,b){var k={name:h,delta:x,target:y,should:b,shadowParent:R0(y)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(w){return w!==k})},1)},[]),u=g.useCallback(function(h){r.current=Sa(h),n.current=void 0},[]),m=g.useCallback(function(h){d(h.type,Dc(h),h.target,l(h,e.lockRef.current))},[]),p=g.useCallback(function(h){d(h.type,Sa(h),h.target,l(h,e.lockRef.current))},[]);g.useEffect(function(){return un.push(s),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:p}),document.addEventListener("wheel",c,dn),document.addEventListener("touchmove",c,dn),document.addEventListener("touchstart",u,dn),function(){un=un.filter(function(h){return h!==s}),document.removeEventListener("wheel",c,dn),document.removeEventListener("touchmove",c,dn),document.removeEventListener("touchstart",u,dn)}},[]);var f=e.removeScrollBar,v=e.inert;return g.createElement(g.Fragment,null,v?g.createElement(s,{styles:T0(a)}):null,f?g.createElement(y0,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function R0(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const P0=i0(Gm,D0);var jo=g.forwardRef(function(e,t){return g.createElement(ko,sr({},e,{ref:t,sideCar:P0}))});jo.classNames=ko.classNames;var _0=[" ","Enter","ArrowUp","ArrowDown"],I0=[" ","Enter"],en="Select",[Co,No,O0]=_i(en),[In]=_t(en,[O0,_n]),So=_n(),[F0,zr]=In(en),[L0,z0]=In(en),Jm=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:a,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:d,name:u,autoComplete:m,disabled:p,required:f,form:v}=e,h=So(t),[x,y]=g.useState(null),[b,k]=g.useState(null),[w,N]=g.useState(!1),S=sa(d),[A,C]=cr({prop:n,defaultProp:a??!1,onChange:s,caller:en}),[E,$]=cr({prop:i,defaultProp:l,onChange:c,caller:en}),I=g.useRef(null),L=x?v||!!x.closest("form"):!0,[D,z]=g.useState(new Set),H=Array.from(D).map(U=>U.props.value).join(";");return o.jsx(Xi,{...h,children:o.jsxs(F0,{required:f,scope:t,trigger:x,onTriggerChange:y,valueNode:b,onValueNodeChange:k,valueNodeHasChildren:w,onValueNodeHasChildrenChange:N,contentId:yr(),value:E,onValueChange:$,open:A,onOpenChange:C,dir:S,triggerPointerDownPosRef:I,disabled:p,children:[o.jsx(Co.Provider,{scope:t,children:o.jsx(L0,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(U=>{z(Z=>new Set(Z).add(U))},[]),onNativeOptionRemove:g.useCallback(U=>{z(Z=>{const V=new Set(Z);return V.delete(U),V})},[]),children:r})}),L?o.jsxs(kp,{"aria-hidden":!0,required:f,tabIndex:-1,name:u,autoComplete:m,value:E,onChange:U=>$(U.target.value),disabled:p,form:v,children:[E===void 0?o.jsx("option",{value:""}):null,Array.from(D)]},H):null]})})};Jm.displayName=en;var Qm="SelectTrigger",ep=g.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...a}=e,s=So(r),i=zr(Qm,r),l=i.disabled||n,c=je(t,i.onTriggerChange),d=No(r),u=g.useRef("touch"),[m,p,f]=Cp(h=>{const x=d().filter(k=>!k.disabled),y=x.find(k=>k.value===i.value),b=Np(x,h,y);b!==void 0&&i.onValueChange(b.value)}),v=h=>{l||(i.onOpenChange(!0),f()),h&&(i.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return o.jsx(yo,{asChild:!0,...s,children:o.jsx(we.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":jp(i.value)?"":void 0,...a,ref:c,onClick:xe(a.onClick,h=>{h.currentTarget.focus(),u.current!=="mouse"&&v(h)}),onPointerDown:xe(a.onPointerDown,h=>{u.current=h.pointerType;const x=h.target;x.hasPointerCapture(h.pointerId)&&x.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(v(h),h.preventDefault())}),onKeyDown:xe(a.onKeyDown,h=>{const x=m.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&p(h.key),!(x&&h.key===" ")&&_0.includes(h.key)&&(v(),h.preventDefault())})})})});ep.displayName=Qm;var tp="SelectValue",rp=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,children:s,placeholder:i="",...l}=e,c=zr(tp,r),{onValueNodeHasChildrenChange:d}=c,u=s!==void 0,m=je(t,c.onValueNodeChange);return lt(()=>{d(u)},[d,u]),o.jsx(we.span,{...l,ref:m,style:{pointerEvents:"none"},children:jp(c.value)?o.jsx(o.Fragment,{children:i}):s})});rp.displayName=tp;var M0="SelectIcon",np=g.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...a}=e;return o.jsx(we.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});np.displayName=M0;var V0="SelectPortal",ap=e=>o.jsx(wo,{asChild:!0,...e});ap.displayName=V0;var tn="SelectContent",op=g.forwardRef((e,t)=>{const r=zr(tn,e.__scopeSelect),[n,a]=g.useState();if(lt(()=>{a(new DocumentFragment)},[]),!r.open){const s=n;return s?so.createPortal(o.jsx(sp,{scope:e.__scopeSelect,children:o.jsx(Co.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),s):null}return o.jsx(ip,{...e,ref:t})});op.displayName=tn;var Wt=10,[sp,Mr]=In(tn),B0="SelectContentImpl",U0=Cn("SelectContent.RemoveScroll"),ip=g.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:m,collisionBoundary:p,collisionPadding:f,sticky:v,hideWhenDetached:h,avoidCollisions:x,...y}=e,b=zr(tn,r),[k,w]=g.useState(null),[N,S]=g.useState(null),A=je(t,X=>w(X)),[C,E]=g.useState(null),[$,I]=g.useState(null),L=No(r),[D,z]=g.useState(!1),H=g.useRef(!1);g.useEffect(()=>{if(k)return Yi(k)},[k]),zi();const U=g.useCallback(X=>{const[re,...K]=L().map(se=>se.ref.current),[J]=K.slice(-1),ce=document.activeElement;for(const se of X)if(se===ce||(se==null||se.scrollIntoView({block:"nearest"}),se===re&&N&&(N.scrollTop=0),se===J&&N&&(N.scrollTop=N.scrollHeight),se==null||se.focus(),document.activeElement!==ce))return},[L,N]),Z=g.useCallback(()=>U([C,k]),[U,C,k]);g.useEffect(()=>{D&&Z()},[D,Z]);const{onOpenChange:V,triggerPointerDownPosRef:M}=b;g.useEffect(()=>{if(k){let X={x:0,y:0};const re=J=>{var ce,se;X={x:Math.abs(Math.round(J.pageX)-(((ce=M.current)==null?void 0:ce.x)??0)),y:Math.abs(Math.round(J.pageY)-(((se=M.current)==null?void 0:se.y)??0))}},K=J=>{X.x<=10&&X.y<=10?J.preventDefault():k.contains(J.target)||V(!1),document.removeEventListener("pointermove",re),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",re),document.addEventListener("pointerup",K,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",re),document.removeEventListener("pointerup",K,{capture:!0})}}},[k,V,M]),g.useEffect(()=>{const X=()=>V(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[V]);const[R,oe]=Cp(X=>{const re=L().filter(ce=>!ce.disabled),K=re.find(ce=>ce.ref.current===document.activeElement),J=Np(re,X,K);J&&setTimeout(()=>J.ref.current.focus())}),ge=g.useCallback((X,re,K)=>{const J=!H.current&&!K;(b.value!==void 0&&b.value===re||J)&&(E(X),J&&(H.current=!0))},[b.value]),q=g.useCallback(()=>k==null?void 0:k.focus(),[k]),G=g.useCallback((X,re,K)=>{const J=!H.current&&!K;(b.value!==void 0&&b.value===re||J)&&I(X)},[b.value]),ne=n==="popper"?Ys:lp,W=ne===Ys?{side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:m,collisionBoundary:p,collisionPadding:f,sticky:v,hideWhenDetached:h,avoidCollisions:x}:{};return o.jsx(sp,{scope:r,content:k,viewport:N,onViewportChange:S,itemRefCallback:ge,selectedItem:C,onItemLeave:q,itemTextRefCallback:G,focusSelectedItem:Z,selectedItemText:$,position:n,isPositioned:D,searchRef:R,children:o.jsx(jo,{as:U0,allowPinchZoom:!0,children:o.jsx(ho,{asChild:!0,trapped:b.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:xe(a,X=>{var re;(re=b.trigger)==null||re.focus({preventScroll:!0}),X.preventDefault()}),children:o.jsx(la,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:o.jsx(ne,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:X=>X.preventDefault(),...y,...W,onPlaced:()=>z(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:xe(y.onKeyDown,X=>{const re=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!re&&X.key.length===1&&oe(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let K=L().filter(J=>!J.disabled).map(J=>J.ref.current);if(["ArrowUp","End"].includes(X.key)&&(K=K.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const J=X.target,ce=K.indexOf(J);K=K.slice(ce+1)}setTimeout(()=>U(K)),X.preventDefault()}})})})})})})});ip.displayName=B0;var H0="SelectItemAlignedPosition",lp=g.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...a}=e,s=zr(tn,r),i=Mr(tn,r),[l,c]=g.useState(null),[d,u]=g.useState(null),m=je(t,A=>u(A)),p=No(r),f=g.useRef(!1),v=g.useRef(!0),{viewport:h,selectedItem:x,selectedItemText:y,focusSelectedItem:b}=i,k=g.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&h&&x&&y){const A=s.trigger.getBoundingClientRect(),C=d.getBoundingClientRect(),E=s.valueNode.getBoundingClientRect(),$=y.getBoundingClientRect();if(s.dir!=="rtl"){const J=$.left-C.left,ce=E.left-J,se=A.left-ce,ye=A.width+se,be=Math.max(ye,C.width),Fe=window.innerWidth-Wt,Le=Jn(ce,[Wt,Math.max(Wt,Fe-be)]);l.style.minWidth=ye+"px",l.style.left=Le+"px"}else{const J=C.right-$.right,ce=window.innerWidth-E.right-J,se=window.innerWidth-A.right-ce,ye=A.width+se,be=Math.max(ye,C.width),Fe=window.innerWidth-Wt,Le=Jn(ce,[Wt,Math.max(Wt,Fe-be)]);l.style.minWidth=ye+"px",l.style.right=Le+"px"}const I=p(),L=window.innerHeight-Wt*2,D=h.scrollHeight,z=window.getComputedStyle(d),H=parseInt(z.borderTopWidth,10),U=parseInt(z.paddingTop,10),Z=parseInt(z.borderBottomWidth,10),V=parseInt(z.paddingBottom,10),M=H+U+D+V+Z,R=Math.min(x.offsetHeight*5,M),oe=window.getComputedStyle(h),ge=parseInt(oe.paddingTop,10),q=parseInt(oe.paddingBottom,10),G=A.top+A.height/2-Wt,ne=L-G,W=x.offsetHeight/2,X=x.offsetTop+W,re=H+U+X,K=M-re;if(re<=G){const J=I.length>0&&x===I[I.length-1].ref.current;l.style.bottom="0px";const ce=d.clientHeight-h.offsetTop-h.offsetHeight,se=Math.max(ne,W+(J?q:0)+ce+Z),ye=re+se;l.style.height=ye+"px"}else{const J=I.length>0&&x===I[0].ref.current;l.style.top="0px";const ce=Math.max(G,H+h.offsetTop+(J?ge:0)+W)+K;l.style.height=ce+"px",h.scrollTop=re-G+h.offsetTop}l.style.margin=`${Wt}px 0`,l.style.minHeight=R+"px",l.style.maxHeight=L+"px",n==null||n(),requestAnimationFrame(()=>f.current=!0)}},[p,s.trigger,s.valueNode,l,d,h,x,y,s.dir,n]);lt(()=>k(),[k]);const[w,N]=g.useState();lt(()=>{d&&N(window.getComputedStyle(d).zIndex)},[d]);const S=g.useCallback(A=>{A&&v.current===!0&&(k(),b==null||b(),v.current=!1)},[k,b]);return o.jsx(q0,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:f,onScrollButtonChange:S,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:o.jsx(we.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});lp.displayName=H0;var W0="SelectPopperPosition",Ys=g.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:a=Wt,...s}=e,i=So(r);return o.jsx(Zi,{...i,...s,ref:t,align:n,collisionPadding:a,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)"}})});Ys.displayName=W0;var[q0,Ji]=In(tn,{}),Js="SelectViewport",cp=g.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...a}=e,s=Mr(Js,r),i=Ji(Js,r),l=je(t,s.onViewportChange),c=g.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),o.jsx(Co.Slot,{scope:r,children:o.jsx(we.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:xe(a.onScroll,d=>{const u=d.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:p}=i;if(p!=null&&p.current&&m){const f=Math.abs(c.current-u.scrollTop);if(f>0){const v=window.innerHeight-Wt*2,h=parseFloat(m.style.minHeight),x=parseFloat(m.style.height),y=Math.max(h,x);if(y<v){const b=y+f,k=Math.min(v,b),w=b-k;m.style.height=k+"px",m.style.bottom==="0px"&&(u.scrollTop=w>0?w:0,m.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});cp.displayName=Js;var dp="SelectGroup",[G0,X0]=In(dp),Z0=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=yr();return o.jsx(G0,{scope:r,id:a,children:o.jsx(we.div,{role:"group","aria-labelledby":a,...n,ref:t})})});Z0.displayName=dp;var up="SelectLabel",mp=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=X0(up,r);return o.jsx(we.div,{id:a.id,...n,ref:t})});mp.displayName=up;var Ha="SelectItem",[K0,pp]=In(Ha),fp=g.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:a=!1,textValue:s,...i}=e,l=zr(Ha,r),c=Mr(Ha,r),d=l.value===n,[u,m]=g.useState(s??""),[p,f]=g.useState(!1),v=je(t,b=>{var k;return(k=c.itemRefCallback)==null?void 0:k.call(c,b,n,a)}),h=yr(),x=g.useRef("touch"),y=()=>{a||(l.onValueChange(n),l.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(K0,{scope:r,value:n,disabled:a,textId:h,isSelected:d,onItemTextChange:g.useCallback(b=>{m(k=>k||((b==null?void 0:b.textContent)??"").trim())},[]),children:o.jsx(Co.ItemSlot,{scope:r,value:n,disabled:a,textValue:u,children:o.jsx(we.div,{role:"option","aria-labelledby":h,"data-highlighted":p?"":void 0,"aria-selected":d&&p,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...i,ref:v,onFocus:xe(i.onFocus,()=>f(!0)),onBlur:xe(i.onBlur,()=>f(!1)),onClick:xe(i.onClick,()=>{x.current!=="mouse"&&y()}),onPointerUp:xe(i.onPointerUp,()=>{x.current==="mouse"&&y()}),onPointerDown:xe(i.onPointerDown,b=>{x.current=b.pointerType}),onPointerMove:xe(i.onPointerMove,b=>{var k;x.current=b.pointerType,a?(k=c.onItemLeave)==null||k.call(c):x.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:xe(i.onPointerLeave,b=>{var k;b.currentTarget===document.activeElement&&((k=c.onItemLeave)==null||k.call(c))}),onKeyDown:xe(i.onKeyDown,b=>{var k;((k=c.searchRef)==null?void 0:k.current)!==""&&b.key===" "||(I0.includes(b.key)&&y(),b.key===" "&&b.preventDefault())})})})})});fp.displayName=Ha;var qn="SelectItemText",hp=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:a,...s}=e,i=zr(qn,r),l=Mr(qn,r),c=pp(qn,r),d=z0(qn,r),[u,m]=g.useState(null),p=je(t,y=>m(y),c.onItemTextChange,y=>{var b;return(b=l.itemTextRefCallback)==null?void 0:b.call(l,y,c.value,c.disabled)}),f=u==null?void 0:u.textContent,v=g.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:f},c.value),[c.disabled,c.value,f]),{onNativeOptionAdd:h,onNativeOptionRemove:x}=d;return lt(()=>(h(v),()=>x(v)),[h,x,v]),o.jsxs(o.Fragment,{children:[o.jsx(we.span,{id:c.textId,...s,ref:p}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?so.createPortal(s.children,i.valueNode):null]})});hp.displayName=qn;var xp="SelectItemIndicator",gp=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return pp(xp,r).isSelected?o.jsx(we.span,{"aria-hidden":!0,...n,ref:t}):null});gp.displayName=xp;var Qs="SelectScrollUpButton",vp=g.forwardRef((e,t)=>{const r=Mr(Qs,e.__scopeSelect),n=Ji(Qs,e.__scopeSelect),[a,s]=g.useState(!1),i=je(t,n.onScrollButtonChange);return lt(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollTop>0;s(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),a?o.jsx(yp,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});vp.displayName=Qs;var ei="SelectScrollDownButton",bp=g.forwardRef((e,t)=>{const r=Mr(ei,e.__scopeSelect),n=Ji(ei,e.__scopeSelect),[a,s]=g.useState(!1),i=je(t,n.onScrollButtonChange);return lt(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<d;s(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),a?o.jsx(yp,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});bp.displayName=ei;var yp=g.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...a}=e,s=Mr("SelectScrollButton",r),i=g.useRef(null),l=No(r),c=g.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return g.useEffect(()=>()=>c(),[c]),lt(()=>{var d;const u=l().find(m=>m.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),o.jsx(we.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:xe(a.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:xe(a.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:xe(a.onPointerLeave,()=>{c()})})}),Y0="SelectSeparator",wp=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return o.jsx(we.div,{"aria-hidden":!0,...n,ref:t})});wp.displayName=Y0;var ti="SelectArrow",J0=g.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,a=So(r),s=zr(ti,r),i=Mr(ti,r);return s.open&&i.position==="popper"?o.jsx(Ki,{...a,...n,ref:t}):null});J0.displayName=ti;var Q0="SelectBubbleInput",kp=g.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const a=g.useRef(null),s=je(n,a),i=aa(t);return g.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const u=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(we.select,{...r,style:{...Bm,...r.style},ref:s,defaultValue:t})});kp.displayName=Q0;function jp(e){return e===""||e===void 0}function Cp(e){const t=pt(e),r=g.useRef(""),n=g.useRef(0),a=g.useCallback(i=>{const l=r.current+i;t(l),function c(d){r.current=d,window.clearTimeout(n.current),d!==""&&(n.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),s=g.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,a,s]}function Np(e,t,r){const n=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let s=ew(e,Math.max(a,0));n.length===1&&(s=s.filter(l=>l!==r));const i=s.find(l=>l.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==r?i:void 0}function ew(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var tw=Jm,Sp=ep,rw=rp,nw=np,aw=ap,$p=op,ow=cp,Ep=mp,Tp=fp,sw=hp,iw=gp,Ap=vp,Dp=bp,Rp=wp;const Vt=tw,Bt=rw,Dt=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Sp,{ref:n,className:Y("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,o.jsx(nw,{asChild:!0,children:o.jsx(O.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));Dt.displayName=Sp.displayName;const Pp=g.forwardRef(({className:e,...t},r)=>o.jsx(Ap,{ref:r,className:Y("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(O.ChevronUp,{className:"h-4 w-4"})}));Pp.displayName=Ap.displayName;const _p=g.forwardRef(({className:e,...t},r)=>o.jsx(Dp,{ref:r,className:Y("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(O.ChevronDown,{className:"h-4 w-4"})}));_p.displayName=Dp.displayName;const Rt=g.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>o.jsx(aw,{children:o.jsxs($p,{ref:a,className:Y("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,...n,children:[o.jsx(Pp,{}),o.jsx(ow,{className:Y("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(_p,{})]})}));Rt.displayName=$p.displayName;const lw=g.forwardRef(({className:e,...t},r)=>o.jsx(Ep,{ref:r,className:Y("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));lw.displayName=Ep.displayName;const Xe=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Tp,{ref:n,className:Y("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(iw,{children:o.jsx(O.Check,{className:"h-4 w-4"})})}),o.jsx(sw,{children:t})]}));Xe.displayName=Tp.displayName;const cw=g.forwardRef(({className:e,...t},r)=>o.jsx(Rp,{ref:r,className:Y("-mx-1 my-1 h-px bg-muted",e),...t}));cw.displayName=Rp.displayName;var Ip=["PageUp","PageDown"],Op=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Fp={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},On="Slider",[ri,dw,uw]=_i(On),[Lp]=_t(On,[uw]),[mw,$o]=Lp(On),zp=g.forwardRef((e,t)=>{const{name:r,min:n=0,max:a=100,step:s=1,orientation:i="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[n],value:u,onValueChange:m=()=>{},onValueCommit:p=()=>{},inverted:f=!1,form:v,...h}=e,x=g.useRef(new Set),y=g.useRef(0),b=i==="horizontal"?pw:fw,[k=[],w]=cr({prop:u,defaultProp:d,onChange:$=>{var I;(I=[...x.current][y.current])==null||I.focus(),m($)}}),N=g.useRef(k);function S($){const I=bw(k,$);E($,I)}function A($){E($,y.current)}function C(){const $=N.current[y.current];k[y.current]!==$&&p(k)}function E($,I,{commit:L}={commit:!1}){const D=jw(s),z=Cw(Math.round(($-n)/s)*s+n,D),H=Jn(z,[n,a]);w((U=[])=>{const Z=gw(U,H,I);if(kw(Z,c*s)){y.current=Z.indexOf(H);const V=String(Z)!==String(U);return V&&L&&p(Z),V?Z:U}else return U})}return o.jsx(mw,{scope:e.__scopeSlider,name:r,disabled:l,min:n,max:a,valueIndexToChangeRef:y,thumbs:x.current,values:k,orientation:i,form:v,children:o.jsx(ri.Provider,{scope:e.__scopeSlider,children:o.jsx(ri.Slot,{scope:e.__scopeSlider,children:o.jsx(b,{"aria-disabled":l,"data-disabled":l?"":void 0,...h,ref:t,onPointerDown:xe(h.onPointerDown,()=>{l||(N.current=k)}),min:n,max:a,inverted:f,onSlideStart:l?void 0:S,onSlideMove:l?void 0:A,onSlideEnd:l?void 0:C,onHomeKeyDown:()=>!l&&E(n,0,{commit:!0}),onEndKeyDown:()=>!l&&E(a,k.length-1,{commit:!0}),onStepKeyDown:({event:$,direction:I})=>{if(!l){const L=Ip.includes($.key)||$.shiftKey&&Op.includes($.key)?10:1,D=y.current,z=k[D],H=s*L*I;E(z+H,D,{commit:!0})}}})})})})});zp.displayName=On;var[Mp,Vp]=Lp(On,{startEdge:"left",endEdge:"right",size:"width",direction:1}),pw=g.forwardRef((e,t)=>{const{min:r,max:n,dir:a,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...u}=e,[m,p]=g.useState(null),f=je(t,k=>p(k)),v=g.useRef(void 0),h=sa(a),x=h==="ltr",y=x&&!s||!x&&s;function b(k){const w=v.current||m.getBoundingClientRect(),N=[0,w.width],S=Qi(N,y?[r,n]:[n,r]);return v.current=w,S(k-w.left)}return o.jsx(Mp,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:o.jsx(Bp,{dir:h,"data-orientation":"horizontal",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:k=>{const w=b(k.clientX);i==null||i(w)},onSlideMove:k=>{const w=b(k.clientX);l==null||l(w)},onSlideEnd:()=>{v.current=void 0,c==null||c()},onStepKeyDown:k=>{const w=Fp[y?"from-left":"from-right"].includes(k.key);d==null||d({event:k,direction:w?-1:1})}})})}),fw=g.forwardRef((e,t)=>{const{min:r,max:n,inverted:a,onSlideStart:s,onSlideMove:i,onSlideEnd:l,onStepKeyDown:c,...d}=e,u=g.useRef(null),m=je(t,u),p=g.useRef(void 0),f=!a;function v(h){const x=p.current||u.current.getBoundingClientRect(),y=[0,x.height],b=Qi(y,f?[n,r]:[r,n]);return p.current=x,b(h-x.top)}return o.jsx(Mp,{scope:e.__scopeSlider,startEdge:f?"bottom":"top",endEdge:f?"top":"bottom",size:"height",direction:f?1:-1,children:o.jsx(Bp,{"data-orientation":"vertical",...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{const x=v(h.clientY);s==null||s(x)},onSlideMove:h=>{const x=v(h.clientY);i==null||i(x)},onSlideEnd:()=>{p.current=void 0,l==null||l()},onStepKeyDown:h=>{const x=Fp[f?"from-bottom":"from-top"].includes(h.key);c==null||c({event:h,direction:x?-1:1})}})})}),Bp=g.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:n,onSlideMove:a,onSlideEnd:s,onHomeKeyDown:i,onEndKeyDown:l,onStepKeyDown:c,...d}=e,u=$o(On,r);return o.jsx(we.span,{...d,ref:t,onKeyDown:xe(e.onKeyDown,m=>{m.key==="Home"?(i(m),m.preventDefault()):m.key==="End"?(l(m),m.preventDefault()):Ip.concat(Op).includes(m.key)&&(c(m),m.preventDefault())}),onPointerDown:xe(e.onPointerDown,m=>{const p=m.target;p.setPointerCapture(m.pointerId),m.preventDefault(),u.thumbs.has(p)?p.focus():n(m)}),onPointerMove:xe(e.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:xe(e.onPointerUp,m=>{const p=m.target;p.hasPointerCapture(m.pointerId)&&(p.releasePointerCapture(m.pointerId),s(m))})})}),Up="SliderTrack",Hp=g.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,a=$o(Up,r);return o.jsx(we.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...n,ref:t})});Hp.displayName=Up;var ni="SliderRange",Wp=g.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,a=$o(ni,r),s=Vp(ni,r),i=g.useRef(null),l=je(t,i),c=a.values.length,d=a.values.map(p=>Xp(p,a.min,a.max)),u=c>1?Math.min(...d):0,m=100-Math.max(...d);return o.jsx(we.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...n,ref:l,style:{...e.style,[s.startEdge]:u+"%",[s.endEdge]:m+"%"}})});Wp.displayName=ni;var ai="SliderThumb",qp=g.forwardRef((e,t)=>{const r=dw(e.__scopeSlider),[n,a]=g.useState(null),s=je(t,l=>a(l)),i=g.useMemo(()=>n?r().findIndex(l=>l.ref.current===n):-1,[r,n]);return o.jsx(hw,{...e,ref:s,index:i})}),hw=g.forwardRef((e,t)=>{const{__scopeSlider:r,index:n,name:a,...s}=e,i=$o(ai,r),l=Vp(ai,r),[c,d]=g.useState(null),u=je(t,b=>d(b)),m=c?i.form||!!c.closest("form"):!0,p=oa(c),f=i.values[n],v=f===void 0?0:Xp(f,i.min,i.max),h=vw(n,i.values.length),x=p==null?void 0:p[l.size],y=x?yw(x,v,l.direction):0;return g.useEffect(()=>{if(c)return i.thumbs.add(c),()=>{i.thumbs.delete(c)}},[c,i.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${v}% + ${y}px)`},children:[o.jsx(ri.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(we.span,{role:"slider","aria-label":e["aria-label"]||h,"aria-valuemin":i.min,"aria-valuenow":f,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...s,ref:u,style:f===void 0?{display:"none"}:e.style,onFocus:xe(e.onFocus,()=>{i.valueIndexToChangeRef.current=n})})}),m&&o.jsx(Gp,{name:a??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:f},n)]})});qp.displayName=ai;var xw="RadioBubbleInput",Gp=g.forwardRef(({__scopeSlider:e,value:t,...r},n)=>{const a=g.useRef(null),s=je(a,n),i=aa(t);return g.useEffect(()=>{const l=a.current;if(!l)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const u=new Event("input",{bubbles:!0});d.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(we.input,{style:{display:"none"},...r,ref:s,defaultValue:t})});Gp.displayName=xw;function gw(e=[],t,r){const n=[...e];return n[r]=t,n.sort((a,s)=>a-s)}function Xp(e,t,r){const n=100/(r-t)*(e-t);return Jn(n,[0,100])}function vw(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function bw(e,t){if(e.length===1)return 0;const r=e.map(a=>Math.abs(a-t)),n=Math.min(...r);return r.indexOf(n)}function yw(e,t,r){const n=e/2,a=Qi([0,50],[0,n]);return(n-a(t)*r)*r}function ww(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function kw(e,t){if(t>0){const r=ww(e);return Math.min(...r)>=t}return!0}function Qi(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function jw(e){return(String(e).split(".")[1]||"").length}function Cw(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var Zp=zp,Nw=Hp,Sw=Wp,$w=qp;const Eo=g.forwardRef(({className:e,...t},r)=>o.jsxs(Zp,{ref:r,className:Y("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(Nw,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:o.jsx(Sw,{className:"absolute h-full bg-primary"})}),o.jsx($w,{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"})]}));Eo.displayName=Zp.displayName;const Ew=g.forwardRef(({className:e,type:t="date",...r},n)=>o.jsx("input",{ref:n,type:t,className:Y("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}));Ew.displayName="DateInput";function Tw(e,t=[]){let r=[];function n(s,i){const l=g.createContext(i);l.displayName=s+"Context";const c=r.length;r=[...r,i];const d=m=>{var p;const{scope:f,children:v,...h}=m,x=((p=f==null?void 0:f[e])==null?void 0:p[c])||l,y=g.useMemo(()=>h,Object.values(h));return o.jsx(x.Provider,{value:y,children:v})};d.displayName=s+"Provider";function u(m,p){var f;const v=((f=p==null?void 0:p[e])==null?void 0:f[c])||l,h=g.useContext(v);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[d,u]}const a=()=>{const s=r.map(i=>g.createContext(i));return function(i){const l=(i==null?void 0:i[e])||s;return g.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return a.scopeName=e,[n,Aw(a,...t)]}function Aw(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(a){const s=n.reduce((i,{useScope:l,scopeName:c})=>{const d=l(a)[`__scope${c}`];return{...i,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var el="Progress",tl=100,[Dw]=Tw(el),[Rw,Pw]=Dw(el),Kp=g.forwardRef((e,t)=>{const{__scopeProgress:r,value:n=null,max:a,getValueLabel:s=_w,...i}=e;(a||a===0)&&!Pc(a)&&console.error(Iw(`${a}`,"Progress"));const l=Pc(a)?a:tl;n!==null&&!_c(n,l)&&console.error(Ow(`${n}`,"Progress"));const c=_c(n,l)?n:null,d=Wa(c)?s(c,l):void 0;return o.jsx(Rw,{scope:r,value:c,max:l,children:o.jsx(uo.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Wa(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":Qp(c,l),"data-value":c??void 0,"data-max":l,...i,ref:t})})});Kp.displayName=el;var Yp="ProgressIndicator",Jp=g.forwardRef((e,t)=>{const{__scopeProgress:r,...n}=e,a=Pw(Yp,r);return o.jsx(uo.div,{"data-state":Qp(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:t})});Jp.displayName=Yp;function _w(e,t){return`${Math.round(e/t*100)}%`}function Qp(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Wa(e){return typeof e=="number"}function Pc(e){return Wa(e)&&!isNaN(e)&&e>0}function _c(e,t){return Wa(e)&&!isNaN(e)&&e<=t&&e>=0}function Iw(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${tl}\`.`}function Ow(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
71
71
  - a positive number
72
- - less than the value passed to \`max\` (or ${Yi} if no \`max\` prop is set)
72
+ - less than the value passed to \`max\` (or ${tl} if no \`max\` prop is set)
73
73
  - \`null\` or \`undefined\` if the progress is indeterminate.
74
74
 
75
- Defaulting to \`null\`.`}var Kp=qp,Iw=Xp;const Ji=g.forwardRef(({className:e,value:t,...r},n)=>o.jsx(Kp,{ref:n,className:K("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...r,children:o.jsx(Iw,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Ji.displayName=Kp.displayName;const Ow=g.forwardRef(({value:e,onChange:t,uploadProgress:r,accept:n,disabled:a,multiple:s=!1,placeholder:i="Nenhum arquivo selecionado",className:l,buttonLabel:c="Selecionar arquivo"},d)=>{const u=g.useRef(null);g.useImperativeHandle(d,()=>u.current);const m=()=>{var h;a||(h=u.current)==null||h.click()},p=h=>{var x;const b=((x=h.target.files)==null?void 0:x[0])??null;t==null||t(b),h.target.value=""},f=h=>{h.stopPropagation(),t==null||t(null)},v=r!==void 0&&r>0&&r<100;return o.jsxs("div",{className:K("space-y-2",l),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Ae,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:a||v,className:"shrink-0 gap-1.5",children:[o.jsx(I.Upload,{className:"h-4 w-4"}),c]}),o.jsx("span",{className:"flex-1 truncate text-sm text-muted-foreground",children:e?e.name:i}),e&&!v&&o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",onClick:f,disabled:a,className:"h-7 w-7 shrink-0","aria-label":"Remover arquivo",children:o.jsx(I.X,{className:"h-4 w-4"})})]}),v&&o.jsx(Ji,{value:r,className:"h-1.5"}),o.jsx("input",{ref:u,type:"file",accept:n,multiple:s,disabled:a,onChange:p,className:"sr-only","aria-hidden":"true",tabIndex:-1})]})});Ow.displayName="FileInput";var $o="Dialog",[Yp]=_t($o),[Fw,Qt]=Yp($o),Jp=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:a,onOpenChange:s,modal:i=!0}=e,l=g.useRef(null),c=g.useRef(null),[d,u]=cr({prop:n,defaultProp:a??!1,onChange:s,caller:$o});return o.jsx(Fw,{scope:t,triggerRef:l,contentRef:c,contentId:yr(),titleId:yr(),descriptionId:yr(),open:d,onOpenChange:u,onOpenToggle:g.useCallback(()=>u(m=>!m),[u]),modal:i,children:r})};Jp.displayName=$o;var Qp="DialogTrigger",zw=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(Qp,r),s=ke(t,a.triggerRef);return o.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":tl(a.open),...n,ref:s,onClick:ge(e.onClick,a.onOpenToggle)})});zw.displayName=Qp;var Qi="DialogPortal",[Lw,ef]=Yp(Qi,{forceMount:void 0}),tf=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:a}=e,s=Qt(Qi,t);return o.jsx(Lw,{scope:t,forceMount:r,children:g.Children.map(n,i=>o.jsx(It,{present:r||s.open,children:o.jsx(bo,{asChild:!0,container:a,children:i})}))})};tf.displayName=Qi;var Ha="DialogOverlay",rf=g.forwardRef((e,t)=>{const r=ef(Ha,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,s=Qt(Ha,e.__scopeDialog);return s.modal?o.jsx(It,{present:n||s.open,children:o.jsx(Vw,{...a,ref:t})}):null});rf.displayName=Ha;var Mw=Cn("DialogOverlay.RemoveScroll"),Vw=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(Ha,r);return o.jsx(wo,{as:Mw,allowPinchZoom:!0,shards:[a.contentRef],children:o.jsx(we.div,{"data-state":tl(a.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),rn="DialogContent",nf=g.forwardRef((e,t)=>{const r=ef(rn,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,s=Qt(rn,e.__scopeDialog);return o.jsx(It,{present:n||s.open,children:s.modal?o.jsx(Bw,{...a,ref:t}):o.jsx(Uw,{...a,ref:t})})});nf.displayName=rn;var Bw=g.forwardRef((e,t)=>{const r=Qt(rn,e.__scopeDialog),n=g.useRef(null),a=ke(t,r.contentRef,n);return g.useEffect(()=>{const s=n.current;if(s)return Gi(s)},[]),o.jsx(af,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ge(e.onCloseAutoFocus,s=>{var i;s.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ge(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:ge(e.onFocusOutside,s=>s.preventDefault())})}),Uw=g.forwardRef((e,t)=>{const r=Qt(rn,e.__scopeDialog),n=g.useRef(!1),a=g.useRef(!1);return o.jsx(af,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:s=>{var i,l;(i=e.onInteractOutside)==null||i.call(e,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=s.target;(l=r.triggerRef.current)!=null&&l.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),af=g.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,...i}=e,l=Qt(rn,r),c=g.useRef(null),d=ke(t,c);return Ii(),o.jsxs(o.Fragment,{children:[o.jsx(po,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:o.jsx(ia,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":tl(l.open),...i,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(Hw,{titleId:l.titleId}),o.jsx(qw,{contentRef:c,descriptionId:l.descriptionId})]})]})}),el="DialogTitle",of=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(el,r);return o.jsx(we.h2,{id:a.titleId,...n,ref:t})});of.displayName=el;var sf="DialogDescription",lf=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(sf,r);return o.jsx(we.p,{id:a.descriptionId,...n,ref:t})});lf.displayName=sf;var cf="DialogClose",df=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(cf,r);return o.jsx(we.button,{type:"button",...n,ref:t,onClick:ge(e.onClick,()=>a.onOpenChange(!1))})});df.displayName=cf;function tl(e){return e?"open":"closed"}var uf="DialogTitleWarning",[e$,mf]=jv(uf,{contentName:rn,titleName:el,docsSlug:"dialog"}),Hw=({titleId:e})=>{const t=mf(uf),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
75
+ Defaulting to \`null\`.`}var ef=Kp,Fw=Jp;const rl=g.forwardRef(({className:e,value:t,...r},n)=>o.jsx(ef,{ref:n,className:Y("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...r,children:o.jsx(Fw,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));rl.displayName=ef.displayName;const Lw=g.forwardRef(({value:e,onChange:t,uploadProgress:r,accept:n,disabled:a,multiple:s=!1,placeholder:i="Nenhum arquivo selecionado",className:l,buttonLabel:c="Selecionar arquivo"},d)=>{const u=g.useRef(null);g.useImperativeHandle(d,()=>u.current);const m=()=>{var h;a||(h=u.current)==null||h.click()},p=h=>{var x;const y=((x=h.target.files)==null?void 0:x[0])??null;t==null||t(y),h.target.value=""},f=h=>{h.stopPropagation(),t==null||t(null)},v=r!==void 0&&r>0&&r<100;return o.jsxs("div",{className:Y("space-y-2",l),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Te,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:a||v,className:"shrink-0 gap-1.5",children:[o.jsx(O.Upload,{className:"h-4 w-4"}),c]}),o.jsx("span",{className:"flex-1 truncate text-sm text-muted-foreground",children:e?e.name:i}),e&&!v&&o.jsx(Te,{type:"button",variant:"ghost",size:"icon",onClick:f,disabled:a,className:"h-7 w-7 shrink-0","aria-label":"Remover arquivo",children:o.jsx(O.X,{className:"h-4 w-4"})})]}),v&&o.jsx(rl,{value:r,className:"h-1.5"}),o.jsx("input",{ref:u,type:"file",accept:n,multiple:s,disabled:a,onChange:p,className:"sr-only","aria-hidden":"true",tabIndex:-1})]})});Lw.displayName="FileInput";var To="Dialog",[tf]=_t(To),[zw,Qt]=tf(To),rf=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:a,onOpenChange:s,modal:i=!0}=e,l=g.useRef(null),c=g.useRef(null),[d,u]=cr({prop:n,defaultProp:a??!1,onChange:s,caller:To});return o.jsx(zw,{scope:t,triggerRef:l,contentRef:c,contentId:yr(),titleId:yr(),descriptionId:yr(),open:d,onOpenChange:u,onOpenToggle:g.useCallback(()=>u(m=>!m),[u]),modal:i,children:r})};rf.displayName=To;var nf="DialogTrigger",af=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(nf,r),s=je(t,a.triggerRef);return o.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":ol(a.open),...n,ref:s,onClick:xe(e.onClick,a.onOpenToggle)})});af.displayName=nf;var nl="DialogPortal",[Mw,of]=tf(nl,{forceMount:void 0}),sf=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:a}=e,s=Qt(nl,t);return o.jsx(Mw,{scope:t,forceMount:r,children:g.Children.map(n,i=>o.jsx(It,{present:r||s.open,children:o.jsx(wo,{asChild:!0,container:a,children:i})}))})};sf.displayName=nl;var qa="DialogOverlay",lf=g.forwardRef((e,t)=>{const r=of(qa,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,s=Qt(qa,e.__scopeDialog);return s.modal?o.jsx(It,{present:n||s.open,children:o.jsx(Bw,{...a,ref:t})}):null});lf.displayName=qa;var Vw=Cn("DialogOverlay.RemoveScroll"),Bw=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(qa,r);return o.jsx(jo,{as:Vw,allowPinchZoom:!0,shards:[a.contentRef],children:o.jsx(we.div,{"data-state":ol(a.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),rn="DialogContent",cf=g.forwardRef((e,t)=>{const r=of(rn,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,s=Qt(rn,e.__scopeDialog);return o.jsx(It,{present:n||s.open,children:s.modal?o.jsx(Uw,{...a,ref:t}):o.jsx(Hw,{...a,ref:t})})});cf.displayName=rn;var Uw=g.forwardRef((e,t)=>{const r=Qt(rn,e.__scopeDialog),n=g.useRef(null),a=je(t,r.contentRef,n);return g.useEffect(()=>{const s=n.current;if(s)return Yi(s)},[]),o.jsx(df,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xe(e.onCloseAutoFocus,s=>{var i;s.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:xe(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:xe(e.onFocusOutside,s=>s.preventDefault())})}),Hw=g.forwardRef((e,t)=>{const r=Qt(rn,e.__scopeDialog),n=g.useRef(!1),a=g.useRef(!1);return o.jsx(df,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:s=>{var i,l;(i=e.onInteractOutside)==null||i.call(e,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=s.target;(l=r.triggerRef.current)!=null&&l.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),df=g.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,...i}=e,l=Qt(rn,r),c=g.useRef(null),d=je(t,c);return zi(),o.jsxs(o.Fragment,{children:[o.jsx(ho,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:o.jsx(la,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":ol(l.open),...i,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(Ww,{titleId:l.titleId}),o.jsx(Gw,{contentRef:c,descriptionId:l.descriptionId})]})]})}),al="DialogTitle",uf=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(al,r);return o.jsx(we.h2,{id:a.titleId,...n,ref:t})});uf.displayName=al;var mf="DialogDescription",pf=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(mf,r);return o.jsx(we.p,{id:a.descriptionId,...n,ref:t})});pf.displayName=mf;var ff="DialogClose",hf=g.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=Qt(ff,r);return o.jsx(we.button,{type:"button",...n,ref:t,onClick:xe(e.onClick,()=>a.onOpenChange(!1))})});hf.displayName=ff;function ol(e){return e?"open":"closed"}var xf="DialogTitleWarning",[t$,gf]=Cv(xf,{contentName:rn,titleName:al,docsSlug:"dialog"}),Ww=({titleId:e})=>{const t=gf(xf),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 g.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Ww="DialogDescriptionWarning",qw=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${mf(Ww).contentName}}.`;return g.useEffect(()=>{var n;const a=(n=e.current)==null?void 0:n.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Gw=Jp,Xw=tf,pf=rf,ff=nf,hf=of,xf=lf,Zw=df;const Kw=Gw,Yw=Xw,gf=g.forwardRef(({className:e,...t},r)=>o.jsx(pf,{ref:r,className:K("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}));gf.displayName=pf.displayName;const vf=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Yw,{children:[o.jsx(gf,{}),o.jsxs(ff,{ref:n,className:K("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,o.jsxs(Zw,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(I.X,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));vf.displayName=ff.displayName;const bf=({className:e,...t})=>o.jsx("div",{className:K("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});bf.displayName="DialogHeader";const yf=g.forwardRef(({className:e,...t},r)=>o.jsx(hf,{ref:r,className:K("text-lg font-semibold leading-none tracking-tight",e),...t}));yf.displayName=hf.displayName;const wf=g.forwardRef(({className:e,...t},r)=>o.jsx(xf,{ref:r,className:K("text-sm text-muted-foreground",e),...t}));wf.displayName=xf.displayName;var Eo="Popover",[jf]=_t(Eo,[_n]),ca=_n(),[Jw,Vr]=jf(Eo),kf=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:a,onOpenChange:s,modal:i=!1}=e,l=ca(t),c=g.useRef(null),[d,u]=g.useState(!1),[m,p]=cr({prop:n,defaultProp:a??!1,onChange:s,caller:Eo});return o.jsx(Hi,{...l,children:o.jsx(Jw,{scope:t,contentId:yr(),triggerRef:c,open:m,onOpenChange:p,onOpenToggle:g.useCallback(()=>p(f=>!f),[p]),hasCustomAnchor:d,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:i,children:r})})};kf.displayName=Eo;var Cf="PopoverAnchor",Qw=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Vr(Cf,r),s=ca(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=a;return g.useEffect(()=>(i(),()=>l()),[i,l]),o.jsx(vo,{...s,...n,ref:t})});Qw.displayName=Cf;var Nf="PopoverTrigger",Sf=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Vr(Nf,r),s=ca(r),i=ke(t,a.triggerRef),l=o.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Df(a.open),...n,ref:i,onClick:ge(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?l:o.jsx(vo,{asChild:!0,...s,children:l})});Sf.displayName=Nf;var rl="PopoverPortal",[e1,t1]=jf(rl,{forceMount:void 0}),$f=e=>{const{__scopePopover:t,forceMount:r,children:n,container:a}=e,s=Vr(rl,t);return o.jsx(e1,{scope:t,forceMount:r,children:o.jsx(It,{present:r||s.open,children:o.jsx(bo,{asChild:!0,container:a,children:n})})})};$f.displayName=rl;var Sn="PopoverContent",Ef=g.forwardRef((e,t)=>{const r=t1(Sn,e.__scopePopover),{forceMount:n=r.forceMount,...a}=e,s=Vr(Sn,e.__scopePopover);return o.jsx(It,{present:n||s.open,children:s.modal?o.jsx(n1,{...a,ref:t}):o.jsx(a1,{...a,ref:t})})});Ef.displayName=Sn;var r1=Cn("PopoverContent.RemoveScroll"),n1=g.forwardRef((e,t)=>{const r=Vr(Sn,e.__scopePopover),n=g.useRef(null),a=ke(t,n),s=g.useRef(!1);return g.useEffect(()=>{const i=n.current;if(i)return Gi(i)},[]),o.jsx(wo,{as:r1,allowPinchZoom:!0,children:o.jsx(Tf,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ge(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),s.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ge(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:ge(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),a1=g.forwardRef((e,t)=>{const r=Vr(Sn,e.__scopePopover),n=g.useRef(!1),a=g.useRef(!1);return o.jsx(Tf,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:s=>{var i,l;(i=e.onInteractOutside)==null||i.call(e,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=s.target;(l=r.triggerRef.current)!=null&&l.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),Tf=g.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...m}=e,p=Vr(Sn,r),f=ca(r);return Ii(),o.jsx(po,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:o.jsx(ia,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:o.jsx(Wi,{"data-state":Df(p.open),role:"dialog",id:p.contentId,...f,...m,ref:t,style:{...m.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)"}})})})}),Af="PopoverClose",o1=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Vr(Af,r);return o.jsx(we.button,{type:"button",...n,ref:t,onClick:ge(e.onClick,()=>a.onOpenChange(!1))})});o1.displayName=Af;var s1="PopoverArrow",i1=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=ca(r);return o.jsx(qi,{...a,...n,ref:t})});i1.displayName=s1;function Df(e){return e?"open":"closed"}var l1=kf,c1=Sf,d1=$f,Rf=Ef;const To=l1,Ao=c1,da=g.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},a)=>o.jsx(d1,{children:o.jsx(Rf,{ref:a,align:t,sideOffset:r,className:K("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),...n})}));da.displayName=Rf.displayName;var[Do]=_t("Tooltip",[_n]),Ro=_n(),Pf="TooltipProvider",u1=700,ti="tooltip.open",[m1,nl]=Do(Pf),_f=e=>{const{__scopeTooltip:t,delayDuration:r=u1,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:s}=e,i=g.useRef(!0),l=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),o.jsx(m1,{scope:t,isOpenDelayedRef:i,delayDuration:r,onOpen:g.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,n)},[n]),isPointerInTransitRef:l,onPointerInTransitChange:g.useCallback(d=>{l.current=d},[]),disableHoverableContent:a,children:s})};_f.displayName=Pf;var Qn="Tooltip",[p1,Po]=Do(Qn),If=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:a,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=nl(Qn,e.__scopeTooltip),d=Ro(t),[u,m]=g.useState(null),p=yr(),f=g.useRef(0),v=i??c.disableHoverableContent,h=l??c.delayDuration,x=g.useRef(!1),[b,y]=cr({prop:n,defaultProp:a??!1,onChange:$=>{$?(c.onOpen(),document.dispatchEvent(new CustomEvent(ti))):c.onClose(),s==null||s($)},caller:Qn}),j=g.useMemo(()=>b?x.current?"delayed-open":"instant-open":"closed",[b]),w=g.useCallback(()=>{window.clearTimeout(f.current),f.current=0,x.current=!1,y(!0)},[y]),C=g.useCallback(()=>{window.clearTimeout(f.current),f.current=0,y(!1)},[y]),S=g.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{x.current=!0,y(!0),f.current=0},h)},[h,y]);return g.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),o.jsx(Hi,{...d,children:o.jsx(p1,{scope:t,contentId:p,open:b,stateAttribute:j,trigger:u,onTriggerChange:m,onTriggerEnter:g.useCallback(()=>{c.isOpenDelayedRef.current?S():w()},[c.isOpenDelayedRef,S,w]),onTriggerLeave:g.useCallback(()=>{v?C():(window.clearTimeout(f.current),f.current=0)},[C,v]),onOpen:w,onClose:C,disableHoverableContent:v,children:r})})};If.displayName=Qn;var ri="TooltipTrigger",Of=g.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=Po(ri,r),s=nl(ri,r),i=Ro(r),l=g.useRef(null),c=ke(t,l,a.onTriggerChange),d=g.useRef(!1),u=g.useRef(!1),m=g.useCallback(()=>d.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),o.jsx(vo,{asChild:!0,...i,children:o.jsx(we.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:c,onPointerMove:ge(e.onPointerMove,p=>{p.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:ge(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:ge(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:ge(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:ge(e.onBlur,a.onClose),onClick:ge(e.onClick,a.onClose)})})});Of.displayName=ri;var f1="TooltipPortal",[t$,h1]=Do(f1,{forceMount:void 0}),$n="TooltipContent",Ff=g.forwardRef((e,t)=>{const r=h1($n,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...s}=e,i=Po($n,e.__scopeTooltip);return o.jsx(It,{present:n||i.open,children:i.disableHoverableContent?o.jsx(zf,{side:a,...s,ref:t}):o.jsx(x1,{side:a,...s,ref:t})})}),x1=g.forwardRef((e,t)=>{const r=Po($n,e.__scopeTooltip),n=nl($n,e.__scopeTooltip),a=g.useRef(null),s=ke(t,a),[i,l]=g.useState(null),{trigger:c,onClose:d}=r,u=a.current,{onPointerInTransitChange:m}=n,p=g.useCallback(()=>{l(null),m(!1)},[m]),f=g.useCallback((v,h)=>{const x=v.currentTarget,b={x:v.clientX,y:v.clientY},y=w1(b,x.getBoundingClientRect()),j=j1(b,y),w=k1(h.getBoundingClientRect()),C=N1([...j,...w]);l(C),m(!0)},[m]);return g.useEffect(()=>()=>p(),[p]),g.useEffect(()=>{if(c&&u){const v=x=>f(x,u),h=x=>f(x,c);return c.addEventListener("pointerleave",v),u.addEventListener("pointerleave",h),()=>{c.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",h)}}},[c,u,f,p]),g.useEffect(()=>{if(i){const v=h=>{const x=h.target,b={x:h.clientX,y:h.clientY},y=(c==null?void 0:c.contains(x))||(u==null?void 0:u.contains(x)),j=!C1(b,i);y?p():j&&(p(),d())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,u,i,d,p]),o.jsx(zf,{...e,ref:s})}),[g1,v1]=Do(Qn,{isInside:!1}),b1=Dv("TooltipContent"),zf=g.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Po($n,r),d=Ro(r),{onClose:u}=c;return g.useEffect(()=>(document.addEventListener(ti,u),()=>document.removeEventListener(ti,u)),[u]),g.useEffect(()=>{if(c.trigger){const m=p=>{const f=p.target;f!=null&&f.contains(c.trigger)&&u()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[c.trigger,u]),o.jsx(ia,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:m=>m.preventDefault(),onDismiss:u,children:o.jsxs(Wi,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(b1,{children:n}),o.jsx(g1,{scope:r,isInside:!0,children:o.jsx(qy,{id:c.contentId,role:"tooltip",children:a||n})})]})})});Ff.displayName=$n;var Lf="TooltipArrow",y1=g.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=Ro(r);return v1(Lf,r).isInside?null:o.jsx(qi,{...a,...n,ref:t})});y1.displayName=Lf;function w1(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(r,n,a,s)){case s:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function j1(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function k1(e){const{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function C1(e,t){const{x:r,y:n}=e;let a=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],d=l.x,u=l.y,m=c.x,p=c.y;u>n!=p>n&&r<(m-d)*(n-u)/(p-u)+d&&(a=!a)}return a}function N1(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),S1(t)}function S1(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const a=e[n];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(a.y-i.y)>=(s.y-i.y)*(a.x-i.x))t.pop();else break}t.push(a)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const a=e[n];for(;r.length>=2;){const s=r[r.length-1],i=r[r.length-2];if((s.x-i.x)*(a.y-i.y)>=(s.y-i.y)*(a.x-i.x))r.pop();else break}r.push(a)}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 $1=_f,E1=If,T1=Of,Mf=Ff;const A1=$1,Vf=E1,Bf=T1,al=g.forwardRef(({className:e,sideOffset:t=4,...r},n)=>o.jsx(Mf,{ref:n,sideOffset:t,className:K("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}));al.displayName=Mf.displayName;function D1(e,t){return g.useReducer((r,n)=>t[r][n]??r,e)}var ol="ScrollArea",[Uf]=_t(ol),[R1,Ht]=Uf(ol),Hf=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:s=600,...i}=e,[l,c]=g.useState(null),[d,u]=g.useState(null),[m,p]=g.useState(null),[f,v]=g.useState(null),[h,x]=g.useState(null),[b,y]=g.useState(0),[j,w]=g.useState(0),[C,S]=g.useState(!1),[$,k]=g.useState(!1),E=ke(t,O=>c(O)),T=oa(a);return o.jsx(R1,{scope:r,type:n,dir:T,scrollHideDelay:s,scrollArea:l,viewport:d,onViewportChange:u,content:m,onContentChange:p,scrollbarX:f,onScrollbarXChange:v,scrollbarXEnabled:C,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:x,scrollbarYEnabled:$,onScrollbarYEnabledChange:k,onCornerWidthChange:y,onCornerHeightChange:w,children:o.jsx(we.div,{dir:T,...i,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":j+"px",...e.style}})})});Hf.displayName=ol;var Wf="ScrollAreaViewport",qf=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:a,...s}=e,i=Ht(Wf,r),l=g.useRef(null),c=ke(t,l,i.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),o.jsx(we.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:o.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});qf.displayName=Wf;var pr="ScrollAreaScrollbar",sl=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Ht(pr,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=a,l=e.orientation==="horizontal";return g.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),a.type==="hover"?o.jsx(P1,{...n,ref:t,forceMount:r}):a.type==="scroll"?o.jsx(_1,{...n,ref:t,forceMount:r}):a.type==="auto"?o.jsx(Gf,{...n,ref:t,forceMount:r}):a.type==="always"?o.jsx(il,{...n,ref:t}):null});sl.displayName=pr;var P1=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Ht(pr,e.__scopeScrollArea),[s,i]=g.useState(!1);return g.useEffect(()=>{const l=a.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),i(!0)},u=()=>{c=window.setTimeout(()=>i(!1),a.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",u),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",u)}}},[a.scrollArea,a.scrollHideDelay]),o.jsx(It,{present:r||s,children:o.jsx(Gf,{"data-state":s?"visible":"hidden",...n,ref:t})})}),_1=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Ht(pr,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Io(()=>c("SCROLL_END"),100),[l,c]=D1("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 g.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,a.scrollHideDelay,c]),g.useEffect(()=>{const d=a.viewport,u=s?"scrollLeft":"scrollTop";if(d){let m=d[u];const p=()=>{const f=d[u];m!==f&&(c("SCROLL"),i()),m=f};return d.addEventListener("scroll",p),()=>d.removeEventListener("scroll",p)}},[a.viewport,s,c,i]),o.jsx(It,{present:r||l!=="hidden",children:o.jsx(il,{"data-state":l==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:ge(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ge(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Gf=g.forwardRef((e,t)=>{const r=Ht(pr,e.__scopeScrollArea),{forceMount:n,...a}=e,[s,i]=g.useState(!1),l=e.orientation==="horizontal",c=Io(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;i(l?d:u)}},10);return En(r.viewport,c),En(r.content,c),o.jsx(It,{present:n||s,children:o.jsx(il,{"data-state":s?"visible":"hidden",...a,ref:t})})}),il=g.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,a=Ht(pr,e.__scopeScrollArea),s=g.useRef(null),i=g.useRef(0),[l,c]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Jf(l.viewport,l.content),u={...n,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:p=>i.current=p};function m(p,f){return M1(p,i.current,l,f)}return r==="horizontal"?o.jsx(I1,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&s.current){const p=a.viewport.scrollLeft,f=Dc(p,l,a.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:p=>{a.viewport&&(a.viewport.scrollLeft=p)},onDragScroll:p=>{a.viewport&&(a.viewport.scrollLeft=m(p,a.dir))}}):r==="vertical"?o.jsx(O1,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&s.current){const p=a.viewport.scrollTop,f=Dc(p,l);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:p=>{a.viewport&&(a.viewport.scrollTop=p)},onDragScroll:p=>{a.viewport&&(a.viewport.scrollTop=m(p))}}):null}),I1=g.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,s=Ht(pr,e.__scopeScrollArea),[i,l]=g.useState(),c=g.useRef(null),d=ke(t,c,s.onScrollbarXChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Zf,{"data-orientation":"horizontal",...a,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":_o(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,m)=>{if(s.viewport){const p=s.viewport.scrollLeft+u.deltaX;e.onWheelScroll(p),eh(p,m)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:qa(i.paddingLeft),paddingEnd:qa(i.paddingRight)}})}})}),O1=g.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,s=Ht(pr,e.__scopeScrollArea),[i,l]=g.useState(),c=g.useRef(null),d=ke(t,c,s.onScrollbarYChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Zf,{"data-orientation":"vertical",...a,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":_o(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,m)=>{if(s.viewport){const p=s.viewport.scrollTop+u.deltaY;e.onWheelScroll(p),eh(p,m)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:qa(i.paddingTop),paddingEnd:qa(i.paddingBottom)}})}})}),[F1,Xf]=Uf(pr),Zf=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:u,onResize:m,...p}=e,f=Ht(pr,r),[v,h]=g.useState(null),x=ke(t,E=>h(E)),b=g.useRef(null),y=g.useRef(""),j=f.viewport,w=n.content-n.viewport,C=ft(u),S=ft(c),$=Io(m,10);function k(E){if(b.current){const T=E.clientX-b.current.left,O=E.clientY-b.current.top;d({x:T,y:O})}}return g.useEffect(()=>{const E=T=>{const O=T.target;v!=null&&v.contains(O)&&C(T,w)};return document.addEventListener("wheel",E,{passive:!1}),()=>document.removeEventListener("wheel",E,{passive:!1})},[j,v,w,C]),g.useEffect(S,[n,S]),En(v,$),En(f.content,$),o.jsx(F1,{scope:r,scrollbar:v,hasThumb:a,onThumbChange:ft(s),onThumbPointerUp:ft(i),onThumbPositionChange:S,onThumbPointerDown:ft(l),children:o.jsx(we.div,{...p,ref:x,style:{position:"absolute",...p.style},onPointerDown:ge(e.onPointerDown,E=>{E.button===0&&(E.target.setPointerCapture(E.pointerId),b.current=v.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),k(E))}),onPointerMove:ge(e.onPointerMove,k),onPointerUp:ge(e.onPointerUp,E=>{const T=E.target;T.hasPointerCapture(E.pointerId)&&T.releasePointerCapture(E.pointerId),document.body.style.webkitUserSelect=y.current,f.viewport&&(f.viewport.style.scrollBehavior=""),b.current=null})})})}),Wa="ScrollAreaThumb",Kf=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Xf(Wa,e.__scopeScrollArea);return o.jsx(It,{present:r||a.hasThumb,children:o.jsx(z1,{ref:t,...n})})}),z1=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...a}=e,s=Ht(Wa,r),i=Xf(Wa,r),{onThumbPositionChange:l}=i,c=ke(t,m=>i.onThumbChange(m)),d=g.useRef(void 0),u=Io(()=>{d.current&&(d.current(),d.current=void 0)},100);return g.useEffect(()=>{const m=s.viewport;if(m){const p=()=>{if(u(),!d.current){const f=V1(m,l);d.current=f,l()}};return l(),m.addEventListener("scroll",p),()=>m.removeEventListener("scroll",p)}},[s.viewport,u,l]),o.jsx(we.div,{"data-state":i.hasThumb?"visible":"hidden",...a,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:ge(e.onPointerDownCapture,m=>{const p=m.target.getBoundingClientRect(),f=m.clientX-p.left,v=m.clientY-p.top;i.onThumbPointerDown({x:f,y:v})}),onPointerUp:ge(e.onPointerUp,i.onThumbPointerUp)})});Kf.displayName=Wa;var ll="ScrollAreaCorner",Yf=g.forwardRef((e,t)=>{const r=Ht(ll,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?o.jsx(L1,{...e,ref:t}):null});Yf.displayName=ll;var L1=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,a=Ht(ll,r),[s,i]=g.useState(0),[l,c]=g.useState(0),d=!!(s&&l);return En(a.scrollbarX,()=>{var u;const m=((u=a.scrollbarX)==null?void 0:u.offsetHeight)||0;a.onCornerHeightChange(m),c(m)}),En(a.scrollbarY,()=>{var u;const m=((u=a.scrollbarY)==null?void 0:u.offsetWidth)||0;a.onCornerWidthChange(m),i(m)}),d?o.jsx(we.div,{...n,ref:t,style:{width:s,height:l,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function qa(e){return e?parseInt(e,10):0}function Jf(e,t){const r=e/t;return isNaN(r)?0:r}function _o(e){const t=Jf(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function M1(e,t,r,n="ltr"){const a=_o(r),s=a/2,i=t||s,l=a-i,c=r.scrollbar.paddingStart+i,d=r.scrollbar.size-r.scrollbar.paddingEnd-l,u=r.content-r.viewport,m=n==="ltr"?[0,u]:[u*-1,0];return Qf([c,d],m)(e)}function Dc(e,t,r="ltr"){const n=_o(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-a,i=t.content-t.viewport,l=s-n,c=r==="ltr"?[0,i]:[i*-1,0],d=Yn(e,c);return Qf([0,i],[0,l])(d)}function Qf(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function eh(e,t){return e>0&&e<t}var V1=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const s={left:e.scrollLeft,top:e.scrollTop},i=r.left!==s.left,l=r.top!==s.top;(i||l)&&t(),r=s,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function Io(e,t){const r=ft(e),n=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(n.current),[]),g.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function En(e,t){const r=ft(t);lt(()=>{let n=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return a.observe(e),()=>{window.cancelAnimationFrame(n),a.unobserve(e)}}},[e,r])}var th=Hf,B1=qf,U1=Yf;const Oo=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(th,{ref:n,className:K("relative overflow-hidden",e),...r,children:[o.jsx(B1,{className:"h-full w-full rounded-[inherit]",children:t}),o.jsx(rh,{}),o.jsx(U1,{})]}));Oo.displayName=th.displayName;const rh=g.forwardRef(({className:e,orientation:t="vertical",...r},n)=>o.jsx(sl,{ref:n,orientation:t,className:K("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:o.jsx(Kf,{className:"relative flex-1 rounded-full bg-border"})}));rh.displayName=sl.displayName;const Rc=Object.entries(I.icons).map(([e,t])=>({name:e,kebab:e.replace(/([A-Z])/g,(r,n,a)=>a===0?n.toLowerCase():`-${n.toLowerCase()}`),component:t})),nh=({value:e,onChange:t,label:r="Ícone (Lucide)",hideLabel:n=!1,className:a})=>{const[s,i]=N.useState(!1),[l,c]=N.useState(""),d=N.useMemo(()=>ov(e),[e]),u=N.useMemo(()=>{const f=l.toLowerCase();return f?Rc.filter(v=>v.name.toLowerCase().includes(f)||v.kebab.includes(f)):Rc},[l]),m=f=>{t(f),i(!1)},p=f=>{i(f),f||c("")};return o.jsxs("div",{className:`space-y-1 ${a??""}`,children:[!n&&o.jsx(ie,{className:"text-xs",children:r}),o.jsx(Ae,{type:"button",variant:"outline",className:"w-full h-8 justify-start text-xs font-normal gap-2",onClick:()=>i(!0),children:d?o.jsxs(o.Fragment,{children:[N.createElement(d,{className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{className:"truncate",children:e})]}):o.jsx("span",{className:"text-muted-foreground",children:"Selecionar ícone…"})}),o.jsx(Kw,{open:s,onOpenChange:p,children:o.jsxs(vf,{className:"max-w-3xl max-h-[85vh] flex flex-col gap-0 p-0",children:[o.jsxs(bf,{className:"px-4 pt-4 pb-2 border-b",children:[o.jsx(yf,{children:"Selecionar ícone"}),o.jsx(wf,{children:"Pesquise e clique em um ícone da biblioteca Lucide."})]}),o.jsx("div",{className:"px-4 py-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(I.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ue,{autoFocus:!0,placeholder:"Buscar ícones…",value:l,onChange:f=>c(f.target.value),className:"pl-8 h-9 text-sm"})]})}),o.jsx(Oo,{className:"flex-1 px-4 py-2",children:o.jsxs("div",{className:"grid grid-cols-5 gap-2 sm:grid-cols-7 md:grid-cols-8 pb-2",children:[o.jsxs(Ae,{type:"button",variant:e?"outline":"secondary",className:"flex flex-col items-center justify-center h-20 gap-1 p-1",onClick:()=>m(void 0),children:[o.jsx("div",{className:"h-6 w-6 rounded border-2 border-dashed border-muted-foreground/30"}),o.jsx("span",{className:"text-[10px] leading-tight text-center",children:"Nenhum"})]}),u.map(({name:f,component:v})=>o.jsxs(Ae,{type:"button",variant:e===f?"secondary":"outline",className:"flex flex-col items-center justify-center h-20 gap-1 p-1 overflow-hidden",onClick:()=>m(f),children:[N.createElement(v,{size:24}),o.jsx("span",{className:"text-[9px] leading-tight text-center break-all line-clamp-2",children:f})]},f))]})})]})})]})};var H1=Object.defineProperty,W1=(e,t,r)=>t in e?H1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Pc=(e,t,r)=>W1(e,typeof t!="symbol"?t+"":t,r);const Ga=N.createContext({}),Cr=()=>N.useContext(Ga),_c=new Set(["__proto__","constructor","prototype"]),Na=(e,t,r)=>{const n=t.split(".");let a=e;for(let i=0;i<n.length-1;i++){const l=n[i];if(_c.has(l))return;(a[l]==null||typeof a[l]!="object")&&(a[l]={}),a=a[l]}const s=n[n.length-1];_c.has(s)||(a[s]=r)},xn=async(e,t,r,n,a,s)=>{for(const i of e){const l=s[i.type];if(!l)continue;const c=await l(r,n,i,a);if(c)return i.message??c}},ah=(e,t={},r={})=>async n=>{var a,s,i,l,c;const d={},{errors:u}=yi(e,n,t);for(const p of u){const f=p.campo.replace(/\[(\d+)\]/g,".$1");Na(d,f,{type:"custom",message:p.message})}const m=[...e.containers].sort((p,f)=>p.ordem-f.ordem);for(const p of m)if(!p.repeatable&&$e(p.condicional,n,t))for(const f of p.campos){if(f.tipo===D.HIDDEN||f.isDisabled||f.isReadOnly||!$e(f.condicional,n,t))continue;if(f.tipo===D.FIELD_ARRAY){const h=Array.isArray(n[f.nome])?n[f.nome]:[];for(let x=0;x<h.length;x++){const b=h[x];for(const y of f.subFields??[]){if(y.isDisabled||y.isReadOnly||!$e(y.condicional,b,t)||!((a=y.validate)!=null&&a.length)||d[`${f.nome}.${x}.${y.nome}`])continue;const j=await xn(y.validate,y.nome,b[y.nome],b,t,r);j&&Na(d,`${f.nome}.${x}.${y.nome}`,{type:"custom",message:j})}}continue}if(f.tipo===D.SUB_FORM){const h=n[f.nome]??{};for(const x of((s=f.subSchema)==null?void 0:s.fields)??[]){if(x.isDisabled||x.isReadOnly||!((i=x.validate)!=null&&i.length)||d[`${f.nome}.${x.nome}`])continue;const b=await xn(x.validate,x.nome,h[x.nome],h,t,r);b&&Na(d,`${f.nome}.${x.nome}`,{type:"custom",message:b})}continue}if(!((l=f.validate)!=null&&l.length)||d[f.nome])continue;const v=await xn(f.validate,f.nome,n[f.nome],n,t,r);v&&(d[f.nome]={type:"custom",message:v})}for(const p of m){if(!p.repeatable||!p.nome||!$e(p.condicional,n,t))continue;const f=Array.isArray(n[p.nome])?n[p.nome]:[];for(let v=0;v<f.length;v++){const h=f[v];for(const x of p.campos){if(x.tipo===D.HIDDEN||x.isDisabled||x.isReadOnly||!$e(x.condicional,h,t)||!((c=x.validate)!=null&&c.length)||d[`${p.nome}.${v}.${x.nome}`])continue;const b=await xn(x.validate,x.nome,h[x.nome],h,t,r);b&&Na(d,`${p.nome}.${v}.${x.nome}`,{type:"custom",message:b})}}}return Object.keys(d).length>0?{values:{},errors:d}:{values:n,errors:{}}},oh=(e,t={},r={})=>async n=>{var a,s;const i={},l=[...e.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l)if(!(c.condicional&&!$e(c.condicional,n,t))){if(c.repeatable&&c.nome){const d=Array.isArray(n[c.nome])?n[c.nome]:[];for(let u=0;u<d.length;u++){const m=d[u];for(const p of[...c.campos].sort((f,v)=>f.ordem-v.ordem)){if(!((a=p.warn)!=null&&a.length)||!$e(p.condicional,m,t))continue;const f=await xn(p.warn,p.nome,m[p.nome],m,t,r);f&&(i[`${c.nome}.${u}.${p.nome}`]=f)}}continue}for(const d of[...c.campos].sort((u,m)=>u.ordem-m.ordem)){if(!((s=d.warn)!=null&&s.length)||!$e(d.condicional,n,t))continue;const u=await xn(d.warn,d.nome,n[d.nome],n,t,r);u&&(i[d.nome]=u)}}return i},q1=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,xt=(e,t)=>e?e.replace(q1,(r,n)=>t[`evento.${n}`]??t[n]??r):e??"",G1=(e,t)=>({...e,label:xt(e.label,t)}),sh=(e,t)=>{var r;return{...e,label:xt(e.label,t),placeholder:xt(e.placeholder,t),hint:xt(e.hint,t),defaultValue:typeof e.defaultValue=="string"?xt(e.defaultValue,t):e.defaultValue,opcoes:(r=e.opcoes)==null?void 0:r.map(n=>G1(n,t))}},Fo=(e,t)=>({...e,titulo:xt(e.titulo,t),descricao:xt(e.descricao,t),campos:e.campos.map(r=>sh(r,t))}),ih=(e,t)=>({...e,titulo:xt(e.titulo,t),descricao:xt(e.descricao,t),containers:e.containers.map(r=>Fo(r,t))}),lh=()=>{const e=ra(),t=e.layout.containerStyle,r=e.layout.roundness??"rounded-xl",n=K("overflow-hidden",r,t==="card"?"border":"",t==="bordered"?"border":"",t==="glassmorphism"?"backdrop-blur-sm":""),a=t==="glassmorphism"?{background:"var(--t-surface)",borderColor:"var(--t-border)",borderWidth:"1px",borderStyle:"solid"}:{},s=K("border-b px-6 py-4",t==="flat"?"border-transparent":"");return{wrapperClass:n,wrapperStyle:a,headerClass:s,headerStyle:t==="glassmorphism"?{borderColor:"var(--t-border)"}:{},tmpl:e}},Tt=({name:e,control:t,placeholder:r,type:n="text",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Ee.useController({name:e,control:t}),d=!!c.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...l,value:l.value??"",type:n,placeholder:r,disabled:a,readOnly:s,className:K(d&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},zo=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Ee.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsx(io,{...i,value:i.value??"",placeholder:r,disabled:n,readOnly:a,rows:3,className:K(l.error&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Lo=({name:e,control:t,placeholder:r,options:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Ee.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(Vt,{value:l.value??"",onValueChange:d=>!s&&l.onChange(d),disabled:a||s,children:[o.jsx(Dt,{className:K(c.error&&"border-destructive focus:ring-destructive"),onBlur:l.onBlur,children:o.jsx(Bt,{placeholder:r??"Selecione..."})}),o.jsx(Rt,{children:n.map(d=>o.jsx(Xe,{value:d.valor,disabled:d.disabled,children:d.label},d.valor))})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Mo=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Ee.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(rt,{name:i.name,checked:!!i.value,onCheckedChange:c=>!a&&i.onChange(!!c),onBlur:i.onBlur,disabled:n}),r&&o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},cl=({name:e,control:t,options:r,disabled:n})=>{var a;const{field:s,fieldState:i}=Ee.useController({name:e,control:t}),l=Array.isArray(s.value)?s.value:[],c=d=>{const u=l.includes(d)?l.filter(m=>m!==d):[...l,d];s.onChange(u)};return o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex flex-col gap-2",onBlur:s.onBlur,children:r.map(d=>o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(rt,{checked:l.includes(d.valor),onCheckedChange:()=>c(d.valor),disabled:n||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},dl=({name:e,control:t,options:r,visualStyle:n="default",disabled:a})=>{var s;const{field:i,fieldState:l}=Ee.useController({name:e,control:t}),c=n==="card";return o.jsxs("div",{className:"space-y-1",onBlur:i.onBlur,children:[o.jsx(Ri,{value:i.value??"",onValueChange:i.onChange,className:K(c?"grid grid-cols-2 gap-2 sm:grid-cols-3":"flex flex-col gap-2"),children:r.map(d=>o.jsxs("label",{className:K("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",(a||d.disabled)&&"cursor-not-allowed opacity-50"),"data-selected":i.value===d.valor?"true":void 0,children:[o.jsx(Pi,{value:d.valor,disabled:a||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},ch=e=>{const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`},X1=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),ch(t)},Z1=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),ch(t)},Tn=({name:e,control:t,isDatetime:r,disabled:n,readOnly:a,validacao:s})=>{var i;const{field:l,fieldState:c}=Ee.useController({name:e,control:t}),d=r?"datetime-local":"date",u=f=>r?f+"T00:00":f,m=(s==null?void 0:s.minAge)!=null?u(X1(s.minAge)):(s==null?void 0:s.maxDate)!=null?u(s.maxDate):void 0,p=(s==null?void 0:s.maxAge)!=null?u(Z1(s.maxAge)):(s==null?void 0:s.minDate)!=null?u(s.minDate):void 0;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value??"",onChange:l.onChange,onBlur:l.onBlur,type:d,min:p,max:m,disabled:n,readOnly:a,className:K(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})};function K1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const dh={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};for(const[e,t]of Object.entries(dh));let Ic;function Y1(){if(!(typeof globalThis.TextDecoder>"u"))return Ic??(Ic=new globalThis.TextDecoder("utf-8"))}const An=32*1024,qt=65533;function J1(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{const r=Y1();return r?r.decode(e):ej(e)}case"utf-16le":return tj(e);case"us-ascii":case"ascii":return rj(e);case"latin1":case"iso-8859-1":return nj(e);case"windows-1252":return aj(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function ul(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function Je(e,t,r){t.push(r),t.length>=An&&ul(e,t)}function Q1(e,t,r){if(r<=65535){Je(e,t,r);return}r-=65536,Je(e,t,55296+(r>>10)),Je(e,t,56320+(r&1023))}function ej(e){const t=[],r=[];let n=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(n=3);n<e.length;){const a=e[n];if(a<=127){Je(t,r,a),n++;continue}if(a<194||a>244){Je(t,r,qt),n++;continue}if(a<=223){if(n+1>=e.length){Je(t,r,qt),n++;continue}const d=e[n+1];if((d&192)!==128){Je(t,r,qt),n++;continue}const u=(a&31)<<6|d&63;Je(t,r,u),n+=2;continue}if(a<=239){if(n+2>=e.length){Je(t,r,qt),n++;continue}const d=e[n+1],u=e[n+2];if(!((d&192)===128&&(u&192)===128&&!(a===224&&d<160)&&!(a===237&&d>=160))){Je(t,r,qt),n++;continue}const m=(a&15)<<12|(d&63)<<6|u&63;Je(t,r,m),n+=3;continue}if(n+3>=e.length){Je(t,r,qt),n++;continue}const s=e[n+1],i=e[n+2],l=e[n+3];if(!((s&192)===128&&(i&192)===128&&(l&192)===128&&!(a===240&&s<144)&&!(a===244&&s>143))){Je(t,r,qt),n++;continue}const c=(a&7)<<18|(s&63)<<12|(i&63)<<6|l&63;Q1(t,r,c),n+=4}return ul(t,r),t.join("")}function tj(e){const t=[],r=[],n=e.length;let a=0;for(;a+1<n;){const s=e[a]|e[a+1]<<8;if(a+=2,s>=55296&&s<=56319){if(a+1<n){const i=e[a]|e[a+1]<<8;i>=56320&&i<=57343?(Je(t,r,s),Je(t,r,i),a+=2):Je(t,r,qt)}else Je(t,r,qt);continue}if(s>=56320&&s<=57343){Je(t,r,qt);continue}Je(t,r,s)}return a<n&&Je(t,r,qt),ul(t,r),t.join("")}function rj(e){const t=[];for(let r=0;r<e.length;r+=An){const n=Math.min(e.length,r+An),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s]&127;t.push(String.fromCharCode.apply(null,a))}return t.join("")}function nj(e){const t=[];for(let r=0;r<e.length;r+=An){const n=Math.min(e.length,r+An),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s];t.push(String.fromCharCode.apply(null,a))}return t.join("")}function aj(e){const t=[];let r="";for(let n=0;n<e.length;n++){const a=e[n],s=a>=128&&a<=159?dh[a]:void 0;r+=s??String.fromCharCode(a),r.length>=An&&(t.push(r),r="")}return r&&t.push(r),t.join("")}function kt(e){return new DataView(e.buffer,e.byteOffset)}const oj={len:1,get(e,t){return kt(e).getUint8(t)},put(e,t,r){return kt(e).setUint8(t,r),t+1}},We={len:2,get(e,t){return kt(e).getUint16(t,!0)},put(e,t,r){return kt(e).setUint16(t,r,!0),t+2}},mn={len:2,get(e,t){return kt(e).getUint16(t)},put(e,t,r){return kt(e).setUint16(t,r),t+2}},Ze={len:4,get(e,t){return kt(e).getUint32(t,!0)},put(e,t,r){return kt(e).setUint32(t,r,!0),t+4}},Oc={len:4,get(e,t){return kt(e).getUint32(t)},put(e,t,r){return kt(e).setUint32(t,r),t+4}},sj={len:4,get(e,t){return kt(e).getInt32(t)},put(e,t,r){return kt(e).setInt32(t,r),t+4}},ij={len:8,get(e,t){return kt(e).getBigUint64(t,!0)},put(e,t,r){return kt(e).setBigUint64(t,r,!0),t+8}};let gr=class{constructor(t,r){this.len=t,this.encoding=r}get(t,r=0){const n=t.subarray(r,r+this.len);return J1(n,this.encoding)}};const lj="End-Of-Stream";class et extends Error{constructor(){super(lj),this.name="EndOfStreamError"}}let cj=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}},uh=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,r=!1){const n=await this.read(t,r);return this.peekQueue.push(t.subarray(0,n)),n}async read(t,r=!1){if(t.length===0)return 0;let n=this.readFromPeekBuffer(t);if(this.endOfStream||(n+=await this.readRemainderFromStream(t.subarray(n),r)),n===0&&!r)throw new et;return n}readFromPeekBuffer(t){let r=t.length,n=0;for(;this.peekQueue.length>0&&r>0;){const a=this.peekQueue.pop();if(!a)throw new Error("peekData should be defined");const s=Math.min(a.length,r);t.set(a.subarray(0,s),n),n+=s,r-=s,s<a.length&&this.peekQueue.push(a.subarray(s))}return n}async readRemainderFromStream(t,r){let n=0;for(;n<t.length&&!this.endOfStream;){if(this.interrupted)throw new cj;const a=await this.readFromStream(t.subarray(n),r);if(a===0)break;n+=a}if(!r&&n<t.length)throw new et;return n}},dj=class extends uh{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}},uj=class extends dj{async readFromStream(t,r){if(t.length===0)return 0;const n=await this.reader.read(new Uint8Array(t.length),{min:r?void 0:t.length});return n.done&&(this.endOfStream=n.done),n.value?(t.set(n.value),n.value.length):0}};class Fc extends uh{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,r){const n=Math.min(r.length,t.length);return t.set(r.subarray(0,n)),n<r.length?this.buffer=r.subarray(n):this.buffer=null,n}async readFromStream(t,r){if(t.length===0)return 0;let n=0;for(this.buffer&&(n+=this.writeChunk(t,this.buffer));n<t.length&&!this.endOfStream;){const a=await this.reader.read();if(a.done){this.endOfStream=!0;break}a.value&&(n+=this.writeChunk(t.subarray(n),a.value))}if(!r&&n===0&&this.endOfStream)throw new et;return n}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}function mj(e){try{const t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new Fc(t):new uj(t)}catch(t){if(t instanceof TypeError)return new Fc(e.getReader());throw t}}class ml{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t==null?void 0:t.onClose,t!=null&&t.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.readBuffer(n,{position:r})<t.len)throw new et;return t.get(n,0)}async peekToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.peekBuffer(n,{position:r})<t.len)throw new et;return t.get(n,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new et;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new et;return t.get(this.numBuffer,0)}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");if(this.fileInfo.size!==void 0){const r=this.fileInfo.size-this.position;if(t>r)return this.position+=r,r}return this.position+=t,t}async close(){var t;await this.abort(),await((t=this.onClose)==null?void 0:t.call(this))}normalizeOptions(t,r){if(!this.supportsRandomAccess()&&r&&r.position!==void 0&&r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:t.length,position:this.position,...r}}abort(){return Promise.resolve()}}const pj=256e3;let fj=class extends ml{constructor(t,r){super(r),this.streamReader=t,this.fileInfo=(r==null?void 0:r.fileInfo)??{}}async readBuffer(t,r){const n=this.normalizeOptions(t,r),a=n.position-this.position;if(a>0)return await this.ignore(a),this.readBuffer(t,r);if(a<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;const s=await this.streamReader.read(t.subarray(0,n.length),n.mayBeLess);if(this.position+=s,(!r||!r.mayBeLess)&&s<n.length)throw new et;return s}async peekBuffer(t,r){const n=this.normalizeOptions(t,r);let a=0;if(n.position){const s=n.position-this.position;if(s>0){const i=new Uint8Array(n.length+s);return a=await this.peekBuffer(i,{mayBeLess:n.mayBeLess}),t.set(i.subarray(s)),a-s}if(s<0)throw new Error("Cannot peek from a negative offset in a stream")}if(n.length>0){try{a=await this.streamReader.peek(t.subarray(0,n.length),n.mayBeLess)}catch(s){if(r!=null&&r.mayBeLess&&s instanceof et)return 0;throw s}if(!n.mayBeLess&&a<n.length)throw new et}return a}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");const r=Math.min(pj,t),n=new Uint8Array(r);let a=0;for(;a<t;){const s=t-a,i=await this.readBuffer(n,{length:Math.min(r,s)});if(i<0)return i;a+=i}return a}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}},hj=class extends ml{constructor(t,r){super(r),this.uint8Array=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.length}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new et;return t.set(this.uint8Array.subarray(n.position,n.position+a)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}},xj=class extends ml{constructor(t,r){super(r),this.blob=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.size,mimeType:t.type}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.blob.size-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new et;const s=await this.blob.slice(n.position,n.position+a).arrayBuffer();return t.set(new Uint8Array(s)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}};function gj(e,t){const r=mj(e),n=t??{},a=n.onClose;return n.onClose=async()=>{if(await r.close(),a)return a()},new fj(r,n)}function vj(e,t){return new hj(e,t)}function bj(e,t){return new xj(e,t)}var ni={exports:{}},fs,zc;function yj(){if(zc)return fs;zc=1;var e=1e3,t=e*60,r=t*60,n=r*24,a=n*7,s=n*365.25;fs=function(u,m){m=m||{};var p=typeof u;if(p==="string"&&u.length>0)return i(u);if(p==="number"&&isFinite(u))return m.long?c(u):l(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function i(u){if(u=String(u),!(u.length>100)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(m){var p=parseFloat(m[1]),f=(m[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return p*s;case"weeks":case"week":case"w":return p*a;case"days":case"day":case"d":return p*n;case"hours":case"hour":case"hrs":case"hr":case"h":return p*r;case"minutes":case"minute":case"mins":case"min":case"m":return p*t;case"seconds":case"second":case"secs":case"sec":case"s":return p*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}}}function l(u){var m=Math.abs(u);return m>=n?Math.round(u/n)+"d":m>=r?Math.round(u/r)+"h":m>=t?Math.round(u/t)+"m":m>=e?Math.round(u/e)+"s":u+"ms"}function c(u){var m=Math.abs(u);return m>=n?d(u,m,n,"day"):m>=r?d(u,m,r,"hour"):m>=t?d(u,m,t,"minute"):m>=e?d(u,m,e,"second"):u+" ms"}function d(u,m,p,f){var v=m>=p*1.5;return Math.round(u/p)+" "+f+(v?"s":"")}return fs}function wj(e){r.debug=r,r.default=r,r.coerce=c,r.disable=i,r.enable=a,r.enabled=l,r.humanize=yj(),r.destroy=d,Object.keys(e).forEach(u=>{r[u]=e[u]}),r.names=[],r.skips=[],r.formatters={};function t(u){let m=0;for(let p=0;p<u.length;p++)m=(m<<5)-m+u.charCodeAt(p),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=t;function r(u){let m,p=null,f,v;function h(...x){if(!h.enabled)return;const b=h,y=Number(new Date),j=y-(m||y);b.diff=j,b.prev=m,b.curr=y,m=y,x[0]=r.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let w=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(C,S)=>{if(C==="%%")return"%";w++;const $=r.formatters[S];if(typeof $=="function"){const k=x[w];C=$.call(b,k),x.splice(w,1),w--}return C}),r.formatArgs.call(b,x),(b.log||r.log).apply(b,x)}return h.namespace=u,h.useColors=r.useColors(),h.color=r.selectColor(u),h.extend=n,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(f!==r.namespaces&&(f=r.namespaces,v=r.enabled(u)),v),set:x=>{p=x}}),typeof r.init=="function"&&r.init(h),h}function n(u,m){const p=r(this.namespace+(typeof m>"u"?":":m)+u);return p.log=this.log,p}function a(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];const m=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const p of m)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function s(u,m){let p=0,f=0,v=-1,h=0;for(;p<u.length;)if(f<m.length&&(m[f]===u[p]||m[f]==="*"))m[f]==="*"?(v=f,h=p,f++):(p++,f++);else if(v!==-1)f=v+1,h++,p=h;else return!1;for(;f<m.length&&m[f]==="*";)f++;return f===m.length}function i(){const u=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),u}function l(u){for(const m of r.skips)if(s(u,m))return!1;for(const m of r.names)if(s(u,m))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}var jj=wj;(function(e,t){t.formatArgs=n,t.save=a,t.load=s,t.useColors=r,t.storage=i(),t.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const d="color: "+this.color;c.splice(1,0,d,"color: inherit");let u=0,m=0;c[0].replace(/%[a-zA-Z%]/g,p=>{p!=="%%"&&(u++,p==="%c"&&(m=u))}),c.splice(m,0,d)}t.log=console.debug||console.log||(()=>{});function a(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function s(){let c;try{c=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function i(){try{return localStorage}catch{}}e.exports=jj(t);const{formatters:l}=e.exports;l.j=function(c){try{return JSON.stringify(c)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}})(ni,ni.exports);var kj=ni.exports;const Cj=K1(kj),gn={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Lc={get(e){return{signature:Ze.get(e,0),compressedSize:Ze.get(e,8),uncompressedSize:Ze.get(e,12)}},len:16},Nj={get(e){const t=We.get(e,6);return{signature:Ze.get(e,0),minVersion:We.get(e,4),dataDescriptor:!!(t&8),compressedMethod:We.get(e,8),compressedSize:Ze.get(e,18),uncompressedSize:Ze.get(e,22),filenameLength:We.get(e,26),extraFieldLength:We.get(e,28),filename:null}},len:30},Sj={get(e){return{signature:Ze.get(e,0),nrOfThisDisk:We.get(e,4),nrOfThisDiskWithTheStart:We.get(e,6),nrOfEntriesOnThisDisk:We.get(e,8),nrOfEntriesOfSize:We.get(e,10),sizeOfCd:Ze.get(e,12),offsetOfStartOfCd:Ze.get(e,16),zipFileCommentLength:We.get(e,20)}},len:22},$j={get(e){const t=We.get(e,8);return{signature:Ze.get(e,0),minVersion:We.get(e,6),dataDescriptor:!!(t&8),compressedMethod:We.get(e,10),compressedSize:Ze.get(e,20),uncompressedSize:Ze.get(e,24),filenameLength:We.get(e,28),extraFieldLength:We.get(e,30),fileCommentLength:We.get(e,32),relativeOffsetOfLocalHeader:Ze.get(e,42),filename:null}},len:46};function mh(e){const t=new Uint8Array(Ze.len);return Ze.put(t,0,e),t}const rr=Cj("tokenizer:inflate"),hs=256*1024,Ej=mh(gn.DataDescriptor),Sa=mh(gn.EndOfCentralDirectory);let pl=class ph{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(hs)}async isZip(){return await this.peekSignature()===gn.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Ze)}async findEndOfCentralDirectoryLocator(){const t=this.tokenizer,r=Math.min(16*1024,t.fileInfo.size),n=this.syncBuffer.subarray(0,r);await this.tokenizer.readBuffer(n,{position:t.fileInfo.size-r});for(let a=n.length-4;a>=0;a--)if(n[a]===Sa[0]&&n[a+1]===Sa[1]&&n[a+2]===Sa[2]&&n[a+3]===Sa[3])return t.fileInfo.size-r+a;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){rr("Cannot reading central-directory without random-read support");return}rr("Reading central-directory...");const t=this.tokenizer.position,r=await this.findEndOfCentralDirectoryLocator();if(r>0){rr("Central-directory 32-bit signature found");const n=await this.tokenizer.readToken(Sj,r),a=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let s=0;s<n.nrOfEntriesOfSize;++s){const i=await this.tokenizer.readToken($j);if(i.signature!==gn.CentralFileHeader)throw new Error("Expected Central-File-Header signature");i.filename=await this.tokenizer.readToken(new gr(i.filenameLength,"utf-8")),await this.tokenizer.ignore(i.extraFieldLength),await this.tokenizer.ignore(i.fileCommentLength),a.push(i),rr(`Add central-directory file-entry: n=${s+1}/${a.length}: filename=${a[s].filename}`)}return this.tokenizer.setPosition(t),a}this.tokenizer.setPosition(t)}async unzip(t){const r=await this.readCentralDirectory();if(r)return this.iterateOverCentralDirectory(r,t);let n=!1;do{const a=await this.readLocalFileHeader();if(!a)break;const s=t(a);n=!!s.stop;let i;if(await this.tokenizer.ignore(a.extraFieldLength),a.dataDescriptor&&a.compressedSize===0){const l=[];let c=hs;rr("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let d=-1;for(;d<0&&c===hs;){c=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),d=Tj(this.syncBuffer.subarray(0,c),Ej);const u=d>=0?d:c;if(s.handler){const m=new Uint8Array(u);await this.tokenizer.readBuffer(m),l.push(m)}else await this.tokenizer.ignore(u)}rr(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(a,Aj(l),s.handler)}else s.handler?(rr(`Reading compressed-file-data: ${a.compressedSize} bytes`),i=new Uint8Array(a.compressedSize),await this.tokenizer.readBuffer(i),await this.inflate(a,i,s.handler)):(rr(`Ignoring compressed-file-data: ${a.compressedSize} bytes`),await this.tokenizer.ignore(a.compressedSize));if(rr(`Reading data-descriptor at pos=${this.tokenizer.position}`),a.dataDescriptor&&(await this.tokenizer.readToken(Lc)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Lc.len}`)}while(!n)}async iterateOverCentralDirectory(t,r){for(const n of t){const a=r(n);if(a.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);const s=await this.readLocalFileHeader();if(s){await this.tokenizer.ignore(s.extraFieldLength);const i=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(i),await this.inflate(s,i,a.handler)}}if(a.stop)break}}async inflate(t,r,n){if(t.compressedMethod===0)return n(r);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);rr(`Decompress filename=${t.filename}, compressed-size=${r.length}`);const a=await ph.decompressDeflateRaw(r);return n(a)}static async decompressDeflateRaw(t){const r=new ReadableStream({start(s){s.enqueue(t),s.close()}}),n=new DecompressionStream("deflate-raw"),a=r.pipeThrough(n);try{const s=await new Response(a).arrayBuffer();return new Uint8Array(s)}catch(s){const i=s instanceof Error?`Failed to deflate ZIP entry: ${s.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(i)}}async readLocalFileHeader(){const t=await this.tokenizer.peekToken(Ze);if(t===gn.LocalFileHeader){const r=await this.tokenizer.readToken(Nj);return r.filename=await this.tokenizer.readToken(new gr(r.filenameLength,"utf-8")),r}if(t===gn.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}};function Tj(e,t){const r=e.length,n=t.length;if(n>r)return-1;for(let a=0;a<=r-n;a++){let s=!0;for(let i=0;i<n;i++)if(e[a+i]!==t[i]){s=!1;break}if(s)return a}return-1}function Aj(e){const t=e.reduce((a,s)=>a+s.length,0),r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}let Dj=class{constructor(t){this.tokenizer=t}inflate(){const t=this.tokenizer;return new ReadableStream({async pull(r){const n=new Uint8Array(1024),a=await t.readBuffer(n,{mayBeLess:!0});if(a===0){r.close();return}r.enqueue(n.subarray(0,a))}}).pipeThrough(new DecompressionStream("gzip"))}};new globalThis.TextDecoder("utf8");new globalThis.TextEncoder;Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Mc(e){const{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}function Rj(e,t){if(t==="utf-16le"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a&255,a>>8&255)}return r}if(t==="utf-16be"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a>>8&255,a&255)}return r}return[...e].map(r=>r.charCodeAt(0))}function Pj(e,t=0){const r=Number.parseInt(new gr(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let n=8*32;for(let a=t;a<t+148;a++)n+=e[a];for(let a=t+156;a<t+512;a++)n+=e[a];return r===n}const _j={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},Ij=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],Oj=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"],qn=4100,Fj=qn-2,dr=1024*1024,Vc=1024,zj=2**31-1,zt=16*1024*1024,Vo=dr,Bc=dr,Lj=zt,Mj=1,Uc=100,xs=zt,Hc=64,Wc=Vo,Vj=256,Bj=512,Uj=zt,Hj=512,Wj=512,qc=256,Gc=Vo,Xc=Vo,qj=Vo,Zc=zt,Gj=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),Xj=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],Zj=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);class Kr extends Error{}function Kj(e){var t;const r=e==null?void 0:e.streamReader;if(((t=r==null?void 0:r.constructor)==null?void 0:t.name)!=="WebStreamByobReader")return e;const{reader:n}=r,a=async()=>{await n.cancel(),n.releaseLock()};return r.close=a,r.abort=async()=>{r.interrupted=!0,await a()},e}function fl(e,t,r){if(!Number.isFinite(e)||e<0||e>t)throw new Kr(`${r} has invalid size ${e} (maximum ${t} bytes)`);return e}async function Dr(e,t,{maximumLength:r=zt,reason:n="skip"}={}){const a=fl(t,r,n);await e.ignore(a)}async function gs(e,t,r,{maximumLength:n=t.length,reason:a="read"}={}){const s=t.length,i=fl(s,n,a);return e.readBuffer(t,{...r,length:i})}async function Yj(e,{maximumLength:t=dr}={}){const r=new ReadableStream({start(l){l.enqueue(e),l.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),n=[];let a=0;try{for(;;){const{done:l,value:c}=await r.read();if(l)break;if(a+=c.length,a>t)throw await r.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);n.push(c)}}finally{r.releaseLock()}const s=new Uint8Array(a);let i=0;for(const l of n)s.set(l,i),i+=l.length;return s}const fh=134695760,Xa=16,Jj=Xa-1;function Qj(e,t){if(e.length<Xa)return-1;const r=e.length-Xa;for(let n=0;n<=r;n++)if(Ze.get(e,n)===fh&&Ze.get(e,n+8)===t+n)return n;return-1}function ek(e){return(e.codePointAt(0)&32)!==0}function tk(e,t){const r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}async function rk(e,{shouldBuffer:t,maximumLength:r=dr}={}){const{syncBuffer:n}=e,{length:a}=n,s=[];let i=0;for(;;){const l=await e.tokenizer.peekBuffer(n,{mayBeLess:!0}),c=Qj(n.subarray(0,l),i),d=c>=0?0:l===a?Math.min(Jj,l-1):0,u=c>=0?c:l-d;if(u===0)break;if(i+=u,i>r)throw new Error(`ZIP entry compressed data exceeds ${r} bytes`);if(t){const m=new Uint8Array(u);await e.tokenizer.readBuffer(m),s.push(m)}else await e.tokenizer.ignore(u);if(c>=0)break}if(mt(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=i),!!t)return tk(s,i)}function nk(e,t){return mt(e.tokenizer)?Math.max(0,zt-(e.tokenizer.position-t)):Math.max(0,dr-e.knownSizeDescriptorScannedBytes)}async function ak(e,t,{shouldBuffer:r,maximumDescriptorLength:n=dr}={}){if(t.dataDescriptor&&t.compressedSize===0)return rk(e,{shouldBuffer:r,maximumLength:n});if(!r){await Dr(e.tokenizer,t.compressedSize,{maximumLength:mt(e.tokenizer)?dr:e.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}const a=uk(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>a)throw new Error(`ZIP entry compressed data exceeds ${a} bytes`);const s=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(s),s}pl.prototype.inflate=async function(e,t,r){if(e.compressedMethod===0)return r(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);const n=await Yj(t,{maximumLength:dr});return r(n)};pl.prototype.unzip=async function(e){let t=!1,r=0;const n=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Gn(this.tokenizer,n,zt))throw new Kr(`ZIP stream probing exceeds ${zt} bytes`);const a=await this.readLocalFileHeader();if(!a)break;if(r++,r>Vc)throw new Error(`ZIP entry count exceeds ${Vc}`);const s=e(a);t=!!s.stop,await this.tokenizer.ignore(a.extraFieldLength);const i=await ak(this,a,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(dr,nk(this,n))});if(s.handler&&await this.inflate(a,i,s.handler),a.dataDescriptor){const l=new Uint8Array(Xa);if(await this.tokenizer.readBuffer(l),Ze.get(l,0)!==fh)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(Gn(this.tokenizer,n,zt))throw new Kr(`ZIP stream probing exceeds ${zt} bytes`)}while(!t)};function ok(e,t){const r=e.getReader();let n=0,a=!1,s=!1;const i=async l=>{a||s||(s=!0,await r.cancel(l))};return new ReadableStream({async pull(l){if(n>=t){l.close(),await i();return}const{done:c,value:d}=await r.read();if(c||!d){a=!0,l.close();return}const u=t-n;if(d.length>u){l.enqueue(d.subarray(0,u)),n+=u,l.close(),await i();return}l.enqueue(d),n+=d.length},async cancel(l){await i(l)}})}async function sk(e,t){return new hl(t).fromBlob(e)}function Kc(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:e};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:e};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:e};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:e};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:e};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"}}}function nr(e,t,r){r={offset:0,...r};for(const[n,a]of t.entries())if(r.mask){if(a!==(r.mask[n]&e[n+r.offset]))return!1}else if(a!==e[n+r.offset])return!1;return!0}function ik(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):qn}function lk(e,t,r){return r===void 0?e.read(t):(r.throwIfAborted(),new Promise((n,a)=>{const s=()=>{r.removeEventListener("abort",i)},i=()=>{const l=r.reason;s(),(async()=>{try{await e.cancel(l)}catch{}})(),a(l)};r.addEventListener("abort",i,{once:!0}),(async()=>{try{const l=await e.read(t);s(),n(l)}catch(l){s(),a(l)}})()}))}function ck(e){return Number.isFinite(e)?Math.max(0,Math.min(Fj,Math.trunc(e))):0}function dk(e){return Number.isFinite(e)?Math.max(0,e):Number.MAX_SAFE_INTEGER}function mt(e){const t=e.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Gn(e,t,r){return mt(e)&&e.position-t>r}function uk(e){const t=e.fileInfo.size,r=Number.isFinite(t)?Math.max(0,t-e.position):Number.MAX_SAFE_INTEGER;return Math.min(r,zj)}function mk(e){if(e instanceof et||e instanceof Kr)return!0;if(!(e instanceof Error))return!1;if(Gj.has(e.message)||Zj.has(e.code))return!0;for(const t of Xj)if(e.message.startsWith(t))return!0;return!1}function Yc(e,t=dr){const r=[e.compressedSize,e.uncompressedSize];for(const n of r)if(!Number.isFinite(n)||n<0||n>t)return!1;return!0}function pk(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function fk(e,t){t.startsWith("word/")&&(e.hasWordDirectory=!0),t.startsWith("ppt/")&&(e.hasPresentationDirectory=!0),t.startsWith("xl/")&&(e.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(e.hasThreeDimensionalModelEntry=!0)}function Jc(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(e.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(e.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(e.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function hk(e){const t=e.indexOf('.main+xml"');if(t===-1){const a="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return e.includes(`ContentType="${a}"`)?a:void 0}const r=e.slice(0,t),n=r.lastIndexOf('"');return r.slice(n+1)}class hl{constructor(t){Pc(this,"detectConfident",async n=>{if(this.buffer=new Uint8Array(qn),n.fileInfo.size===void 0&&(n.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=n,mt(n)&&(await n.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(n);if(await n.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await n.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=qc?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(n));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(n);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await Dr(n,6,{maximumLength:6,reason:"ID3 header prefix"});const a=await n.readToken(_j),s=mt(n);if(!Number.isFinite(a)||a<0||s&&(a>xs||n.position+a>xs))return;if(n.position+a>n.fileInfo.size)return s?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await Dr(n,a,{maximumLength:s?xs:n.fileInfo.size,reason:"ID3 payload"})}catch(i){if(i instanceof et)return;throw i}return this.detectionReentryCount>=qc?void 0:(this.detectionReentryCount++,this.parseTokenizer(n,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let a;const s=pk();try{await new pl(n).unzip(i=>{fk(s,i.filename);const l=i.filename==="[Content_Types].xml",c=Jc(s);if(!l&&c)return a=c,{stop:!0};switch(i.filename){case"META-INF/mozilla.rsa":return a={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return a={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return Yc(i,Bc)?{async handler(d){const u=new TextDecoder("utf-8").decode(d).trim();a=Kc(u)},stop:!0}:{};case"[Content_Types].xml":return s.hasContentTypesEntry=!0,Yc(i,Bc)?(s.isParsingContentTypes=!0,{async handler(d){const u=new TextDecoder("utf-8").decode(d),m=hk(u);m&&(a=Kc(m)),s.hasParsedContentTypesEntry=!0,s.isParsingContentTypes=!1},stop:!0}):(s.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(i.filename)?(a={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(i){if(!mk(i))throw i;s.isParsingContentTypes&&(s.isParsingContentTypes=!1,s.hasUnparseableContentTypes=!0)}return a??Jc(s)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await n.ignore(28);const a=new Uint8Array(8);return await n.readBuffer(a),nr(a,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:nr(a,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:nr(a,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:nr(a,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:nr(a,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:nr(a,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const a=await this.readTiffHeader(!1);if(a)return a}if(this.check([77,77])){const a=await this.readTiffHeader(!0);if(a)return a}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function a(){const d=await n.peekNumber(oj);let u=128,m=0;for(;!(d&u)&&u!==0;)++m,u>>=1;const p=new Uint8Array(m+1);return await gs(n,p,void 0,{maximumLength:p.length,reason:"EBML field"}),p}async function s(){const d=await a(),u=await a();u[0]^=128>>u.length-1;const m=Math.min(6,u.length),p=new DataView(d.buffer),f=new DataView(u.buffer,u.length-m,m);return{id:Mc(p),len:Mc(f)}}async function i(d){let u=0;for(;d>0;){if(u++,u>Vj||Gn(n,c,zt))return;const m=n.position,p=await s();if(p.id===17026){if(p.len>Hc)return;const f=fl(p.len,Hc,"EBML DocType");return(await n.readToken(new gr(f))).replaceAll(/\00.*$/g,"")}if(mt(n)&&(!Number.isFinite(p.len)||p.len<0||p.len>Wc)||(await Dr(n,p.len,{maximumLength:mt(n)?Wc:n.fileInfo.size,reason:"EBML payload"}),--d,n.position<=m))return}}const l=await s(),c=n.position;switch(await i(l.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){const a=Oc.get(this.buffer,4),s=mn.get(this.buffer,6);if(a>0&&a<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(s>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const a=new gr(4,"latin1").get(this.buffer,2);if(a.match("^d*")&&a>=1e3&&a<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await n.ignore(8),await n.readToken(new gr(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
80
- `,"\r"," "," ","\0"].some(a=>this.checkString(a,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){const a={ext:"png",mime:"image/png"},s={ext:"apng",mime:"image/apng"};await n.ignore(8);async function i(){return{length:await n.readToken(sj),type:await n.readToken(new gr(4,"latin1"))}}const l=mt(n),c=n.position;let d=0,u=!1;do{if(d++,d>Bj||Gn(n,c,Uj))break;const m=n.position,p=await i();if(p.length<0)return;if(p.type==="IHDR"){if(p.length!==13)return;u=!0}switch(p.type){case"IDAT":return a;case"acTL":return s;default:if(!u&&p.type!=="CgBI")return;if(l&&p.length>Gc)return u&&ek(p.type)?a:void 0;try{await Dr(n,p.length+4,{maximumLength:l?Gc+4:n.fileInfo.size,reason:"PNG chunk payload"})}catch(f){if(!l&&(f instanceof Kr||f instanceof et))return a;throw f}}if(n.position<=m)break}while(n.position+8<n.fileInfo.size);return a}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&this.buffer[8]&96){const a=new gr(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(a){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return a.startsWith("3g")?a.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
81
- `))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){let a=!1;try{async function s(){const d=new Uint8Array(16);return await gs(n,d,void 0,{maximumLength:d.length,reason:"ASF header GUID"}),{id:d,size:Number(await n.readToken(ij))}}await Dr(n,30,{maximumLength:30,reason:"ASF header prelude"});const i=mt(n),l=n.position;let c=0;for(;n.position+24<n.fileInfo.size&&(c++,!(c>Hj||Gn(n,l,zt)));){const d=n.position,u=await s();let m=u.size-24;if(!Number.isFinite(m)||m<0){a=!0;break}if(nr(u.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const p=new Uint8Array(16);if(m-=await gs(n,p,void 0,{maximumLength:p.length,reason:"ASF stream type GUID"}),nr(p,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(nr(p,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(i&&m>Xc){a=!0;break}if(await Dr(n,m,{maximumLength:i?Xc:n.fileInfo.size,reason:"ASF header payload"}),n.position<=d){a=!0;break}}}catch(s){if(s instanceof et||s instanceof Kr)mt(n)&&(a=!0);else throw s}return a?void 0:{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await n.ignore(20),await n.readToken(new gr(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await n.peekBuffer(this.buffer,{length:Math.min(256,n.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const a=new DataView(this.buffer.buffer).getUint32(12,!0);if(a>12&&this.buffer.length>=a+16)try{const s=new TextDecoder().decode(this.buffer.subarray(16,a+16));if(JSON.parse(s).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await n.peekBuffer(this.buffer,{length:Math.min(512,n.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&Pj(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){const a="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:a})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:a})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
82
- `,{offset:2,encoding:a})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}}),Pc(this,"detectImprecise",async n=>{this.buffer=new Uint8Array(qn);const a=dk(n.fileInfo.size);if(await n.peekBuffer(this.buffer,{length:Math.min(8,a),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await n.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,a),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let s=0;s<=this.options.mpegOffsetTolerance;++s){const i=this.scanMpeg(s);if(i)return i}});const r=ck(t==null?void 0:t.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:r},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return Kj(gj(t,this.getTokenizerOptions()))}async parseTokenizer(t,r=0){this.detectionReentryCount=r;const n=t.position;for(const a of this.detectors){let s;try{s=await a.detect(t)}catch(i){if(i instanceof et||i instanceof Kr)return;throw i}if(s)return s;if(n!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);const r=t instanceof Uint8Array?t:new Uint8Array(t);if((r==null?void 0:r.length)>1)return this.fromTokenizer(vj(r,this.getTokenizerOptions()))}async fromBlob(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=bj(t,this.getTokenizerOptions());return this.fromTokenizer(n)}async fromStream(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=this.createTokenizerFromWebStream(t);return this.fromTokenizer(n)}async toDetectionStream(t,r){const n=ik((r==null?void 0:r.sampleSize)??qn);let a,s;const i=t.getReader({mode:"byob"});try{const{value:d,done:u}=await lk(i,new Uint8Array(n),this.options.signal);if(s=d,!u&&d)try{a=await this.fromBuffer(d.subarray(0,n))}catch(m){if(!(m instanceof et))throw m;a=void 0}s=d}finally{i.releaseLock()}const l=new TransformStream({async start(d){d.enqueue(s)},transform(d,u){u.enqueue(d)}}),c=t.pipeThrough(l);return c.fileType=a,c}async detectGzip(t){var r;if(this.gzipProbeDepth>=Mj)return{ext:"gz",mime:"application/gzip"};const n=new Dj(t),a=ok(n.inflate(),Lj),s=mt(t);let i,l,c,d;if(s){const u=new AbortController;i=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${Uc} ms`,"TimeoutError"))},Uc),l=this.options.signal===void 0?u.signal:AbortSignal.any([this.options.signal,u.signal]),c=new hl({...this.options,signal:l}),c.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{d=await(c??this).fromStream(a)}catch(u){if((u==null?void 0:u.name)==="AbortError"&&((r=l==null?void 0:l.reason)==null?void 0:r.name)!=="TimeoutError")throw u}finally{clearTimeout(i),s||this.gzipProbeDepth--}return(d==null?void 0:d.ext)==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,r){return nr(this.buffer,t,r)}checkString(t,r){return this.check(Rj(t,r==null?void 0:r.encoding),r)}async readTiffTag(t){const r=await this.tokenizer.readToken(t?mn:We);switch(await this.tokenizer.ignore(10),r){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(t){const r=await this.tokenizer.readToken(t?mn:We);if(!(r>Wj)&&!(mt(this.tokenizer)&&2+r*12>Zc))for(let n=0;n<r;++n){const a=await this.readTiffTag(t);if(a)return a}}async readTiffHeader(t){const r={ext:"tif",mime:"image/tiff"},n=(t?mn:We).get(this.buffer,2),a=(t?Oc:Ze).get(this.buffer,4);if(n===42){if(a>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(a>=8){const l=(t?mn:We).get(this.buffer,8),c=(t?mn:We).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(mt(this.tokenizer)&&a>qj)return r;const s=mt(this.tokenizer)?Zc:this.tokenizer.fileInfo.size;try{await Dr(this.tokenizer,a,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof et)return;throw l}let i;try{i=await this.readTiffIFD(t)}catch(l){if(l instanceof et)return;throw l}return i??r}if(n===43)return r}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}}new Set(Ij);new Set(Oj);const Qc=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,xl=({name:e,control:t,disabled:r,campo:n,fileTypes:a,maxFileSize:s})=>{var i;const{field:l,fieldState:c}=Ee.useController({name:e,control:t}),{uploadFile:d,deleteUploadedFile:u}=Cr(),[m,p]=N.useState({status:"idle"}),f=N.useRef(null),[v,h]=N.useState(!1),x=N.useRef(!0);N.useEffect(()=>()=>{x.current=!1},[]);const b=typeof l.value=="string"&&l.value?l.value:null,y=N.useCallback(async S=>{var $;if(a&&a.length>0){const k=await sk(S),E=(k==null?void 0:k.ext)??"",T=(k==null?void 0:k.mime)??"",O=(($=S.name.split(".").pop())==null?void 0:$.toLowerCase())??"",L=S.type.toLowerCase();if(!a.some(A=>{const z=A.toLowerCase();return!!(E&&(z===E||z===T)||T&&z.endsWith("/*")&&T.startsWith(z.slice(0,-1))||!E&&(z===O||z===L||z.endsWith("/*")&&L.startsWith(z.slice(0,-1))))})){p({status:"error",message:`Tipo de arquivo não permitido. Permitidos: ${a.join(", ")}`});return}}if(s&&S.size>s){p({status:"error",message:`Arquivo muito grande. Tamanho máximo: ${Qc(s)}`});return}if(!d){p({status:"error",message:"Preview: upload não disponível sem configuração."});return}p({status:"uploading",fileName:S.name,progress:0});try{if(b&&u)try{await u(b)}catch{}const k=await d(S,n??e,E=>{x.current&&p(T=>T.status==="uploading"?{...T,progress:Math.min(100,E)}:T)});if(!x.current)return;l.onChange(k),p({status:"done",uploadId:k,fileName:S.name,size:S.size})}catch{if(!x.current)return;p({status:"error",message:"Falha no upload. Tente novamente."})}},[d,u,b,n,e,l,a,s]),j=N.useCallback(S=>{var $;const k=($=S.target.files)==null?void 0:$[0];k&&y(k),S.target.value=""},[y]),w=N.useCallback(()=>{b&&u&&u(b).catch(()=>{}),l.onChange(""),p({status:"idle"}),f.current&&(f.current.value="")},[l,b,u]);if(m.status==="done"||m.status==="idle"&&b){const S=m.status==="done"?m.fileName:"Arquivo enviado",$=m.status==="done"?m.size:null;return o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-green-500 bg-green-500/5 px-4 py-3 gap-2",children:[o.jsxs("svg",{className:"shrink-0 text-green-500",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[o.jsx("rect",{width:"20",height:"20",rx:"4",fill:"currentColor",fillOpacity:"0.15"}),o.jsx("path",{d:"M5 10.5L8.5 14L15 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:S}),$!==null&&o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:Qc($)}),!r&&o.jsx("button",{type:"button",onClick:w,className:"ml-2 shrink-0 text-muted-foreground hover:text-destructive transition-colors","aria-label":"Remover arquivo",children:"✕"})]})}if(m.status==="uploading"){const{fileName:S,progress:$}=m;return o.jsxs("div",{className:"rounded-lg border border-input px-4 py-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:S}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:[$,"%"]})]}),o.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary transition-all duration-200 rounded-full",style:{width:`${$}%`}})})]})}const C=m.status==="error";return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{role:"button",tabIndex:r?-1:0,"aria-label":"Selecionar arquivo",className:K("flex items-center justify-center rounded-lg border-2 border-dashed px-4 py-6 transition-colors cursor-pointer",v?"border-primary bg-primary/5":C||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 S;return!r&&((S=f.current)==null?void 0:S.click())},onKeyDown:S=>{var $;(S.key==="Enter"||S.key===" ")&&(($=f.current)==null||$.click())},onDragOver:S=>{S.preventDefault(),r||h(!0)},onDragLeave:()=>h(!1),onDrop:r?void 0:S=>{var $;S.preventDefault(),h(!1);const k=($=S.dataTransfer.files)==null?void 0:$[0];k&&y(k)},onBlur:l.onBlur,children:[o.jsx("input",{ref:f,type:"file",onChange:j,disabled:r,className:"sr-only"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:v?"Solte o arquivo aqui":"Clique ou arraste um arquivo"})]}),C&&o.jsxs("p",{className:"text-sm text-destructive",children:[m.message," · ",o.jsx("button",{type:"button",className:"underline hover:no-underline",onClick:()=>p({status:"idle"}),children:"Tentar novamente"})]}),!C&&((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},xk={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")},_r=({name:e,control:t,placeholder:r,maskType:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Ee.useController({name:e,control:t}),d=xk[n||""],u=N.useCallback(m=>{l.onChange(d?d(m.target.value):m.target.value)},[l,d]);return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value||"",onChange:u,onBlur:l.onBlur,placeholder:r,disabled:a,readOnly:s,className:K(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Bo=({name:e,control:t})=>{const{field:r}=Ee.useController({name:e,control:t});return o.jsx("input",{type:"hidden",...r,value:r.value??""})},hh=e=>e.replace(/\D/g,""),gk=e=>{const t=hh(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},vk=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()},gl=({name:e,control:t,placeholder:r="00000-000",disabled:n,readOnly:a,cepFillMap:s})=>{var i,l;const{field:c,fieldState:d}=Ee.useController({name:e,control:t}),{setValue:u}=Ee.useFormContext(),{cepLookup:m}=Cr(),[p,f]=N.useState("idle"),[v,h]=N.useState(null),x=N.useRef(null),b=N.useRef(!0);N.useEffect(()=>()=>{var w;b.current=!1,(w=x.current)==null||w.abort()},[]);const y=N.useCallback(async()=>{var w;c.onBlur();const C=hh(c.value??"");if(C.length===8){(w=x.current)==null||w.abort(),x.current=new AbortController,f("loading"),h(null);try{let S;if(m){const E=x.current;if(S=await m(C,E.signal),E.signal.aborted||!b.current)return}else{const E=await vk(C,x.current.signal);if(!b.current)return;if(E.erro){f("error"),h("CEP não encontrado");return}S={logradouro:E.logradouro,bairro:E.bairro,cidade:E.localidade,estado:E.uf}}if(!b.current)return;if(S.erro){f("error"),h("CEP não encontrado");return}const $=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",k=(E,T,O)=>{if(!O)return;const L=s!=null&&s[E]?`${$}${s[E]}`:`${$}${T}`;u(L,O,{shouldDirty:!0,shouldValidate:!0})};k("logradouro","_address_logradouro",S.logradouro),k("bairro","_address_bairro",S.bairro),k("cidade","_address_cidade",S.cidade),k("estado","_address_estado",S.estado),f("success")}catch(S){if(S instanceof Error&&S.name==="AbortError"||!b.current)return;f("error"),h("Erro ao buscar CEP")}}},[c,m,u,e,s]),j=N.useCallback(w=>{c.onChange(gk(w.target.value))},[c]);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{name:c.name,value:c.value||"",onChange:j,onBlur:y,placeholder:r,disabled:n,readOnly:a,className:K("pr-9",d.error&&"border-destructive focus-visible:ring-destructive")}),o.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",children:[p==="loading"&&o.jsx(I.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"}),p==="success"&&o.jsx(I.Check,{className:"h-4 w-4 text-green-500"}),p==="error"&&o.jsx(I.AlertCircle,{className:"h-4 w-4 text-destructive"})]})]}),(((i=d.error)==null?void 0:i.message)||v)&&o.jsx("p",{className:"text-sm text-destructive",children:((l=d.error)==null?void 0:l.message)||v})]})},bk=({field:e,control:t,nameOverride:r})=>{const n={name:r,control:t,placeholder:e.placeholder};switch(e.tipo){case D.TEXTO:return o.jsx(Tt,{...n,type:"text"});case D.EMAIL:return o.jsx(Tt,{...n,type:"email"});case D.NUMBER:return o.jsx(Tt,{...n,type:"number"});case D.TEXTAREA:return o.jsx(zo,{...n});case D.SELECT:return o.jsx(Lo,{...n,options:e.opcoes??[]});case D.RADIO:return o.jsx(dl,{...n,options:e.opcoes??[]});case D.CHECKBOX:return o.jsx(Mo,{name:r,control:t,label:e.label});case D.CHECKBOX_GROUP:return o.jsx(cl,{...n,options:e.opcoes??[]});case D.DATE:return o.jsx(Tn,{...n,validacao:e.validacao});case D.DATETIME:return o.jsx(Tn,{...n,isDatetime:!0,validacao:e.validacao});case D.FILE:return o.jsx(xl,{name:r,control:t});case D.TELEFONE:return o.jsx(_r,{...n,maskType:"telefone"});case D.CPF:return o.jsx(_r,{...n,maskType:"cpf"});case D.CEP:return o.jsx(gl,{name:r,control:t,placeholder:e.placeholder});case D.HIDDEN:return o.jsx(Bo,{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.`),o.jsx(Tt,{...n,type:"text"})}},xh=({name:e,control:t,subFields:r=[],minItems:n=1,maxItems:a,itemLabel:s="Item",addLabel:i})=>{var l;const{fields:c,append:d,remove:u}=Ee.useFieldArray({control:t,name:e}),{errors:m}=Ee.useFormState({control:t}),p=(l=m[e])==null?void 0:l.message,f=N.useCallback(()=>{const b={};for(const y of r)y.initialValue!==void 0?b[y.nome]=y.initialValue:y.defaultValue!==void 0&&(b[y.nome]=y.defaultValue);return b},[r]);N.useEffect(()=>{if(c.length<n)for(let b=c.length;b<n;b++)d(f())},[n]);const v=[...r].sort((b,y)=>b.ordem-y.ordem),h=!a||c.length<a,x=i??`Adicionar ${s.toLowerCase()}`;return o.jsxs("div",{className:"space-y-3",children:[c.map((b,y)=>o.jsxs("div",{className:"rounded-lg border border-input p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary/10 text-xs font-bold text-primary shrink-0",children:y+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[s," ",y+1]})]}),c.length>n&&o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",onClick:()=>u(y),"aria-label":`Remover ${s.toLowerCase()} ${y+1}`,className:"text-muted-foreground hover:text-destructive",children:o.jsx(I.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:v.map(j=>{const w=`${e}.${y}.${j.nome}`,C=`span ${j.tamanho??12}`,S=o.jsx(bk,{field:j,control:t,nameOverride:w});return j.tipo===D.CHECKBOX||j.tipo===D.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:C},children:S},j.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:C},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1 text-sm text-foreground",children:[j.label,j.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),S,j.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:j.hint})]},j.id)})})]},b.id)),h&&o.jsxs(Ae,{type:"button",variant:"outline",className:"w-full",onClick:()=>d(f()),children:[o.jsx(I.Plus,{className:"w-4 h-4"}),x]}),a&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",a," ",s.toLowerCase(),a>1?"s":""]}),p&&o.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[o.jsx(I.AlertCircle,{className:"w-4 h-4 shrink-0"}),p]})]})},ed=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,yk=(e,t)=>{const r=new Date(e.slice(0,10)+"T00:00:00Z"),n=new Date(t.slice(0,10)+"T00:00:00Z");return Math.round((n.getTime()-r.getTime())/864e5)+1},wk=(e,t)=>{const r=[],n=new Date(e.slice(0,10)+"T00:00:00Z"),a=new Date(t.slice(0,10)+"T00:00:00Z");let s=0;for(;n<=a&&s<60;)r.push(n.toISOString().slice(0,10)),n.setUTCDate(n.getUTCDate()+1),s++;return r},jk=e=>{const[t,r,n]=e.split("-").map(Number),a=new Date(Date.UTC(t,r-1,n)),s=String(n).padStart(2,"0"),i=String(r).padStart(2,"0"),l=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(a),c=l.charAt(0).toUpperCase()+l.slice(1);return`${s}/${i} - ${c}`},kk=(e,t)=>{const r=n=>{const[a,s,i]=n.slice(0,10).split("-");return`${i}/${s}/${a}`};return`${r(e)} a ${r(t)}`},gh=({name:e,control:t})=>{var r;const{field:n,fieldState:a}=Ee.useController({name:e,control:t}),{externalData:s={}}=Cr(),i=n.value??null,l=(r=a.error)==null?void 0:r.message,c=V=>s[`evento.${V}`]??s[V],d=c("dataInicioEvento")??"",u=c("dataFimEvento")??"",m=Number(c("valor")??0),p=Number(c("valorPorDia")??0),f=c("vagasTotal"),v=c("vagasPorDia"),h=c("vagasMasculinas"),x=c("vagasFemininas"),b=f!=null?Number(f):null,y=v!=null?Number(v):null,j=h!=null?Number(h):null,w=x!=null?Number(x):null,C=d&&u?wk(d,u):[],S=(d&&u?yk(d,u):0)>1,$=j!=null&&j>0&&w!=null&&w>0,k=j!=null&&w==null?"masculino":w!=null&&j==null?"feminino":null,E=(i==null?void 0:i.tipo)??null,T=(i==null?void 0:i.data)??null,O=(i==null?void 0:i.genero)??null,L=N.useRef(i);L.current=i;const A=N.useRef(n.onChange);A.current=n.onChange,N.useEffect(()=>{var V,M,_;k&&((V=L.current)==null?void 0:V.genero)!==k&&A.current({tipo:((M=L.current)==null?void 0:M.tipo)??null,data:((_=L.current)==null?void 0:_.data)??null,genero:k})},[k]);const z=V=>{const M={tipo:V,data:null};($||k)&&(M.genero=O??k??void 0),n.onChange(M)},X=V=>{const M={tipo:"por_dia",data:V};($||k)&&(M.genero=O??k??void 0),n.onChange(M)},q=V=>{n.onChange({tipo:E,data:T,genero:V})},Z=V=>E===V;return o.jsxs("div",{className:"space-y-3",children:[$&&o.jsxs("div",{className:"flex items-center gap-2 px-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Você é:"}),o.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(V=>o.jsx("button",{type:"button",onClick:()=>q(V),className:K("px-3 py-1 rounded-full text-xs font-medium border transition-all",O===V?"border-primary bg-primary/10 text-primary":"border-input text-muted-foreground hover:border-primary/50"),children:V==="masculino"?"Masculino":"Feminino"},V))})]}),o.jsxs("button",{type:"button",onClick:()=>z("todos_os_dias"),className:K("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("todos_os_dias")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsx("div",{className:K("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("todos_os_dias")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(I.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar todos os dias"}),d&&u?o.jsx("p",{className:"text-xs text-muted-foreground",children:kk(d,u)}):o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Datas do evento"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[m>0&&o.jsx("p",{className:K("font-bold text-sm",Z("todos_os_dias")?"text-primary":"text-foreground"),children:ed(m)}),b!=null&&b>0&&o.jsxs("p",{className:"text-xs flex items-center justify-end gap-1 text-muted-foreground",children:[o.jsx(I.Users,{className:"w-3 h-3"}),b," vagas disponíveis"]})]})]}),S?o.jsxs("button",{type:"button",onClick:()=>z("por_dia"),className:K("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("por_dia")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsx("div",{className:K("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("por_dia")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(I.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado abaixo"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[p>0&&o.jsx("p",{className:K("font-bold text-sm",Z("por_dia")?"text-primary":"text-foreground"),children:ed(p)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"por dia"})]})]}):d?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg border border-input bg-muted/30",children:[o.jsx(I.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.'})]}):null,E==="por_dia"&&o.jsxs("div",{className:"pl-2 space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-primary",children:"Selecione o dia:"}),C.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Nenhuma data configurada no evento"}):C.map(V=>o.jsxs("button",{type:"button",onClick:()=>X(V),className:K("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",T===V?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:K("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center transition-colors",T===V?"border-primary bg-primary":"border-input"),children:T===V&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-white"})}),o.jsx("span",{className:"text-sm",children:jk(V)})]}),y!=null&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[y," vagas"]})]},V))]}),l&&o.jsx("p",{className:"text-sm text-destructive",children:l})]})},td=.0315,rd=.124,nd=7,ad=12,vh=[{id:"pix",label:"PIX",description:"Transferência instantânea (à vista)",Icon:I.Smartphone,taxa:0},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:I.Banknote,taxa:0},{id:"cartao",label:"Cartão de Crédito",description:"Débito ou crédito na maquininha",Icon:I.CreditCard,taxa:td,taxaLabel:`Taxa: ${(td*100).toFixed(2).replace(".",",")}%`}],bh=[{id:"pix",label:"PIX à Vista",description:"Pagamento instantâneo sem parcelamento",Icon:I.Smartphone,taxa:0},{id:"pix_parcelado",label:"PIX Parcelado",description:`Parcelado em até ${nd}x sem juros`,Icon:I.Smartphone,taxa:0,parcelas:nd},{id:"cartao",label:"Cartão de Crédito",description:`Parcelado em até ${ad}x`,Icon:I.CreditCard,taxa:rd,parcelas:ad,taxaLabel:`Taxa: ${(rd*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:I.Banknote,taxa:0}],$a=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,od=(e,t)=>Math.round(e*(1+t)*100)/100,Ck=(e,t)=>Math.round(e/t*100)/100,yh=({name:e,control:t,relatedFieldName:r="tipo_participacao"})=>{var n;const{field:a,fieldState:s}=Ee.useController({name:e,control:t}),{externalData:i={},paymentMethodOptions:l}=Cr(),c=a.value??null,d=(n=s.error)==null?void 0:n.message,u=Ee.useWatch({control:t,name:r}),m=(u==null?void 0:u.tipo)??null,p=j=>i[`evento.${j}`]??i[j],f=Number(p("valor")??0),v=Number(p("valorPorDia")??0),h=m==="por_dia"&&v>0?v:f,x=m==="por_dia"?(l==null?void 0:l.porDia)??vh:(l==null?void 0:l.todosOsDias)??bh,b=m==="por_dia"?(()=>{if(!(u!=null&&u.data))return"Um dia";const j=u.data.split("-");if(j.length===3){const[w,C,S]=j;return`${S}/${C}/${w}`}return u.data})():"Todos os dias",y=j=>{if(j.disabled)return;const w=od(h,j.taxa),C={metodo:j.id,valorTotal:w};j.parcelas&&(C.parcelas=j.parcelas),a.onChange(C)};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-input px-4 py-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:b})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Valor base"}),o.jsx("p",{className:"text-lg font-bold text-primary",children:$a(h)})]})]}),o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-input bg-muted/30 px-3 py-2.5",children:[o.jsx(I.Info,{className:"h-4 w-4 mt-0.5 shrink-0 text-muted-foreground"}),o.jsxs("p",{className:"text-xs",children:[o.jsx("span",{className:"font-bold",children:"Importante:"})," Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:x.map(j=>{const{Icon:w}=j,C=(c==null?void 0:c.metodo)===j.id,S=od(h,j.taxa),$=!!j.parcelas&&j.parcelas>1,k=$?Ck(S,j.parcelas):null;return o.jsxs("button",{type:"button",disabled:j.disabled,onClick:()=>y(j),className:K("w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all",C?"border-primary bg-primary/5":"border-input hover:border-primary/50",j.disabled&&"opacity-50 cursor-not-allowed"),children:[o.jsx("div",{className:K("flex items-center justify-center w-10 h-10 rounded-lg shrink-0 transition-colors",C?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(w,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:j.label}),o.jsx("p",{className:"text-xs text-muted-foreground",children:j.description}),j.taxaLabel&&o.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["* ",j.taxaLabel]}),j.taxa>0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",$a(S)]})]}),o.jsx("div",{className:"text-right shrink-0",children:$?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold text-primary",children:$a(k)})]}):o.jsx("p",{className:"text-base font-bold text-primary",children:$a(S)})})]},j.id)})}),d&&o.jsx("p",{className:"text-xs text-destructive",children:d})]})},wh=({name:e,control:t,label:r,termoTexto:n,termoPdfUrl:a,termoPdfUploadId:s})=>{var i;const{field:l,fieldState:c}=Ee.useController({name:e,control:t}),{resolveTermsUploadUrl:d}=Cr(),u=!!c.error,m=(i=c.error)==null?void 0:i.message,[p,f]=N.useState(null),[v,h]=N.useState(!1),[x,b]=N.useState(!1),y=N.useRef(null);N.useEffect(()=>{var $;x&&(($=y.current)==null||$.focus())},[x]),N.useEffect(()=>{if(!s||!d){f(null);return}let $=!1;return h(!0),d(s).then(k=>{$||f(k)}).catch(()=>{$||f(null)}).finally(()=>{$||h(!1)}),()=>{$=!0}},[s,d]);const j=l.value==="accepted",w=p||a||null,C=!!(n||w||s),S=!!w;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:K("rounded-lg border p-4 space-y-4 transition-colors",u?"border-destructive bg-destructive/5":j?"border-green-500 bg-green-500/5":"border-input"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(I.ScrollText,{className:"h-4 w-4 shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:r||"Termos e condições"})]}),C?o.jsxs(Ae,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:v,onClick:()=>b(!0),children:[v?o.jsx(I.Loader2,{className:"h-3 w-3 animate-spin"}):o.jsx(I.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:s&&v?"Carregando PDF...":"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx(rt,{className:"mt-0.5",checked:j,onCheckedChange:$=>l.onChange($?"accepted":"")}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito ",r?`"${r}"`:"os termos e condições"]}),j&&o.jsx(I.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]}),u&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(I.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),m||"Você precisa aceitar os termos para continuar"]}),x&&o.jsx("div",{ref:y,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:()=>b(!1),onKeyDown:$=>{$.key==="Escape"&&b(!1)},children:o.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:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-input",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(I.ScrollText,{className:"h-4 w-4"}),o.jsx("span",{className:"font-semibold",children:"Termos e condições"})]}),o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",onClick:()=>b(!1),children:o.jsx(I.X,{className:"h-4 w-4"})})]}),o.jsx("div",{className:"flex-1 overflow-auto p-4",children:S?o.jsx("iframe",{src:w,className:"w-full rounded border",style:{height:"62vh"},title:"Termos e condições",sandbox:"allow-scripts"}):o.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:n})})]})})]})},Nk=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Ee.useController({name:e,control:t}),[c,d]=N.useState(!1),u=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{...i,value:i.value??"",type:c?"text":"password",placeholder:r,disabled:n,readOnly:a,className:K("pr-10",u&&"border-destructive focus-visible:ring-destructive")}),o.jsx("button",{type:"button",tabIndex:-1,onClick:()=>d(m=>!m),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?o.jsx(I.EyeOff,{size:16}):o.jsx(I.Eye,{size:16})})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},jh=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Ee.useController({name:e,control:t}),c=!!i.value;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[o.jsx(_i,{checked:c,onCheckedChange:d=>!a&&i.onChange(d),disabled:n||a,onBlur:i.onBlur}),o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Sk=({name:e,control:t,minValue:r=0,maxValue:n=100,step:a=1,disabled:s,readOnly:i})=>{var l;const{field:c,fieldState:d}=Ee.useController({name:e,control:t}),u=c.value??r;return N.useEffect(()=>{(c.value===void 0||c.value===null)&&c.onChange(r)},[]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(So,{min:r,max:n,step:a,value:[u],onValueChange:m=>!i&&c.onChange(m[0]),disabled:s||i,className:"flex-1"}),o.jsx("span",{className:"text-sm font-medium text-primary min-w-[3rem] text-right tabular-nums",children:u})]}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:r}),o.jsx("span",{children:n})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",children:d.error.message})]})},vs=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),$k=({name:e,control:t,disabled:r,readOnly:n})=>{var a;const{field:s,fieldState:i}=Ee.useController({name:e,control:t}),l=s.value||"#000000",[c,d]=N.useState(l);return N.useEffect(()=>{d(l)},[l]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("input",{type:"color",value:vs(l)?l:"#000000",disabled:r||n,onChange:u=>s.onChange(u.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"}),o.jsx(ue,{type:"text",value:c,readOnly:n,disabled:r,onChange:u=>{const m=u.target.value;d(m),vs(m)&&s.onChange(m.toUpperCase())},onBlur:()=>{vs(c)||d(l),s.onBlur()},className:K("flex-1 font-mono uppercase",i.error&&"border-destructive focus-visible:ring-destructive"),maxLength:7,placeholder:"#000000"})]}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},Ek=({name:e,control:t,options:r,placeholder:n,disabled:a,readOnly:s})=>{var i,l;const{field:c,fieldState:d}=Ee.useController({name:e,control:t}),[u,m]=N.useState(""),[p,f]=N.useState(!1),[v,h]=N.useState(-1),x=N.useRef(null),b=N.useRef(null),y=`autocomplete-${e}-listbox`,j=((i=r.find(T=>T.valor===c.value))==null?void 0:i.label)??"",w=u.length>0?r.filter(T=>T.label.toLowerCase().includes(u.toLowerCase())):r;N.useEffect(()=>{const T=O=>{x.current&&!x.current.contains(O.target)&&(f(!1),m(""),h(-1))};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const C=()=>{f(!1),m(""),h(-1)};N.useEffect(()=>{if(v<0||!b.current)return;const T=b.current.querySelector(`[id="${y}-option-${v}"]`);T==null||T.scrollIntoView({block:"nearest"})},[v,y]);const S=T=>{T.disabled||(c.onChange(T.valor),C())},$=()=>{c.onChange(""),m(""),h(-1)},k=T=>{if(!p){(T.key==="ArrowDown"||T.key==="ArrowUp")&&(T.preventDefault(),f(!0),h(0));return}switch(T.key){case"ArrowDown":T.preventDefault(),h(O=>O<w.length-1?O+1:O);break;case"ArrowUp":T.preventDefault(),h(O=>O>0?O-1:0);break;case"Enter":T.preventDefault(),v>=0&&w[v]&&!w[v].disabled&&S(w[v]);break;case"Escape":T.preventDefault(),C();break;case"Tab":C();break}},E=p&&v>=0?`${y}-option-${v}`:void 0;return o.jsxs("div",{className:"space-y-1",ref:x,children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{type:"text",role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":y,"aria-activedescendant":E,value:p?u:j,placeholder:n??"Buscar...",disabled:a,readOnly:s,onChange:T=>{m(T.target.value),h(-1),f(!0)},onFocus:()=>!s&&f(!0),onKeyDown:k,className:K("pr-8",d.error&&"border-destructive focus-visible:ring-destructive"),autoComplete:"off"}),o.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:c.value?o.jsx("button",{type:"button",onClick:$,className:"text-[var(--t-text-muted)] hover:text-[var(--t-text)]",tabIndex:-1,"aria-label":"Limpar seleção",children:o.jsx(I.X,{size:14})}):o.jsx(I.ChevronDown,{size:16,className:"text-muted-foreground pointer-events-none","aria-hidden":"true"})}),p&&!a&&!s&&o.jsx("ul",{role:"listbox",id:y,ref:b,"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:w.length===0?o.jsx("li",{role:"option","aria-selected":!1,className:"px-3 py-2 text-sm text-muted-foreground",children:"Nenhuma opção encontrada"}):w.map((T,O)=>o.jsx("li",{id:`${y}-option-${O}`,role:"option","aria-selected":c.value===T.valor,"aria-disabled":T.disabled,onMouseDown:()=>S(T),className:["flex cursor-pointer items-center px-3 py-2 text-sm",T.disabled?"cursor-not-allowed opacity-40":O===v?"bg-accent":"hover:bg-accent",c.value===T.valor?"font-medium text-primary":"text-foreground"].join(" "),children:T.label},T.valor))})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",role:"alert",children:d.error.message})]})},kh=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Ee.useController({name:e,control:t}),c=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...i,value:i.value??"",type:"time",placeholder:r,disabled:n,readOnly:a,className:K(c&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Tk=({name:e,control:t,startLabel:r="Data inicial",endLabel:n="Data final",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Ee.useController({name:e,control:t}),d=l.value??{},u=(p,f)=>{l.onChange({...d,[p]:f})},m=!!c.error;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{children:r}),o.jsx(ue,{type:"date",value:d.start??"",disabled:a,readOnly:s,onChange:p=>u("start",p.target.value),max:d.end??void 0,className:K(m&&"border-destructive focus-visible:ring-destructive")})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{children:n}),o.jsx(ue,{type:"date",value:d.end??"",disabled:a,readOnly:s,onChange:p=>u("end",p.target.value),min:d.start??void 0,className:K(m&&"border-destructive focus-visible:ring-destructive")})]})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Ak=({name:e,control:t,maxRating:r=5,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Ee.useController({name:e,control:t}),c=i.value??0,d=Array.from({length:r},(u,m)=>m+1);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[d.map(u=>o.jsx("button",{type:"button",disabled:n||a,onClick:()=>i.onChange(u===c?0:u),className:"transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":`${u} estrela${u>1?"s":""}`,children:o.jsx(I.Star,{size:24,className:"transition-colors",fill:u<=c?"var(--color-primary)":"transparent",stroke:u<=c?"var(--color-primary)":"currentColor"})},u)),c>0&&o.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[c,"/",r]})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Dk=({field:e,name:t,control:r,disabled:n,readOnly:a})=>{const s=n||e.isDisabled,i=a||e.isReadOnly;switch(e.tipo){case D.EMAIL:return o.jsx(Tt,{name:t,control:r,type:"email",placeholder:e.placeholder,disabled:s,readOnly:i});case D.NUMBER:return o.jsx(Tt,{name:t,control:r,type:"number",placeholder:e.placeholder,disabled:s,readOnly:i});case D.PASSWORD:return o.jsx(Tt,{name:t,control:r,type:"password",placeholder:e.placeholder,disabled:s,readOnly:i});case D.TELEFONE:return o.jsx(_r,{name:t,control:r,maskType:"telefone",placeholder:e.placeholder??"(00) 00000-0000",disabled:s,readOnly:i});case D.CPF:return o.jsx(_r,{name:t,control:r,maskType:"cpf",placeholder:e.placeholder??"000.000.000-00",disabled:s,readOnly:i});case D.CEP:return o.jsx(_r,{name:t,control:r,maskType:"cep",placeholder:e.placeholder??"00000-000",disabled:s,readOnly:i});case D.TEXTAREA:return o.jsx(zo,{name:t,control:r,placeholder:e.placeholder,disabled:s,readOnly:i});case D.SELECT:return o.jsx(Lo,{name:t,control:r,options:e.opcoes??[],placeholder:e.placeholder,disabled:s,readOnly:i});case D.CHECKBOX:return o.jsx(Mo,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case D.SWITCH:return o.jsx(jh,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case D.DATE:return o.jsx(Tn,{name:t,control:r,disabled:s,readOnly:i});case D.TIME:return o.jsx(kh,{name:t,control:r,disabled:s,readOnly:i});case D.HIDDEN:return o.jsx(Bo,{name:t,control:r});default:return o.jsx(Tt,{name:t,control:r,type:"text",placeholder:e.placeholder,disabled:s,readOnly:i})}},Rk=({name:e,control:t,subSchema:r,disabled:n,readOnly:a})=>{if(!r||r.fields.length===0)return null;const s=[...r.fields].sort((i,l)=>i.ordem-l.ordem);return o.jsxs("div",{className:"rounded-xl border border-input bg-muted/30 p-4 space-y-4",children:[r.titulo&&o.jsx("h4",{className:"text-sm font-semibold text-muted-foreground",children:r.titulo}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:s.map(i=>{const l=`${e}.${i.nome}`,c=i.tipo===D.CHECKBOX||i.tipo===D.SWITCH||i.tipo===D.HIDDEN,d=i.tamanho??6;return o.jsxs("div",{className:`col-span-${d}`,children:[!c&&o.jsxs("label",{className:"mb-1 block text-sm font-medium text-foreground",children:[i.label,i.obrigatorio&&o.jsx("span",{className:"text-destructive",children:" *"})]}),o.jsx(Dk,{field:i,name:l,control:t,disabled:n,readOnly:a})]},i.id)})})]})},Ch=({field:e,control:t,nameOverride:r})=>{var n,a;const s=r??e.nome,{componentMapper:i}=Cr(),l=i==null?void 0:i[e.tipo];if(l)return o.jsx(l,{name:s,control:t,field:e});const c={name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly};switch(e.tipo){case D.TEXTO:return o.jsx(Tt,{...c,type:"text"});case D.EMAIL:return o.jsx(Tt,{...c,type:"email"});case D.NUMBER:return o.jsx(Tt,{...c,type:"number"});case D.PASSWORD:return o.jsx(Nk,{...c});case D.TEXTAREA:return o.jsx(zo,{...c});case D.SELECT:return o.jsx(Lo,{...c,options:e.opcoes??[]});case D.AUTOCOMPLETE:return o.jsx(Ek,{...c,options:e.opcoes??[]});case D.SWITCH:return o.jsx(jh,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.SLIDER:return o.jsx(Sk,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.RATING:return o.jsx(Ak,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.COLOR:return o.jsx($k,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.TIME:return o.jsx(kh,{...c});case D.DATE_RANGE:return o.jsx(Tk,{name:s,control:t,startLabel:e.dateRangeStartLabel,endLabel:e.dateRangeEndLabel,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.RADIO:return o.jsx(dl,{...c,options:e.opcoes??[]});case D.CHECKBOX:return o.jsx(Mo,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.CHECKBOX_GROUP:return o.jsx(cl,{...c,options:e.opcoes??[]});case D.DATE:return o.jsx(Tn,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case D.DATETIME:return o.jsx(Tn,{name:s,control:t,isDatetime:!0,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case D.FILE:return o.jsx(xl,{name:s,control:t,disabled:e.isDisabled,fileTypes:(n=e.validacao)==null?void 0:n.fileTypes,maxFileSize:(a=e.validacao)==null?void 0:a.maxFileSize});case D.TELEFONE:return o.jsx(_r,{...c,maskType:"telefone"});case D.CPF:return o.jsx(_r,{...c,maskType:"cpf"});case D.CEP:return o.jsx(gl,{name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly,cepFillMap:e.cepFillMap});case D.HIDDEN:return o.jsx(Bo,{name:s,control:t});case D.PARTICIPATION_TYPE:return o.jsx(gh,{name:s,control:t});case D.PAYMENT_METHOD:return o.jsx(yh,{name:s,control:t,relatedFieldName:e.relatedFieldName});case D.TERMS:return o.jsx(wh,{name:s,control:t,label:e.label,termoTexto:e.termoTexto,termoPdfUrl:e.termoPdfUrl,termoPdfUploadId:e.termoPdfUploadId});case D.FIELD_ARRAY:return o.jsx(xh,{name:s,control:t,subFields:e.subFields,minItems:e.minItems,maxItems:e.maxItems,itemLabel:e.itemLabel,addLabel:e.addLabel});case D.SUB_FORM:return o.jsx(Rk,{name:s,control:t,subSchema:e.subSchema,disabled:e.isDisabled,readOnly:e.isReadOnly});default:return o.jsx(Tt,{...c,type:"text"})}},Pk=({container:e,control:t})=>{var r;const{externalData:n={},fieldResolvers:a}=Cr(),s=e.icone?Pt[e.icone]:void 0,i=n,l=N.useMemo(()=>Fo(e,i),[e,JSON.stringify(i)]),c=N.useMemo(()=>[...l.campos].sort((x,b)=>x.ordem-b.ordem),[l.campos]),d=Ee.useWatch({control:t}),{wrapperClass:u,wrapperStyle:m,headerClass:p,headerStyle:f,tmpl:v}=lh(),h=x=>{if(!$e(x.condicional,d,n))return null;let b=x;if(x.resolvePropsKey&&a!=null&&a[x.resolvePropsKey]){const S=a[x.resolvePropsKey](x,d,n);b={...x,...S}}if(b.opcoesFromVar){const S=n[b.opcoesFromVar];Array.isArray(S)&&(b={...b,opcoes:S.map($=>typeof $=="string"?{valor:$,label:$}:$&&typeof $=="object"&&"valor"in $&&"label"in $?$:{valor:String($),label:String($)})})}const y=b.tamanho??12,j=b.inicioColuna,w=j?`${j} / span ${y}`:`span ${y}`,C=o.jsx(Ch,{field:b,control:t});return b.tipo===D.CHECKBOX||b.tipo===D.HIDDEN||b.tipo===D.SWITCH?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:w},children:C},b.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:w},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[b.label,b.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),C,b.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:b.hint})]},b.id)};return o.jsxs("div",{className:u,style:m,children:[(l.titulo||s)&&o.jsx("div",{className:p,style:f,children:o.jsxs("div",{className:"flex items-center gap-3",children:[s&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(s,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=v.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:l.titulo}),l.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:l.descricao})]})]})}),o.jsx("div",{className:"p-6 grid grid-cols-12 gap-4",children:c.map(h)})]})},_k=({container:e,control:t})=>{var r;const{externalData:n={}}=Cr(),a=e.nome??"__invalid__",s=e.minItems??1,i=e.maxItems,l=e.itemLabel??"Item",c=e.icone?Pt[e.icone]:void 0,d=n,u=N.useMemo(()=>Fo(e,d),[e,JSON.stringify(d)]),m=N.useMemo(()=>[...u.campos].sort((k,E)=>k.ordem-E.ordem),[u.campos]),p=N.useCallback(()=>{const k={};for(const E of m)E.initialValue!==void 0?k[E.nome]=typeof E.initialValue=="string"?xt(E.initialValue,d):E.initialValue:E.defaultValue!==void 0&&(k[E.nome]=E.defaultValue);return k},[m,d]),{fields:f,append:v,remove:h}=Ee.useFieldArray({control:t,name:a});N.useEffect(()=>{if(e.nome&&f.length<s)for(let k=f.length;k<s;k++)v(p())},[s]);const x=Ee.useWatch({control:t}),b=N.useMemo(()=>{const k=x[a];return Array.isArray(k)?k:[]},[x,a]),{wrapperClass:y,wrapperStyle:j,headerClass:w,headerStyle:C,tmpl:S}=lh();if(!e.nome)return console.error("[RepeatableContainerRenderer] container.nome é obrigatório para containers repetíveis. Container id:",e.id),null;const $=(k,E)=>{const T=b[E]??{};if(!$e(k.condicional,T,n))return null;const O=`${a}.${E}.${k.nome}`,L=k.tamanho??12,A=k.inicioColuna,z=A?`${A} / span ${L}`:`span ${L}`,X=o.jsx(Ch,{field:k,control:t,nameOverride:O});return k.tipo===D.CHECKBOX||k.tipo===D.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:z},children:X},`${k.id}-${E}`):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:z},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[k.label,k.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),X,k.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:k.hint})]},`${k.id}-${E}`)};return o.jsxs("div",{className:y,style:j,children:[(u.titulo||c)&&o.jsx("div",{className:w,style:C,children:o.jsxs("div",{className:"flex items-center gap-3",children:[c&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(c,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=S.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:u.titulo}),u.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:u.descricao})]})]})}),o.jsxs("div",{className:"p-6 space-y-4",children:[f.map((k,E)=>o.jsxs("div",{className:"border border-input rounded-lg p-4 bg-muted/30",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 bg-primary text-primary-foreground",children:E+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[l," ",E+1]})]}),f.length>s&&o.jsx("button",{type:"button",onClick:()=>h(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:o.jsx(I.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:m.map(T=>$(T,E))})]},k.id)),(!i||f.length<i)&&o.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:()=>v(p()),children:[o.jsx(I.Plus,{className:"w-4 h-4"}),"Adicionar ",l.toLowerCase()]}),i&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",i," ",l.toLowerCase(),i>1?"s":""]})]})]})},Nh=e=>e.container.repeatable&&e.container.nome?o.jsx(_k,{...e}):o.jsx(Pk,{...e}),Sh=({step:e,control:t,externalData:r={}})=>{const n=N.useMemo(()=>[...e.containers].sort((s,i)=>s.ordem-i.ordem),[e.containers]),a=Ee.useWatch({control:t});return o.jsx("div",{className:"grid grid-cols-12 gap-4",children:n.map(s=>{if(s.condicional&&!$e(s.condicional,a,r))return null;const i=s.tamanho??12,l=s.inicioColuna,c=l?`${l} / span ${i}`:`span ${i}`;return o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:c},children:o.jsx(Nh,{container:s,control:t})},s.id)})})},ua=N.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),Ik=ua.Provider,Ok=()=>{const e=Eh("useFormApi"),t=N.useContext(ua);return{change:(r,n)=>e.setValue(r,n,{shouldValidate:!0,shouldDirty:!0}),reset:r=>e.reset(r),submit:t.requestSubmit,getState:()=>{const{errors:r,isDirty:n,isValid:a}=e.formState;return{values:e.getValues(),errors:Object.fromEntries(Object.entries(r).map(([s,i])=>[s,i==null?void 0:i.message])),warnings:t.warnings,dirty:n,valid:a,submitting:t.submitting}}}},$h=()=>{const e=Eh("useFormState"),t=N.useContext(ua),r=Ee.useWatch({control:e.control}),{errors:n,isDirty:a,isValid:s}=e.formState;return{values:r,errors:Object.fromEntries(Object.entries(n).map(([i,l])=>[i,l==null?void 0:l.message])),warnings:t.warnings,dirty:a,valid:s,submitting:t.submitting}},Fk=e=>{var t;const r=Ee.useFormContext(),{warnings:n}=N.useContext(ua),a=Ee.useWatch({control:r.control,name:e}),s=r.getFieldState(e,r.formState);return{value:a,error:(t=s.error)==null?void 0:t.message,warning:n[e],dirty:s.isDirty,touched:s.isTouched,valid:!s.error}},zk=e=>{var t;const{control:r}=Ee.useFormContext(),{warnings:n}=N.useContext(ua),{field:a,fieldState:s}=Ee.useController({name:e,control:r});return{input:{name:a.name,value:a.value,onChange:a.onChange,onBlur:a.onBlur,ref:a.ref},meta:{error:(t=s.error)==null?void 0:t.message,warning:n[e],touched:s.isTouched,dirty:s.isDirty,valid:!s.error}}},Eh=e=>{const t=Ee.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},sd=({stepIndex:e,totalSteps:t,step:r,defaultValues:n,externalData:a,fieldErrors:s,isSubmitting:i,submitError:l,validatorMapper:c={},onWarningsChange:d,onValuesChange:u,onSubmit:m,onBack:p})=>{const f=e===t-1,v=N.useMemo(()=>JSON.stringify(a),[a]),h=N.useMemo(()=>ah(r,a,c),[r.id,v]),x=N.useMemo(()=>oh(r,a,c),[r.id,v]),[b,y]=N.useState({}),j=N.useRef(d);j.current=d;const w=a,C=N.useMemo(()=>ih(r,w),[r,v]),S=Ee.useForm({resolver:h,defaultValues:n,mode:"onTouched"}),{control:$,handleSubmit:k,setError:E,clearErrors:T,setValue:O}=S;N.useEffect(()=>{T();for(const[U,Q]of Object.entries(s))E(U,{type:"server",message:Q})},[s,E,T]);const L=N.useMemo(()=>r.containers.filter(U=>!U.repeatable).flatMap(U=>U.campos).filter(U=>!!U.condicional),[r.containers]),A=N.useMemo(()=>r.containers.filter(U=>!!U.condicional),[r.containers]),z=N.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]),X=N.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]),q=N.useRef({}),Z=N.useRef(!0),V=Ee.useWatch({control:$}),M=N.useRef(u);M.current=u,N.useEffect(()=>{var U;(U=M.current)==null||U.call(M,V)},[V]),N.useEffect(()=>{let U=!1;return x(V).then(Q=>{var Y;U||(y(Q),(Y=j.current)==null||Y.call(j,Q))}).catch(Q=>{U||console.error("[StepForm] warnComputer error:",Q)}),()=>{U=!0}},[V,x]),N.useEffect(()=>{var U;if(!L.length&&!z.length&&!A.length&&!X.length)return;const Q=V;for(const H of L)if(!$e(H.condicional,Q,a)){if(T(H.nome),H.tipo===D.FIELD_ARRAY){const W=Q[H.nome];Array.isArray(W)&&W.forEach((G,ne)=>{(H.subFields??[]).forEach(J=>T(`${H.nome}.${ne}.${J.nome}`))})}if(H.clearedValue!==void 0){const W=H.clearedValue??"";Q[H.nome]!==W&&O(H.nome,W,{shouldValidate:!1})}}for(const H of A)if(!$e(H.condicional,Q,a))if(H.repeatable&&H.nome)(Array.isArray(Q[H.nome])?Q[H.nome]:[]).forEach((W,G)=>{for(const ne of H.campos)T(`${H.nome}.${G}.${ne.nome}`)});else for(const W of H.campos){T(W.nome);const G=W.clearedValue!==void 0?W.clearedValue:void 0;G!==void 0&&Q[W.nome]!==G&&O(W.nome,G,{shouldValidate:!1})}for(const{container:H,fields:W}of X){const G=H.nome,ne=Array.isArray(Q[G])?Q[G]:[];for(let J=0;J<ne.length;J++){const te=ne[J];for(const ce of W)if(!$e(ce.condicional,te,a)&&(T(`${G}.${J}.${ce.nome}`),ce.clearedValue!==void 0)){const be=ce.clearedValue??"";te[ce.nome]!==be&&O(`${G}.${J}.${ce.nome}`,be,{shouldValidate:!1})}}}const Y=Z.current;for(const H of z){const W=$e(H.condicional,Q,a),G=Y?W:q.current[H.nome]??!1;if(W&&!G&&(U=H.setValues)!=null&&U.length)for(const ne of H.setValues){const J=typeof ne.valor=="string"?xt(ne.valor,w):ne.valor;O(ne.campo,J,{shouldValidate:!1})}q.current[H.nome]=W}Z.current=!1},[V,L,z,A,X,a,O,T]);const _=C.icone?Pt[C.icone]:void 0,se=N.useMemo(()=>()=>{S.handleSubmit(m)()},[m]);return o.jsx(Ee.FormProvider,{...S,children:o.jsx(Ik,{value:{submitting:i,warnings:b,requestSubmit:se},children:o.jsx("form",{onSubmit:k(m),noValidate:!0,onKeyDown:U=>{U.key==="Enter"&&U.target.tagName==="INPUT"&&U.preventDefault()},children:o.jsxs("div",{className:"space-y-6",children:[C.showLabel!==!1&&o.jsxs("div",{className:"text-center space-y-2",children:[_&&o.jsx("div",{className:"w-12 h-12 mx-auto rounded-xl flex items-center justify-center",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(_,{className:"w-6 h-6",style:{color:"var(--t-primary)"}})}),o.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:C.titulo}),C.descricao&&o.jsx("p",{className:"text-sm text-muted-foreground",children:C.descricao})]}),o.jsx(Sh,{step:C,control:$,externalData:a}),o.jsxs("div",{className:"flex items-center justify-between gap-4 pt-6 pb-2",children:[o.jsxs(Ae,{type:"button",variant:"outline",onClick:p,disabled:e===0,className:K(e>0&&"border-primary/40 text-primary hover:bg-primary/5"),children:[o.jsx(I.ChevronLeft,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),o.jsxs("span",{className:"text-xs font-semibold tabular-nums sm:hidden text-muted-foreground",children:[e+1,"/",t]}),o.jsxs(Ae,{type:"submit",disabled:i,children:[i?o.jsx(I.Loader2,{className:"w-4 h-4 animate-spin"}):f?o.jsx(I.Check,{className:"w-4 h-4"}):o.jsx(I.ChevronRight,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:f?"Finalizar":"Próximo"})]})]}),l&&o.jsx("p",{className:"text-sm text-destructive mt-2 text-center",children:l})]})})})})},Za=e=>{if(e)return Pt[e]},Lk=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:s=>s.key==="Enter"&&(r==null?void 0:r(a)),className:K("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:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(I.Check,{className:"w-4 h-4"}):a+1},n.id))}),Mk=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>{const s=Za(n.icone)??I.CircleDot;return o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:i=>i.key==="Enter"&&(r==null?void 0:r(a)),className:K("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(I.Check,{className:"w-4 h-4"}):o.jsx(s,{className:"w-4 h-4"})},n.id)})}),Vk=({steps:e,currentStep:t,position:r,orientation:n="horizontal",onStepClick:a})=>n==="vertical"?o.jsx("div",{className:"flex flex-col gap-0",children:e.map((s,i)=>{const l=Za(s.icone)??I.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:K("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#fff",boxShadow:"0 0 10px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#fff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(I.Check,{className:"w-3.5 h-3.5"}):o.jsx(l,{className:"w-3.5 h-3.5"})}),!u&&o.jsx("div",{className:"w-[2px] my-1",style:{height:"24px",background:d?"#22c55e":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]}),o.jsx("span",{className:"text-sm font-medium leading-tight mt-1.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]},s.id)})}):o.jsx("div",{className:"w-full flex items-start",children:e.map((s,i)=>{const l=Za(s.icone)??I.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:K("flex items-start",!u&&"flex-1"),children:[o.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:K("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 12px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#ffffff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(I.Check,{className:"w-4 h-4"}):o.jsx(l,{className:"w-4 h-4"})}),o.jsx("span",{className:"text-[10px] font-medium text-center leading-tight line-clamp-2 px-0.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]}),!u&&o.jsx("div",{className:"flex-1 h-[1.5px] mt-5 mx-1",style:{background:d?"linear-gradient(90deg, var(--t-primary), color-mix(in srgb, var(--t-primary) 40%, transparent))":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]},s.id)})}),Th=({steps:e,currentStep:t,onStepClick:r,className:n,forceShow:a})=>{const s=ra(),{layout:i}=s;if(!i.showStepIndicators||e.length<=1&&!a)return null;const l=i.stepIndicatorVariant??"numbers",c=i.stepIndicatorPosition??"top-center",d=i.stepIndicatorOrientation??"horizontal",u=(t+1)/e.length*100,m=e[t],p=Za(m==null?void 0:m.icone)??I.CircleDot,f=o.jsx("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"color-mix(in srgb, var(--t-primary) 15%, transparent)"},children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${u}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),v=o.jsxs("div",{className:"block sm:hidden space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:o.jsx(p,{className:"w-5 h-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:(m==null?void 0:m.label)??(m==null?void 0:m.id)}),o.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),f]}),h=o.jsxs("div",{className:"hidden sm:block",children:[l==="numbers"&&o.jsx(Lk,{steps:e,currentStep:t,onStepClick:r}),l==="icons"&&o.jsx(Mk,{steps:e,currentStep:t,onStepClick:r}),l==="icons-labeled"&&o.jsx(Vk,{steps:e,currentStep:t,position:c,orientation:d,onStepClick:r})]}),x=i.showProgressBar?o.jsx("div",{className:"hidden sm:block",children:f}):null;return d==="vertical"?o.jsxs("div",{className:K("flex gap-6 items-start",n),children:[v,o.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[h,x&&o.jsx("div",{className:"flex-1 pt-4",children:x})]})]}):o.jsxs("div",{className:K("space-y-3",n),children:[v,o.jsxs("div",{className:"hidden sm:block space-y-3",children:[h,x]})]})},Bk=(e,t,r)=>{var n;const a={...t},s=r;for(const i of e.containers){for(const l of i.campos)if(a[l.nome]===void 0&&(l.initialValue!==void 0?a[l.nome]=typeof l.initialValue=="string"?xt(l.initialValue,s):l.initialValue:l.defaultValue!==void 0&&(a[l.nome]=l.defaultValue)),l.tipo===D.FIELD_ARRAY&&(n=l.subFields)!=null&&n.length){const c=a[l.nome];Array.isArray(c)&&c.length>0&&(a[l.nome]=c.map(d=>{const u={...d};for(const m of l.subFields)u[m.nome]===void 0&&(m.initialValue!==void 0?u[m.nome]=typeof m.initialValue=="string"?xt(m.initialValue,s):m.initialValue:m.defaultValue!==void 0&&(u[m.nome]=m.defaultValue));return u}))}if(i.repeatable&&i.nome){const l=a[i.nome];Array.isArray(l)&&l.length>0&&(a[i.nome]=l.map(c=>{const d={...c};for(const u of i.campos)d[u.nome]===void 0&&(u.initialValue!==void 0?d[u.nome]=typeof u.initialValue=="string"?xt(u.initialValue,s):u.initialValue:u.defaultValue!==void 0&&(d[u.nome]=u.defaultValue));return d}))}}return a},Uk=({schema:e,initialValues:t={},initialStep:r=0,onSubmitStep:n,onComplete:a,template:s,formTitle:i,externalData:l={},fieldErrors:c={},uploadFile:d,deleteUploadedFile:u,cepLookup:m,resolveTermsUploadUrl:p,fieldResolvers:f,validatorMapper:v,componentMapper:h,paymentMethodOptions:x,onValuesChange:b,className:y,StepIndicator:j=Th})=>{const[w,C]=N.useState(()=>r),[S,$]=N.useState({...t}),[k,E]=N.useState(()=>r),[T,O]=N.useState(!1),[L,A]=N.useState(null),[z,X]=N.useState({}),q=N.useRef(p);q.current=p;const Z=N.useCallback(me=>q.current(me),[]),V=!!p,M=N.useRef(u);M.current=u;const _=N.useCallback(me=>M.current(me),[]),se=!!u,U=N.useMemo(()=>JSON.stringify(l),[l]),Q=N.useMemo(()=>JSON.stringify(e.stepConfig),[e.stepConfig]),Y=N.useMemo(()=>{const me=oo(s);return e.stepConfig?{...me,layout:{...me.layout,...e.stepConfig}}:me},[s,Q]),H=N.useMemo(()=>[...e.steps].sort((me,Te)=>me.ordem-Te.ordem),[e.steps]),W=H.length,G=W>0?H[Math.min(w,W-1)]:null,ne=N.useMemo(()=>G?Bk(G,S,l):{},[G,S,U]),J=N.useMemo(()=>({uploadFile:d,deleteUploadedFile:se?_:void 0,cepLookup:m,resolveTermsUploadUrl:V?Z:void 0,externalData:l,fieldResolvers:f,validatorMapper:v,fieldWarnings:z,componentMapper:h,paymentMethodOptions:x}),[d,se,_,m,Z,V,f,v,z,h,x,U]),te=N.useCallback(async me=>{if(!T){O(!0),A(null);try{const{cleaned:Te,fileIdsToDelete:ze}=bi(G,me,l);ze.length&&u&&await Promise.allSettled(ze.map(Ve=>u(Ve)));const dt={...S,...Te};if($(dt),n&&await n(w,Te),w===W-1)a&&await a(dt);else{const Ve=w+1;C(Ve),E(P=>Math.max(P,Ve))}}catch(Te){console.error("[FormRenderer] Submit error:",Te);const ze=Te instanceof Error?Te.message:"Ocorreu um erro. Tente novamente.";A(ze)}finally{O(!1)}}},[w,S,T,W,n,a,G,l,u]),ce=N.useCallback(()=>{w>0&&C(me=>me-1)},[w]);if(!G)return o.jsx(Ga.Provider,{value:J,children:o.jsx(Kn,{config:Y,className:`min-h-dvh ${Y.wrapperClass??""} ${y??""}`,renderWrapper:!0,children:o.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 be=Y.layout.eventTitleStyle??"bar",Ce=(Y.layout.stepIndicatorOrientation??"horizontal")==="vertical",ve=W>=1?o.jsx(j,{steps:H.map(me=>({id:me.id,label:me.titulo,icone:me.icone})),currentStep:w,onStepClick:me=>{me!==w&&me<=k&&C(me)}}):null;return o.jsx(Ga.Provider,{value:J,children:o.jsx(Kn,{config:Y,className:`min-h-dvh ${Y.wrapperClass??""} ${y??""}`,renderWrapper:!0,children:o.jsxs("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6",children:[i&&be==="bar"&&o.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:i}),i&&be==="inline"&&o.jsxs("div",{className:"text-center mb-6",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest mb-1",style:{color:"var(--t-text-muted)"},children:"Inscrição"}),o.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:i}),o.jsx("div",{className:"h-0.5 w-12 mx-auto mt-3 rounded-full",style:{background:"var(--t-primary)"}})]}),Ce?o.jsxs("div",{className:"flex gap-6 items-start",children:[o.jsx("div",{className:"hidden sm:block shrink-0 w-44 pt-1",children:ve}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"sm:hidden mb-6",children:ve}),o.jsx(sd,{stepIndex:w,totalSteps:W,step:G,defaultValues:ne,externalData:l,fieldErrors:c,isSubmitting:T,submitError:L,validatorMapper:v,onWarningsChange:X,onValuesChange:b,onSubmit:te,onBack:ce},w)]})]}):o.jsxs(o.Fragment,{children:[ve&&o.jsx("div",{className:"mb-8",children:ve}),o.jsx(sd,{stepIndex:w,totalSteps:W,step:G,defaultValues:ne,externalData:l,fieldErrors:c,isSubmitting:T,submitError:L,validatorMapper:v,onWarningsChange:X,onValuesChange:b,onSubmit:te,onBack:ce},w)]})]})})})},Hk=({children:e,render:t,onChange:r})=>{const n=$h(),a=N.useRef(r);return a.current=r,N.useEffect(()=>{var s;(s=a.current)==null||s.call(a,n)},[n.values,n.dirty,n.valid,n.submitting,n.errors,n.warnings]),t?o.jsx(o.Fragment,{children:t(n)}):typeof e=="function"?o.jsx(o.Fragment,{children:e(n)}):e!==void 0?o.jsx(o.Fragment,{children:e}):null},Ir=[{component:"texto",label:"Texto",icon:I.Type,group:"texto"},{component:"textarea",label:"Área de texto",icon:I.AlignLeft,group:"texto"},{component:"number",label:"Número",icon:I.Hash,group:"texto"},{component:"email",label:"E-mail",icon:I.Mail,group:"texto"},{component:"password",label:"Senha",icon:I.Lock,group:"texto"},{component:"select",label:"Seleção",icon:I.ChevronDown,group:"selecao"},{component:"autocomplete",label:"Autocomplete",icon:I.Search,group:"selecao"},{component:"radio",label:"Radio",icon:I.CircleDot,group:"selecao"},{component:"checkbox",label:"Checkbox",icon:I.CheckSquare,group:"selecao"},{component:"checkbox_group",label:"Grupo de checkboxes",icon:I.ListChecks,group:"selecao"},{component:"switch",label:"Switch (toggle)",icon:I.ToggleLeft,group:"selecao"},{component:"slider",label:"Slider",icon:I.SlidersHorizontal,group:"range"},{component:"rating",label:"Avaliação (estrelas)",icon:I.Star,group:"range"},{component:"color",label:"Cor",icon:I.Palette,group:"range"},{component:"date",label:"Data",icon:I.Calendar,group:"data"},{component:"datetime",label:"Data e hora",icon:I.Clock,group:"data"},{component:"time",label:"Horário",icon:I.Timer,group:"data"},{component:"date_range",label:"Período",icon:I.CalendarRange,group:"data"},{component:"telefone",label:"Telefone",icon:I.Phone,group:"contato"},{component:"cpf",label:"CPF",icon:I.CreditCard,group:"contato"},{component:"cep",label:"CEP",icon:I.MapPin,group:"contato"},{component:"file",label:"Arquivo",icon:I.Upload,group:"outros"},{component:"hidden",label:"Oculto",icon:I.EyeOff,group:"outros"},{component:"field_array",label:"Lista de itens",icon:I.List,group:"outros"},{component:"terms",label:"Termos e condições",icon:I.ScrollText,group:"outros"},{component:"sub_form",label:"Sub-formulário",icon:I.LayoutList,group:"outros"}],vl=[{component:"step",label:"Step",icon:I.Layers,color:"border-primary/40 bg-primary/5"},{component:"container",label:"Container",icon:I.BoxSelect,color:"border-blue-500/40 bg-blue-500/5"}],bl=[{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"}],qe=e=>e.startsWith("step-")||e==="step"?"step":e.startsWith("container-")||e==="container"?"container":"field",Wk=e=>Ir.find(t=>t.component===e),Ah=e=>{const t=Ir.map(n=>n.component).filter(n=>n.includes("_"));for(const n of t)if(e.startsWith(n))return Ir.find(a=>a.component===n);const r=e.split("-")[0];return Ir.find(n=>n.component===r)},bs=e=>({when:e.campoId,operator:e.operador,value:e.valor,source:e.source}),Dh=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 n=e.extraConditions.map(s=>({campoId:s.when,operador:s.operator,valor:s.value,source:s.source})),a=[r,...n];return e.logicOperator==="or"?{or:a}:{and:a}}return r},Rh=e=>{if("campoId"in e)return bs(e);const t=("and"in e?e.and:e.or)??[];if(t.length===0)return;const r="and"in e?"and":"or",[n,...a]=t;if(!("campoId"in n)){console.warn("[formSchemaToBuilder] Condicional com grupo aninhado detectada — não suportado no editor visual. A condicional será removida.",e);return}const s=bs(n);return a.length===0?s:{...s,logicOperator:r,extraConditions:a.filter(i=>"campoId"in i).map(bs)}},Ka=(e,t)=>{var r;if("campoId"in e){const n=(r=t[e.campoId])==null?void 0:r.name;return n?{...e,campoId:n}:e}return"and"in e&&Array.isArray(e.and)?{and:e.and.map(n=>Ka(n,t))}:"or"in e&&Array.isArray(e.or)?{or:e.or.map(n=>Ka(n,t))}:e},yl=(e,t,r)=>{var n,a;const s=l=>t[l]||{label:l,name:l},i=(((a=(n=e==null?void 0:e.containers)==null?void 0:n.root)==null?void 0:a.children)||[]).filter(l=>qe(l)==="step").map((l,c)=>{var d,u;const m=s(l),p=(((u=(d=e==null?void 0:e.containers)==null?void 0:d[l])==null?void 0:u.children)||[]).filter(f=>qe(f)==="container").map((f,v)=>{var h,x;const b=s(f),y=(((x=(h=e==null?void 0:e.containers)==null?void 0:h[f])==null?void 0:x.children)||[]).filter(w=>qe(w)==="field").map((w,C)=>{var S,$;const k=s(w),E=ai(k,w,C);if(E.condicional&&(E.condicional=Ka(E.condicional,t)),E.tipo===D.FIELD_ARRAY){const T=(($=(S=e==null?void 0:e.containers)==null?void 0:S[w])==null?void 0:$.children)??[];E.subFields=T.filter(O=>qe(O)==="field").map((O,L)=>ai(s(O),O,L))}return E}),j={id:f,titulo:b.label||"Container",descricao:b.description,icone:b.icone,ordem:v,colunas:b.columns||2,tamanho:b.tamanho||12,inicioColuna:b.inicioColuna,showLabel:b.showLabel,showAsCard:b.showAsCard,campos:y};return b.condition&&(j.condicional=Ka(Dh(b.condition),t)),j});return{id:l,titulo:m.label||"Step",descricao:m.description,icone:m.icone,ordem:c,showLabel:m.showLabel,containers:p}});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:i}},ai=(e,t,r)=>{var n,a,s,i;const l={id:t,nome:e.name||t,label:e.label||"",tipo:e.fieldType||"texto",obrigatorio:e.required||!1,tamanho:e.tamanho||6,inicioColuna:e.inicioColuna,ordem:r,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!==void 0?e.clearedValue:void 0,initialValue:e.initialValue!==void 0?e.initialValue:void 0,resolvePropsKey:e.resolvePropsKey||void 0};if((n=e.validate)!=null&&n.length&&(l.validate=e.validate),(a=e.warn)!=null&&a.length&&(l.warn=e.warn),(s=e.options)!=null&&s.length&&(l.opcoes=e.options.map(c=>({valor:c.value,label:c.label,disabled:c.disabled}))),e.validation){const c=e.validation;l.validacao={},c.minLength!==void 0&&(l.validacao.minLength=c.minLength),c.maxLength!==void 0&&(l.validacao.maxLength=c.maxLength),c.min!==void 0&&(l.validacao.min=c.min),c.max!==void 0&&(l.validacao.max=c.max),c.regex&&(l.validacao.regex=c.regex),c.regexMessage&&(l.validacao.regexMessage=c.regexMessage),c.minDate&&(l.validacao.minDate=c.minDate),c.maxDate&&(l.validacao.maxDate=c.maxDate),c.minAge!==void 0&&(l.validacao.minAge=c.minAge),c.maxAge!==void 0&&(l.validacao.maxAge=c.maxAge),(i=c.fileTypes)!=null&&i.length&&(l.validacao.fileTypes=c.fileTypes),c.maxFileSize!==void 0&&(l.validacao.maxFileSize=c.maxFileSize)}if(l.tipo===D.FIELD_ARRAY&&(e.itemLabel&&(l.itemLabel=e.itemLabel),e.minItems!==void 0&&(l.minItems=e.minItems),e.maxItems!==void 0&&(l.maxItems=e.maxItems),e.addLabel&&(l.addLabel=e.addLabel)),l.tipo===D.TERMS&&(e.termoTexto&&(l.termoTexto=e.termoTexto),e.termoPdfUrl&&(l.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(l.termoPdfUploadId=e.termoPdfUploadId)),l.tipo===D.SLIDER&&(e.step!==void 0&&(l.step=e.step),e.minValue!==void 0&&(l.minValue=e.minValue),e.maxValue!==void 0&&(l.maxValue=e.maxValue)),l.tipo===D.RATING&&e.maxRating!==void 0&&(l.maxRating=e.maxRating),l.tipo===D.DATE_RANGE&&(e.dateRangeStartLabel&&(l.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(l.dateRangeEndLabel=e.dateRangeEndLabel)),l.tipo===D.SUB_FORM){const c=e.subSchemaFields??[];(c.length>0||e.subSchemaTitle)&&(l.subSchema={titulo:e.subSchemaTitle,fields:c.map((d,u)=>ai(d,d.name??`subfield-${u}`,u))})}return e.condition&&(l.condicional=Dh(e.condition)),l},Ph=e=>{const t={},r={root:{children:[]}},n=[...e.steps].sort((a,s)=>a.ordem-s.ordem);for(const a of n){const s=a.id||`step-${Nt()}`;r.root.children.push(s),t[s]={label:a.titulo,name:s,fieldType:"step",description:a.descricao,icone:a.icone,showLabel:a.showLabel};const i=[],l=[...a.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l){const d=c.id||`container-${Nt()}`;i.push(d);const u=c.condicional?Rh(c.condicional):void 0;t[d]={label:c.titulo,name:d,fieldType:"container",description:c.descricao,icone:c.icone,columns:c.colunas,tamanho:c.tamanho||12,inicioColuna:c.inicioColuna,showLabel:c.showLabel,showAsCard:c.showAsCard,...u?{condition:u}:{}};const m=[],p=[...c.campos].sort((f,v)=>f.ordem-v.ordem);for(const f of p){const v=f.id||`${f.tipo}-${Nt()}`;if(m.push(v),t[v]=oi(f),f.tipo===D.FIELD_ARRAY){const h=[];for(const x of f.subFields??[]){const b=x.id||`${x.tipo}-${Nt()}`;h.push(b),t[b]=oi(x)}r[v]={children:h}}}r[d]={children:m}}r[s]={children:i}}return{dndState:{containers:r},configs:t,templateId:e.template??null,stepConfig:e.stepConfig}},oi=(e,t)=>{var r,n,a,s;const i={label:e.label,name:e.nome,fieldType:e.tipo,required:e.obrigatorio,tamanho:e.tamanho,inicioColuna:e.inicioColuna,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!==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:(n=e.warn)!=null&&n.length?e.warn:void 0};if((a=e.opcoes)!=null&&a.length&&(i.options=e.opcoes.map(l=>({value:l.valor,label:l.label,disabled:l.disabled}))),e.validacao){const l=e.validacao;i.validation={},l.minLength!==void 0&&(i.validation.minLength=l.minLength),l.maxLength!==void 0&&(i.validation.maxLength=l.maxLength),l.min!==void 0&&(i.validation.min=l.min),l.max!==void 0&&(i.validation.max=l.max),l.regex&&(i.validation.regex=l.regex),l.regexMessage&&(i.validation.regexMessage=l.regexMessage),l.minDate&&(i.validation.minDate=l.minDate),l.maxDate&&(i.validation.maxDate=l.maxDate),l.minAge!==void 0&&(i.validation.minAge=l.minAge),l.maxAge!==void 0&&(i.validation.maxAge=l.maxAge),(s=l.fileTypes)!=null&&s.length&&(i.validation.fileTypes=l.fileTypes),l.maxFileSize!==void 0&&(i.validation.maxFileSize=l.maxFileSize)}if(e.tipo===D.FIELD_ARRAY&&(e.itemLabel&&(i.itemLabel=e.itemLabel),e.minItems!==void 0&&(i.minItems=e.minItems),e.maxItems!==void 0&&(i.maxItems=e.maxItems),e.addLabel&&(i.addLabel=e.addLabel)),e.tipo===D.TERMS&&(e.termoTexto&&(i.termoTexto=e.termoTexto),e.termoPdfUrl&&(i.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(i.termoPdfUploadId=e.termoPdfUploadId)),e.tipo===D.SLIDER&&(e.step!==void 0&&(i.step=e.step),e.minValue!==void 0&&(i.minValue=e.minValue),e.maxValue!==void 0&&(i.maxValue=e.maxValue)),e.tipo===D.RATING&&e.maxRating!==void 0&&(i.maxRating=e.maxRating),e.tipo===D.DATE_RANGE&&(e.dateRangeStartLabel&&(i.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(i.dateRangeEndLabel=e.dateRangeEndLabel)),e.tipo===D.SUB_FORM&&e.subSchema&&(i.subSchemaTitle=e.subSchema.titulo,i.subSchemaFields=e.subSchema.fields.map(l=>oi(l,l.id))),e.condicional){const l=Rh(e.condicional);l&&(i.condition=l)}return i},_h=(e,t)=>{var r,n,a,s,i,l,c,d,u,m,p;const f=[],v=[],h=y=>t[y]||{label:y,name:y},x=((n=(r=e==null?void 0:e.containers)==null?void 0:r.root)==null?void 0:n.children)||[],b=new Set;for(const y of x){if(qe(y)!=="step")continue;const j=h(y).label||y,w=((s=(a=e==null?void 0:e.containers)==null?void 0:a[y])==null?void 0:s.children)||[];if(w.length===0){v.push(`Step "${j}" está vazio (sem containers).`);continue}for(const C of w){if(qe(C)!=="container")continue;const S=h(C).label||C,$=((l=(i=e==null?void 0:e.containers)==null?void 0:i[C])==null?void 0:l.children)||[],k=new Map;for(const E of $){if(qe(E)!=="field")continue;b.add(E);const T=h(E).name;(!T||!T.trim())&&f.push(`Campo "${h(E).label||E}" (${E}) no container "${S}" não tem nome definido.`);const O=T||E;k.has(O)||k.set(O,[]),k.get(O).push(E)}for(const[E,T]of k.entries())T.length>1&&f.push(`Nome duplicado "${E}" no container "${S}" (IDs: ${T.join(", ")}).`)}}for(const[y,j]of Object.entries(t)){if(!((c=j.condition)!=null&&c.when))continue;const w=j.condition.when;if(!b.has(w)){const C=j.label||y;v.push(`Campo "${C}" referencia campo inexistente na condição (when: "${w}").`)}}for(const y of x){if(qe(y)!=="step")continue;const j=h(y).label||y,w=((u=(d=e==null?void 0:e.containers)==null?void 0:d[y])==null?void 0:u.children)||[],C=new Map;for(const S of w){if(qe(S)!=="container")continue;const $=((p=(m=e==null?void 0:e.containers)==null?void 0:m[S])==null?void 0:p.children)||[];for(const k of $){if(qe(k)!=="field")continue;const E=h(k).name||k;C.has(E)||C.set(E,new Set),C.get(E).add(S)}}for(const[S,$]of C.entries())$.size>1&&f.push(`Nome duplicado "${S}" no step "${j}" em containers diferentes (containers: ${[...$].join(", ")}). Isso causa colisão no formulário.`)}return{errors:f,warnings:v}},Ih=N.createContext(null),qk=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]},ys=(e,t)=>{const r=t||qk(e),n=r==="step",a=r==="container",s=r==="field_array";return{label:n?"Novo Step":a?"Novo Container":s?"Lista de itens":r||e,name:e,fieldType:r||"texto",required:!1,columns:2,tamanho:a||s?12:n?void 0:6,showLabel:a?!0:void 0,itemLabel:s?"Item":void 0}},ws=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))},Oh=(e,t)=>{const r=[e],n=t[e];if(n!=null&&n.children)for(const a of n.children)r.push(...Oh(a,t));return r},wl=(e,t)=>{for(const[r,n]of Object.entries(t))if(n.children.includes(e))return r;return null},Fh=({children:e,initialConfigs:t,initialContainers:r,initialTemplateId:n,initialStepConfig:a,schemaId:s,uploadTermsPdf:i,deleteTermsPdf:l})=>{const[c,d]=N.useState({selectedId:null,configs:t||{},showPreview:!1,containers:r??{root:{children:[]}},previewTemplateId:n||"moderno",stepConfig:a??{}}),[u,m]=N.useState(null),[p,f]=N.useState(null),v=N.useRef([]),h=N.useRef([]),x=M=>{v.current=[...v.current.slice(-49),ws(M)],h.current=[]},b=N.useCallback(()=>{d(M=>(x(M),{...M}))},[]),y=N.useCallback(()=>{v.current.length!==0&&d(M=>{h.current=[...h.current,ws(M)];const _=v.current.pop();return{...M,containers:_.containers,configs:_.configs}})},[]),j=N.useCallback(()=>{h.current.length!==0&&d(M=>{v.current=[...v.current,ws(M)];const _=h.current.pop();return{...M,containers:_.containers,configs:_.configs}})},[]);N.useEffect(()=>{const M=_=>{const se=_.metaKey||_.ctrlKey;se&&_.key==="z"&&!_.shiftKey&&(_.preventDefault(),y()),se&&_.key==="z"&&_.shiftKey&&(_.preventDefault(),j()),se&&_.key==="y"&&(_.preventDefault(),j())};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[y,j]);const w=N.useCallback(M=>c.configs[M]??ys(M),[c.configs]),C=N.useCallback(()=>{const M=[],_=se=>{var U;const Q=((U=c.containers[se])==null?void 0:U.children)??[];for(const Y of Q)qe(Y)==="field"?M.push(Y):c.containers[Y]&&_(Y)};return _("root"),M},[c.containers]),S=N.useCallback(M=>{d(_=>({..._,selectedId:M}))},[]),$=N.useCallback(M=>{d(_=>({..._,showPreview:M}))},[]),k=N.useCallback(M=>{d(_=>({..._,previewTemplateId:M}))},[]),E=N.useCallback(M=>{d(_=>({..._,stepConfig:{..._.stepConfig,...M}}))},[]),T=N.useCallback((M,_)=>{d(se=>({...se,configs:{...se.configs,[M]:{...se.configs[M]??ys(M),..._}}}))},[]),O=N.useCallback((M,_,se)=>{const U=`${M}-${Nt()}`,Q=qe(U);return d(Y=>{var H;x(Y);const W={...Y.containers};(Q==="step"||Q==="container"||M==="field_array")&&(W[U]={children:[]});const G=[...((H=W[_])==null?void 0:H.children)??[]];return se!==void 0&&se>=0?G.splice(se,0,U):G.push(U),W[_]={children:G},{...Y,containers:W,configs:{...Y.configs,[U]:ys(U,M)},selectedId:U}}),U},[]),L=N.useCallback((M,_)=>{const se=`container-${Nt()}`;return d(U=>{var Q,Y,H;x(U);const W={...U.containers},G={...U.configs},ne=[];for(const te of M.containerTemplate.campos){const ce=te.locked&&te.id?te.id:`${String(te.tipo).toLowerCase()}-${Nt()}`;if(ne.push(ce),G[ce]={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(be=>({value:be.valor,label:be.label})),...te.tipo==="field_array"&&{itemLabel:te.itemLabel,minItems:te.minItems,maxItems:te.maxItems,addLabel:te.addLabel}},te.tipo==="field_array"){const be=[];for(const Ce of te.subFields??[]){const ve=`${String(Ce.tipo).toLowerCase()}-${Nt()}`;be.push(ve),G[ve]={label:Ce.label,name:Ce.nome,fieldType:Ce.tipo,required:Ce.obrigatorio||!1,placeholder:Ce.placeholder,hint:Ce.hint,tamanho:Ce.tamanho||6,inicioColuna:Ce.inicioColuna,options:(Y=Ce.opcoes)==null?void 0:Y.map(me=>({value:me.valor,label:me.label}))}}W[ce]={children:be}}}W[se]={children:ne},G[se]={label:M.containerTemplate.titulo||M.name,description:M.containerTemplate.descricao,icone:M.containerTemplate.icone,tamanho:M.containerTemplate.tamanho||12,inicioColuna:M.containerTemplate.inicioColuna,showLabel:!0};const J=[...((H=W[_])==null?void 0:H.children)??[]];return J.push(se),W[_]={children:J},{...U,containers:W,configs:G,selectedId:se}}),se},[]),A=N.useCallback(M=>{const _=[];return d(se=>{var U,Q,Y;x(se);const H={...se.containers},W={...se.configs};for(const G of M.steps){const ne=`step-${Nt()}`;_.push(ne);const J=[];for(const ce of G.containers){const be=`container-${Nt()}`;J.push(be);const Ce=[];for(const ve of ce.campos){const me=ve.locked&&ve.id?ve.id:`${String(ve.tipo).toLowerCase()}-${Nt()}`;if(Ce.push(me),W[me]={label:ve.label,name:ve.locked?ve.id:ve.nome,fieldType:ve.tipo,required:ve.obrigatorio||!1,placeholder:ve.placeholder,hint:ve.hint,tamanho:ve.tamanho||12,inicioColuna:ve.inicioColuna,defaultValue:ve.defaultValue!=null?String(ve.defaultValue):void 0,locked:ve.locked||!1,options:(U=ve.opcoes)==null?void 0:U.map(Te=>({value:Te.valor,label:Te.label})),...ve.tipo==="field_array"&&{itemLabel:ve.itemLabel,minItems:ve.minItems,maxItems:ve.maxItems,addLabel:ve.addLabel}},ve.tipo==="field_array"){const Te=[];for(const ze of ve.subFields??[]){const dt=`${String(ze.tipo).toLowerCase()}-${Nt()}`;Te.push(dt),W[dt]={label:ze.label,name:ze.nome,fieldType:ze.tipo,required:ze.obrigatorio||!1,placeholder:ze.placeholder,hint:ze.hint,tamanho:ze.tamanho||6,inicioColuna:ze.inicioColuna,options:(Q=ze.opcoes)==null?void 0:Q.map(Ve=>({value:Ve.valor,label:Ve.label}))}}H[me]={children:Te}}}H[be]={children:Ce},W[be]={label:ce.titulo,description:ce.descricao,icone:ce.icone,tamanho:ce.tamanho||12,showLabel:!0}}H[ne]={children:J},W[ne]={label:G.titulo,description:G.descricao,icone:G.icone};const te=[...((Y=H.root)==null?void 0:Y.children)??[],ne];H.root={children:te}}return{...se,containers:H,configs:W,selectedId:_[0]??se.selectedId}}),_},[]),z=N.useCallback((M,_,se,U)=>{d(Q=>{var Y,H;x(Q);const W={...Q.containers},G=(((Y=W[_])==null?void 0:Y.children)??[]).filter(te=>te!==M);W[_]={children:G};const ne=[...(((H=W[se])==null?void 0:H.children)??[]).filter(te=>te!==M)],J=Math.max(0,Math.min(U,ne.length));return ne.splice(J,0,M),W[se]={children:ne},{...Q,containers:W}})},[]),X=N.useCallback((M,_)=>{d(se=>(x(se),{...se,containers:{...se.containers,[M]:{children:_}}}))},[]),q=N.useCallback(M=>{d(_=>{x(_);const se=Oh(M,_.containers),U={};for(const[Y,H]of Object.entries(_.containers))se.includes(Y)||(U[Y]={children:H.children.filter(W=>!se.includes(W))});const Q={..._.configs};for(const Y of se)delete Q[Y];return{..._,containers:U,configs:Q,selectedId:se.includes(_.selectedId??"")?null:_.selectedId}})},[]),Z=N.useCallback((M,_)=>{d(se=>{const U=wl(M,se.containers);if(!U)return se;const Q=[...se.containers[U].children],Y=Q.indexOf(M),H=_==="up"?Y-1:Y+1;return H<0||H>=Q.length?se:([Q[Y],Q[H]]=[Q[H],Q[Y]],{...se,containers:{...se.containers,[U]:{children:Q}}})})},[]),V=N.useCallback((M,_)=>{b(),Z(M,_)},[Z,b]);return o.jsx(Ih.Provider,{value:{selectedId:c.selectedId,configs:c.configs,showPreview:c.showPreview,containers:c.containers,positionDrag:u,reorderDrag:p,canUndo:v.current.length>0,canRedo:h.current.length>0,schemaId:s,uploadTermsPdf:i,deleteTermsPdf:l,previewTemplateId:c.previewTemplateId,setPreviewTemplateId:k,stepConfig:c.stepConfig,updateStepConfig:E,getConfig:w,getAllFieldIds:C,setSelected:S,updateConfig:T,setShowPreview:$,addItem:O,addPresetBlock:L,addPresetStepBlock:A,moveCanvasItem:z,reorderInContainer:X,removeItem:q,moveItem:V,moveItemNoSnapshot:Z,setPositionDrag:m,setReorderDrag:f,undo:y,redo:j,pushSnapshot:b},children:e})},gt=()=>{const e=N.useContext(Ih);if(!e)throw new Error("useBuilder must be inside BuilderProvider");return e},Gk=()=>{const{containers:e,configs:t,stepConfig:r}=gt(),n=N.useCallback(s=>yl({containers:e},t,{...s,stepConfig:r}),[e,t,r]),a=N.useCallback(()=>_h({containers:e},t),[e,t]);return{buildSchema:n,validate:a}};function zh(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=zh(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Xk(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=zh(e))&&(n&&(n+=" "),n+=t);return n}const Zk=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},Kk=(e,t)=>({classGroupId:e,validator:t}),Lh=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Ya="-",id=[],Yk="arbitrary..",Jk=e=>{const t=eC(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Qk(a);const s=a.split(Ya),i=s[0]===""&&s.length>1?1:0;return Mh(s,i,t)},getConflictingClassGroupIds:(a,s)=>{if(s){const i=n[a],l=r[a];return i?l?Zk(l,i):i:l||id}return r[a]||id}}},Mh=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const c=Mh(e,t+1,a);if(c)return c}const s=r.validators;if(s===null)return;const i=t===0?e.join(Ya):e.slice(t).join(Ya),l=s.length;for(let c=0;c<l;c++){const d=s[c];if(d.validator(i))return d.classGroupId}},Qk=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?Yk+n:void 0})(),eC=e=>{const{theme:t,classGroups:r}=e;return tC(r,t)},tC=(e,t)=>{const r=Lh();for(const n in e){const a=e[n];jl(a,r,n,t)}return r},jl=(e,t,r,n)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];rC(i,t,r,n)}},rC=(e,t,r,n)=>{if(typeof e=="string"){nC(e,t,r);return}if(typeof e=="function"){aC(e,t,r,n);return}oC(e,t,r,n)},nC=(e,t,r)=>{const n=e===""?t:Vh(t,e);n.classGroupId=r},aC=(e,t,r,n)=>{if(sC(e)){jl(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(Kk(r,e))},oC=(e,t,r,n)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[l,c]=a[i];jl(c,Vh(t,l),r,n)}},Vh=(e,t)=>{let r=e;const n=t.split(Ya),a=n.length;for(let s=0;s<a;s++){const i=n[s];let l=r.nextPart.get(i);l||(l=Lh(),r.nextPart.set(i,l)),r=l}return r},sC=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,iC=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(s,i)=>{r[s]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let i=r[s];if(i!==void 0)return i;if((i=n[s])!==void 0)return a(s,i),i},set(s,i){s in r?r[s]=i:a(s,i)}}},si="!",ld=":",lC=[],cd=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),cC=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let i=0,l=0,c=0,d;const u=a.length;for(let h=0;h<u;h++){const x=a[h];if(i===0&&l===0){if(x===ld){s.push(a.slice(c,h)),c=h+1;continue}if(x==="/"){d=h;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const m=s.length===0?a:a.slice(c);let p=m,f=!1;m.endsWith(si)?(p=m.slice(0,-1),f=!0):m.startsWith(si)&&(p=m.slice(1),f=!0);const v=d&&d>c?d-c:void 0;return cd(s,f,p,v)};if(t){const a=t+ld,s=n;n=i=>i.startsWith(a)?s(i.slice(a.length)):cd(lC,!1,i,void 0,!0)}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},dC=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let a=[];for(let s=0;s<r.length;s++){const i=r[s],l=i[0]==="[",c=t.has(i);l||c?(a.length>0&&(a.sort(),n.push(...a),a=[]),n.push(i)):a.push(i)}return a.length>0&&(a.sort(),n.push(...a)),n}},uC=e=>({cache:iC(e.cacheSize),parseClassName:cC(e),sortModifiers:dC(e),...Jk(e)}),mC=/\s+/,pC=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],l=e.trim().split(mC);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:m,modifiers:p,hasImportantModifier:f,baseClassName:v,maybePostfixModifierPosition:h}=r(u);if(m){c=u+(c.length>0?" "+c:c);continue}let x=!!h,b=n(x?v.substring(0,h):v);if(!b){if(!x){c=u+(c.length>0?" "+c:c);continue}if(b=n(v),!b){c=u+(c.length>0?" "+c:c);continue}x=!1}const y=p.length===0?"":p.length===1?p[0]:s(p).join(":"),j=f?y+si:y,w=j+b;if(i.indexOf(w)>-1)continue;i.push(w);const C=a(b,x);for(let S=0;S<C.length;++S){const $=C[S];i.push(j+$)}c=u+(c.length>0?" "+c:c)}return c},fC=(...e)=>{let t=0,r,n,a="";for(;t<e.length;)(r=e[t++])&&(n=Bh(r))&&(a&&(a+=" "),a+=n);return a},Bh=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Bh(e[n]))&&(r&&(r+=" "),r+=t);return r},hC=(e,...t)=>{let r,n,a,s;const i=c=>{const d=t.reduce((u,m)=>m(u),e());return r=uC(d),n=r.cache.get,a=r.cache.set,s=l,l(c)},l=c=>{const d=n(c);if(d)return d;const u=pC(c,r);return a(c,u),u};return s=i,(...c)=>s(fC(...c))},xC=[],ot=e=>{const t=r=>r[e]||xC;return t.isThemeGetter=!0,t},Uh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Hh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,gC=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,vC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bC=/\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$/,yC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$r=e=>gC.test(e),Se=e=>!!e&&!Number.isNaN(Number(e)),Er=e=>!!e&&Number.isInteger(Number(e)),js=e=>e.endsWith("%")&&Se(e.slice(0,-1)),hr=e=>vC.test(e),Wh=()=>!0,kC=e=>bC.test(e)&&!yC.test(e),kl=()=>!1,CC=e=>wC.test(e),NC=e=>jC.test(e),SC=e=>!fe(e)&&!xe(e),$C=e=>Br(e,Xh,kl),fe=e=>Uh.test(e),Gr=e=>Br(e,Zh,kC),dd=e=>Br(e,IC,Se),EC=e=>Br(e,Yh,Wh),TC=e=>Br(e,Kh,kl),ud=e=>Br(e,qh,kl),AC=e=>Br(e,Gh,NC),Ea=e=>Br(e,Jh,CC),xe=e=>Hh.test(e),Un=e=>an(e,Zh),DC=e=>an(e,Kh),md=e=>an(e,qh),RC=e=>an(e,Xh),PC=e=>an(e,Gh),Ta=e=>an(e,Jh,!0),_C=e=>an(e,Yh,!0),Br=(e,t,r)=>{const n=Uh.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},an=(e,t,r=!1)=>{const n=Hh.exec(e);return n?n[1]?t(n[1]):r:!1},qh=e=>e==="position"||e==="percentage",Gh=e=>e==="image"||e==="url",Xh=e=>e==="length"||e==="size"||e==="bg-size",Zh=e=>e==="length",IC=e=>e==="number",Kh=e=>e==="family-name",Yh=e=>e==="number"||e==="weight",Jh=e=>e==="shadow",OC=()=>{const e=ot("color"),t=ot("font"),r=ot("text"),n=ot("font-weight"),a=ot("tracking"),s=ot("leading"),i=ot("breakpoint"),l=ot("container"),c=ot("spacing"),d=ot("radius"),u=ot("shadow"),m=ot("inset-shadow"),p=ot("text-shadow"),f=ot("drop-shadow"),v=ot("blur"),h=ot("perspective"),x=ot("aspect"),b=ot("ease"),y=ot("animate"),j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...w(),xe,fe],S=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],k=()=>[xe,fe,c],E=()=>[$r,"full","auto",...k()],T=()=>[Er,"none","subgrid",xe,fe],O=()=>["auto",{span:["full",Er,xe,fe]},Er,xe,fe],L=()=>[Er,"auto",xe,fe],A=()=>["auto","min","max","fr",xe,fe],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...k()],Z=()=>[$r,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],V=()=>[$r,"screen","full","dvw","lvw","svw","min","max","fit",...k()],M=()=>[$r,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],_=()=>[e,xe,fe],se=()=>[...w(),md,ud,{position:[xe,fe]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Q=()=>["auto","cover","contain",RC,$C,{size:[xe,fe]}],Y=()=>[js,Un,Gr],H=()=>["","none","full",d,xe,fe],W=()=>["",Se,Un,Gr],G=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[Se,js,md,ud],te=()=>["","none",v,xe,fe],ce=()=>["none",Se,xe,fe],be=()=>["none",Se,xe,fe],Ce=()=>[Se,xe,fe],ve=()=>[$r,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[hr],breakpoint:[hr],color:[Wh],container:[hr],"drop-shadow":[hr],ease:["in","out","in-out"],font:[SC],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[hr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[hr],shadow:[hr],spacing:["px",Se],text:[hr],"text-shadow":[hr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$r,fe,xe,x]}],container:["container"],columns:[{columns:[Se,fe,xe,l]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow: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:[Er,"auto",xe,fe]}],basis:[{basis:[$r,"full","auto",l,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Se,$r,"auto","initial","none",fe]}],grow:[{grow:["",Se,xe,fe]}],shrink:[{shrink:["",Se,xe,fe]}],order:[{order:[Er,"first","last","none",xe,fe]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":A()}],"auto-rows":[{"auto-rows":A()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...M()]}],"min-block-size":[{"min-block":["auto",...M()]}],"max-block-size":[{"max-block":["none",...M()]}],w:[{w:[l,"screen",...Z()]}],"min-w":[{"min-w":[l,"screen","none",...Z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",r,Un,Gr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,_C,EC]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",js,fe]}],"font-family":[{font:[DC,TC,t]}],"font-features":[{"font-features":[fe]}],"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:[a,xe,fe]}],"line-clamp":[{"line-clamp":[Se,"none",xe,dd]}],leading:[{leading:[s,...k()]}],"list-image":[{"list-image":["none",xe,fe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",xe,fe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:_()}],"text-color":[{text:_()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[Se,"from-font","auto",xe,Gr]}],"text-decoration-color":[{decoration:_()}],"underline-offset":[{"underline-offset":[Se,"auto",xe,fe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xe,fe]}],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",xe,fe]}],"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"]},Er,xe,fe],radial:["",xe,fe],conic:[Er,xe,fe]},PC,AC]}],"bg-color":[{bg:_()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:_()}],"gradient-via":[{via:_()}],"gradient-to":[{to:_()}],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:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-bs":[{"border-bs":W()}],"border-w-be":[{"border-be":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:_()}],"border-color-x":[{"border-x":_()}],"border-color-y":[{"border-y":_()}],"border-color-s":[{"border-s":_()}],"border-color-e":[{"border-e":_()}],"border-color-bs":[{"border-bs":_()}],"border-color-be":[{"border-be":_()}],"border-color-t":[{"border-t":_()}],"border-color-r":[{"border-r":_()}],"border-color-b":[{"border-b":_()}],"border-color-l":[{"border-l":_()}],"divide-color":[{divide:_()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Se,xe,fe]}],"outline-w":[{outline:["",Se,Un,Gr]}],"outline-color":[{outline:_()}],shadow:[{shadow:["","none",u,Ta,Ea]}],"shadow-color":[{shadow:_()}],"inset-shadow":[{"inset-shadow":["none",m,Ta,Ea]}],"inset-shadow-color":[{"inset-shadow":_()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:_()}],"ring-offset-w":[{"ring-offset":[Se,Gr]}],"ring-offset-color":[{"ring-offset":_()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":_()}],"text-shadow":[{"text-shadow":["none",p,Ta,Ea]}],"text-shadow-color":[{"text-shadow":_()}],opacity:[{opacity:[Se,xe,fe]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":_()}],"mask-image-linear-to-color":[{"mask-linear-to":_()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":_()}],"mask-image-t-to-color":[{"mask-t-to":_()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":_()}],"mask-image-r-to-color":[{"mask-r-to":_()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":_()}],"mask-image-b-to-color":[{"mask-b-to":_()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":_()}],"mask-image-l-to-color":[{"mask-l-to":_()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":_()}],"mask-image-x-to-color":[{"mask-x-to":_()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":_()}],"mask-image-y-to-color":[{"mask-y-to":_()}],"mask-image-radial":[{"mask-radial":[xe,fe]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":_()}],"mask-image-radial-to-color":[{"mask-radial-to":_()}],"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":w()}],"mask-image-conic-pos":[{"mask-conic":[Se]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":_()}],"mask-image-conic-to-color":[{"mask-conic-to":_()}],"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",xe,fe]}],filter:[{filter:["","none",xe,fe]}],blur:[{blur:te()}],brightness:[{brightness:[Se,xe,fe]}],contrast:[{contrast:[Se,xe,fe]}],"drop-shadow":[{"drop-shadow":["","none",f,Ta,Ea]}],"drop-shadow-color":[{"drop-shadow":_()}],grayscale:[{grayscale:["",Se,xe,fe]}],"hue-rotate":[{"hue-rotate":[Se,xe,fe]}],invert:[{invert:["",Se,xe,fe]}],saturate:[{saturate:[Se,xe,fe]}],sepia:[{sepia:["",Se,xe,fe]}],"backdrop-filter":[{"backdrop-filter":["","none",xe,fe]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[Se,xe,fe]}],"backdrop-contrast":[{"backdrop-contrast":[Se,xe,fe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Se,xe,fe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Se,xe,fe]}],"backdrop-invert":[{"backdrop-invert":["",Se,xe,fe]}],"backdrop-opacity":[{"backdrop-opacity":[Se,xe,fe]}],"backdrop-saturate":[{"backdrop-saturate":[Se,xe,fe]}],"backdrop-sepia":[{"backdrop-sepia":["",Se,xe,fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",xe,fe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Se,"initial",xe,fe]}],ease:[{ease:["linear","initial",b,xe,fe]}],delay:[{delay:[Se,xe,fe]}],animate:[{animate:["none",y,xe,fe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,xe,fe]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:be()}],"scale-x":[{"scale-x":be()}],"scale-y":[{"scale-y":be()}],"scale-z":[{"scale-z":be()}],"scale-3d":["scale-3d"],skew:[{skew:Ce()}],"skew-x":[{"skew-x":Ce()}],"skew-y":[{"skew-y":Ce()}],transform:[{transform:[xe,fe,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],accent:[{accent:_()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:_()}],"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",xe,fe]}],"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":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",xe,fe]}],fill:[{fill:["none",..._()]}],"stroke-w":[{stroke:[Se,Un,Gr,dd]}],stroke:[{stroke:["none",..._()]}],"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"]}},FC=hC(OC);function Ut(...e){return FC(Xk(e))}const br=({onInsert:e})=>{const[t,r]=N.useState(null),n=async a=>{const s=`{{${a}}}`;try{await navigator.clipboard.writeText(s)}catch{const i=document.createElement("textarea");i.value=s,i.style.position="fixed",i.style.opacity="0",document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i)}e&&e(s),r(a),setTimeout(()=>r(null),1500)};return o.jsxs(To,{children:[o.jsx(Ao,{asChild:!0,children:o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 text-muted-foreground hover:text-primary",title:"Inserir variável do evento",children:o.jsx(I.Braces,{className:"h-3.5 w-3.5"})})}),o.jsxs(da,{className:"w-80 p-0",align:"end",side:"left",sideOffset:6,children:[o.jsxs("div",{className:"px-3 py-2 border-b border-border",children:[o.jsx("p",{className:"text-xs font-semibold text-foreground",children:"Variáveis do evento"}),o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Clique para copiar. Use"," ",o.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"{{evento.xxx}}"})," ","em labels, placeholders e hints."]})]}),o.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:bl.map(a=>{const s=t===a.key;return o.jsxs("button",{type:"button",onClick:()=>n(a.key),className:Ut("w-full flex items-center justify-between px-3 py-1.5 text-left hover:bg-accent transition-colors",s&&"bg-primary/10"),children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xs font-medium truncate",children:a.label}),o.jsx("code",{className:"text-[10px] text-muted-foreground font-mono",children:`{{${a.key}}}`})]}),o.jsx("div",{className:"ml-2 shrink-0",children:s?o.jsx(I.Check,{className:"h-3.5 w-3.5 text-primary"}):o.jsx(I.Braces,{className:"h-3 w-3 text-muted-foreground/50"})})]},a.key)})})]})]})},zC=({config:e,onUpdate:t})=>o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Label"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Descrição"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do step"})]}),o.jsx(nh,{value:e.icone,onChange:r=>t({icone:r})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"step-show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(ie,{htmlFor:"step-show-label",className:"text-xs cursor-pointer",children:"Exibir título no formulário"})]})]}),LC=({inicioColuna:e,tamanho:t,onSelect:r})=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"Posição no grid"}),o.jsx("div",{className:"flex gap-0.5",children:Array.from({length:12},(n,a)=>{const s=a+1,i=s>=e&&s<e+t;return o.jsx("button",{onClick:()=>r(s),className:Ut("flex-1 h-6 rounded-sm text-[8px] font-mono transition-all border",i?"bg-primary text-primary-foreground border-primary":"bg-muted/50 text-muted-foreground/50 border-border/50 hover:bg-muted hover:border-border"),children:s},s)})}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Início: col ",e," · Span: ",t]})]}),Qh=({tamanho:e,inicioColuna:t,defaultTamanho:r=6,onTamanhoChange:n,onPositionChange:a})=>{const s=13-t;return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(ie,{className:"text-xs",children:["Tamanho (",e,"/12 colunas)"]}),o.jsx(So,{value:[e],onValueChange:([i])=>{const l=Math.min(i,s);n(l)},min:1,max:s,step:1,className:"py-1"}),o.jsxs("div",{className:"flex justify-between text-[9px] text-muted-foreground",children:[o.jsx("span",{children:"1"}),o.jsx("span",{children:"3"}),o.jsx("span",{children:"6"}),o.jsx("span",{children:"9"}),o.jsx("span",{children:"12"})]})]}),o.jsx(LC,{inicioColuna:t,tamanho:e,onSelect:i=>{const l=13-i,c=Math.min(e,l);a(i),c!==e&&n(c)}})]})},MC=({config:e,onUpdate:t})=>o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Label"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Descrição"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do container"})]}),o.jsx(nh,{value:e.icone,onChange:r=>t({icone:r})}),o.jsx(Qh,{tamanho:e.tamanho||12,inicioColuna:e.inicioColuna||1,defaultTamanho:12,onTamanhoChange:r=>t({tamanho:r}),onPositionChange:r=>t({inicioColuna:r})}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Colunas internas"}),o.jsxs(Vt,{value:String(e.columns||2),onValueChange:r=>t({columns:Number(r)}),children:[o.jsx(Dt,{className:"h-8 text-sm",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"1",children:"1 coluna"}),o.jsx(Xe,{value:"2",children:"2 colunas"}),o.jsx(Xe,{value:"3",children:"3 colunas"}),o.jsx(Xe,{value:"4",children:"4 colunas"})]})]}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Grid interno simplificado para campos"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(ie,{htmlFor:"show-label",className:"text-xs cursor-pointer",children:"Exibir label no formulário"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"show-as-card",checked:e.showAsCard||!1,onCheckedChange:r=>t({showAsCard:r===!0})}),o.jsx(ie,{htmlFor:"show-as-card",className:"text-xs cursor-pointer",children:"Exibir como card"})]})]}),ii=[{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."}]}],VC=ii.flatMap(e=>e.presets),BC=({value:e,message:t,onChange:r})=>{const[n,a]=N.useState(!1),[s,i]=N.useState(""),l=N.useMemo(()=>{if(!s.trim())return ii;const u=s.toLowerCase();return ii.map(m=>({...m,presets:m.presets.filter(p=>p.label.toLowerCase().includes(u)||p.description.toLowerCase().includes(u)||p.pattern.toLowerCase().includes(u))})).filter(m=>m.presets.length>0)},[s]),c=N.useMemo(()=>e?VC.find(u=>u.pattern===e):void 0,[e]),d=u=>{r(u.pattern,`${u.label}: formato inválido`),a(!1),i("")};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-[10px]",children:"Regex"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(ue,{value:e??"",onChange:u=>r(u.target.value||void 0,t),className:"h-7 text-xs font-mono flex-1",placeholder:"Clique no botão ou digite..."}),e&&o.jsx(Ae,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>{r(void 0,void 0)},children:o.jsx(I.X,{className:"h-3 w-3"})}),o.jsxs(To,{open:n,onOpenChange:a,children:[o.jsx(Ao,{asChild:!0,children:o.jsx(Ae,{variant:"outline",size:"icon",className:"h-7 w-7 shrink-0",children:o.jsx(I.Regex,{className:"h-3.5 w-3.5"})})}),o.jsxs(da,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(I.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(ue,{value:s,onChange:u=>i(u.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar regex (ex: CPF, e-mail, senha)...",autoFocus:!0})]})}),o.jsx(Oo,{className:"h-[360px]",children:o.jsxs("div",{className:"p-1",children:[l.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum regex encontrado"}),l.map(u=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:u.category}),u.presets.map(m=>o.jsxs(Vf,{children:[o.jsx(Bf,{asChild:!0,children:o.jsxs("button",{onClick:()=>d(m),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors group",children:[o.jsx(I.ChevronRight,{className:"h-3 w-3 text-muted-foreground/50 group-hover:text-primary shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium block truncate",children:m.label}),o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono block truncate",children:m.pattern})]})]})}),o.jsxs(al,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:m.label}),o.jsx("p",{children:m.description})]})]},m.pattern+m.label))]},u.category))]})})]})]})]}),c&&o.jsxs($i,{variant:"secondary",className:"text-[10px] font-normal gap-1",children:[o.jsx(I.Regex,{className:"h-2.5 w-2.5"}),c.label]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Mensagem do regex"}),o.jsx(ue,{value:t??"",onChange:u=>r(e,u.target.value||void 0),className:"h-7 text-xs",placeholder:"Formato inválido"})]})]})},li=[{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"]}]}],UC=li.flatMap(e=>e.presets),HC=({value:e,onChange:t})=>{const[r,n]=N.useState(!1),[a,s]=N.useState(""),[i,l]=N.useState(""),c=N.useMemo(()=>new Set(e??[]),[e]),d=N.useMemo(()=>{if(!a.trim())return li;const v=a.toLowerCase();return li.map(h=>({...h,presets:h.presets.filter(x=>x.label.toLowerCase().includes(v)||x.description.toLowerCase().includes(v)||x.value.toLowerCase().includes(v))})).filter(h=>h.presets.length>0)},[a]),u=v=>{const h=new Set(e??[]);v.group?v.group.every(x=>h.has(x))?v.group.forEach(x=>h.delete(x)):v.group.forEach(x=>h.add(x)):h.has(v.value)?h.delete(v.value):h.add(v.value),t(h.size>0?Array.from(h):void 0)},m=()=>{const v=i.trim();if(!v)return;const h=new Set(e??[]);h.add(v),t(Array.from(h)),l("")},p=v=>{const h=new Set(e??[]);h.delete(v),t(h.size>0?Array.from(h):void 0)},f=v=>{const h=UC.find(x=>x.value===v);return(h==null?void 0:h.label)??v};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-[10px]",children:"Tipos de arquivo aceitos"}),((e==null?void 0:e.length)??0)>0&&o.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(v=>o.jsxs($i,{variant:"secondary",className:"text-[10px] gap-1 pr-1",children:[f(v),o.jsx("button",{onClick:()=>p(v),className:"hover:text-destructive",children:o.jsx(I.X,{className:"h-2.5 w-2.5"})})]},v))}),o.jsxs(To,{open:r,onOpenChange:n,children:[o.jsx(Ao,{asChild:!0,children:o.jsxs(Ae,{variant:"outline",className:"w-full h-8 text-xs justify-start gap-2",children:[o.jsx(I.FileType2,{className:"h-3.5 w-3.5"}),((e==null?void 0:e.length)??0)>0?`${e.length} tipo(s) selecionado(s)`:"Selecionar tipos de arquivo..."]})}),o.jsxs(da,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(I.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(ue,{value:a,onChange:v=>s(v.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar tipos (ex: PDF, imagem, vídeo)...",autoFocus:!0})]})}),o.jsxs("div",{className:"px-2 py-1.5 border-b flex gap-1",children:[o.jsx(ue,{value:i,onChange:v=>l(v.target.value),className:"h-7 text-xs font-mono flex-1",placeholder:"Tipo customizado (ex: .dwg)",onKeyDown:v=>v.key==="Enter"&&m()}),o.jsx(Ae,{variant:"secondary",size:"sm",className:"h-7 text-xs shrink-0",onClick:m,disabled:!i.trim(),children:"Adicionar"})]}),o.jsx(Oo,{className:"h-[320px]",children:o.jsxs("div",{className:"p-1",children:[d.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum tipo encontrado"}),d.map(v=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:v.category}),v.presets.map(h=>{const x=h.group?h.group.every(y=>c.has(y)):c.has(h.value),b=h.group?h.group.some(y=>c.has(y))&&!x:!1;return o.jsxs(Vf,{children:[o.jsx(Bf,{asChild:!0,children:o.jsxs("button",{onClick:()=>u(h),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors",children:[o.jsx(rt,{checked:b?"indeterminate":x,className:"h-3.5 w-3.5",tabIndex:-1}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium",children:h.label}),!h.group&&o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono ml-2",children:h.value}),h.group&&o.jsxs("span",{className:"text-[10px] text-muted-foreground ml-2",children:[h.group.length," tipos"]})]}),o.jsx(I.Info,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"})]})}),o.jsxs(al,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:h.label}),o.jsx("p",{children:h.description}),h.group&&o.jsx("ul",{className:"mt-1 space-y-0.5",children:h.group.map(y=>o.jsx("li",{className:"font-mono text-[10px] opacity-80",children:y},y))})]})]},h.value)})]},v.category))]})})]})]})]})},ex=1048576,Ja=1073741824;function pd(e){return e>=Ja&&e%Ja===0?"GB":"MB"}function fd(e,t){return t==="GB"?e/Ja:e/ex}function hd(e,t){return Math.round(e*(t==="GB"?Ja:ex))}const WC=({value:e,onChange:t})=>{const r=N.useMemo(()=>e?pd(e):"MB",[]),[n,a]=N.useState(r),[s,i]=N.useState(e?String(fd(e,r)):"");N.useEffect(()=>{if(e===void 0){i("");return}const d=pd(e);a(d),i(String(fd(e,d)))},[e]);const l=d=>{i(d);const u=parseFloat(d);d.trim()===""||isNaN(u)||u<=0?t(void 0):t(hd(u,n))},c=d=>{a(d);const u=parseFloat(s);!isNaN(u)&&u>0&&t(hd(u,d))};return o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(ie,{className:"text-[10px]",children:"Tamanho máximo do arquivo"}),o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx(ue,{type:"number",min:0,step:"any",value:s,onChange:d=>l(d.target.value),placeholder:"Ex: 10",className:"h-8 text-xs flex-1"}),o.jsxs(Vt,{value:n,onValueChange:d=>c(d),children:[o.jsx(Dt,{className:"w-[72px] h-8 text-xs",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"MB",children:"MB"}),o.jsx(Xe,{value:"GB",children:"GB"})]})]})]}),e!==void 0&&o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["= ",e.toLocaleString("pt-BR")," bytes"]})]})},qC=new Set(["texto","textarea","email","password","url","phone","tel","cpf","cnpj","cep","rg"]),GC=({fieldType:e,validation:t,onChange:r})=>{const n=(i,l)=>{const c=["minLength","maxLength","min","max","maxFileSize","minAge","maxAge"].includes(i)?l?Number(l):void 0:l||void 0;r({...t,[i]:c})},a=e==="file",s=qC.has(e);return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Validação"}),s&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Min caracteres"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.minLength)??"",onChange:i=>n("minLength",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Max caracteres"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.maxLength)??"",onChange:i=>n("maxLength",i.target.value),className:"h-7 text-xs"})]})]}),e==="number"&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Valor mínimo"}),o.jsx(ue,{type:"number",value:(t==null?void 0:t.min)??"",onChange:i=>n("min",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Valor máximo"}),o.jsx(ue,{type:"number",value:(t==null?void 0:t.max)??"",onChange:i=>n("max",i.target.value),className:"h-7 text-xs"})]})]}),(e==="date"||e==="datetime")&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Data mínima"}),o.jsx(ue,{type:"date",value:(t==null?void 0:t.minDate)??"",onChange:i=>n("minDate",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Data máxima"}),o.jsx(ue,{type:"date",value:(t==null?void 0:t.maxDate)??"",onChange:i=>n("maxDate",i.target.value),className:"h-7 text-xs"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Idade mínima (anos)"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.minAge)??"",onChange:i=>n("minAge",i.target.value),className:"h-7 text-xs",placeholder:"ex: 18"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Idade máxima (anos)"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.maxAge)??"",onChange:i=>n("maxAge",i.target.value),className:"h-7 text-xs",placeholder:"ex: 60"})]})]})]}),a&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(HC,{value:t==null?void 0:t.fileTypes,onChange:i=>r({...t,fileTypes:i})}),o.jsx(WC,{value:t==null?void 0:t.maxFileSize,onChange:i=>r({...t,maxFileSize:i})})]}),!a&&o.jsx(BC,{value:(t==null?void 0:t.regex)??"",message:(t==null?void 0:t.regexMessage)??"",onChange:(i,l)=>r({...t,regex:i,regexMessage:l})})]})},tx=({options:e,onChange:t})=>{const r=N.useRef([]);if(r.current.length<e.length)for(let i=r.current.length;i<e.length;i++)r.current.push(`opt-${Math.random().toString(36).slice(2)}`);const n=N.useCallback((i,l,c)=>{const d=[...e];d[i]={...d[i],[l]:c},t(d)},[e,t]),a=N.useCallback(i=>{r.current.splice(i,1),t(e.filter((l,c)=>c!==i))},[e,t]),s=N.useCallback(()=>{t([...e,{value:"",label:""}])},[e,t]);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Opções"}),e.map((i,l)=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(I.GripVertical,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}),o.jsx(ue,{value:i.value,onChange:c=>n(l,"value",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Valor"}),o.jsxs("div",{className:"flex items-center gap-0.5 flex-1",children:[o.jsx(ue,{value:i.label,onChange:c=>n(l,"label",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Label"}),o.jsx(br,{})]}),o.jsx(Ae,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>a(l),children:o.jsx(I.Trash2,{className:"h-3 w-3"})})]},r.current[l])),o.jsxs(Ae,{variant:"outline",size:"sm",className:"w-full h-7 text-xs",onClick:s,children:[o.jsx(I.Plus,{className:"h-3 w-3 mr-1"})," Adicionar opção"]})]})},XC=[{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"}],ZC=["vazio","naoVazio"],xd=({cond:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:a})=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Fonte"}),o.jsxs(Vt,{value:e.source||"campo",onValueChange:s=>a({source:s,when:""}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"campo",children:"Campo do formulário"}),o.jsx(Xe,{value:"evento",children:"Variável do evento"})]})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:e.source==="evento"?"Variável do evento":"Quando o campo"}),o.jsxs(Vt,{value:e.when||"",onValueChange:s=>a({when:s}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{placeholder:e.source==="evento"?"Selecione uma variável...":"Selecione um campo..."})}),o.jsx(Rt,{children:e.source==="evento"?bl.map(s=>o.jsx(Xe,{value:s.key,children:s.label},s.key)):r.filter(s=>s!==t).map(s=>o.jsxs(Xe,{value:s,children:[n(s),o.jsxs("span",{className:"text-muted-foreground/50 ml-1 text-[9px] font-mono",children:["(",s,")"]})]},s))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Operador"}),o.jsxs(Vt,{value:e.operator,onValueChange:s=>a({operator:s}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{})}),o.jsx(Rt,{children:XC.map(s=>o.jsx(Xe,{value:s.value,children:s.label},s.value))})]})]}),!ZC.includes(e.operator)&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Valor"}),o.jsx(ue,{value:e.value||"",onChange:s=>a({value:s.target.value}),className:"h-7 text-xs",placeholder:"Valor esperado"})]})]}),KC=({condition:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onChange:a})=>{var s;const i=m=>{e&&a({...e,...m})},l=()=>{if(!e)return;const m=e.extraConditions??[];a({...e,logicOperator:e.logicOperator??"and",extraConditions:[...m,{when:"",operator:"igual",value:"",source:"campo"}]})},c=m=>{if(!e)return;const p=(e.extraConditions??[]).filter((f,v)=>v!==m);a({...e,extraConditions:p,logicOperator:p.length?e.logicOperator:void 0})},d=(m,p)=>{if(!e)return;const f=(e.extraConditions??[]).map((v,h)=>h===m?{...v,...p}:v);a({...e,extraConditions:f})},u=(((s=e==null?void 0:e.extraConditions)==null?void 0:s.length)??0)>0;return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Condicional"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"has-condition",checked:!!e,onCheckedChange:m=>{a(m?{when:"",operator:"igual",value:"",source:"campo"}:void 0)}}),o.jsx(ie,{htmlFor:"has-condition",className:"text-xs cursor-pointer",children:"Exibir condicionalmente"})]}),e&&o.jsxs("div",{className:"space-y-2 pl-2 border-l-2 border-amber-500/30",children:[o.jsx(xd,{cond:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:i}),u&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Lógica"}),o.jsxs(Vt,{value:e.logicOperator??"and",onValueChange:m=>i({logicOperator:m}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"and",children:"E (AND) — todas devem ser verdadeiras"}),o.jsx(Xe,{value:"or",children:"OU (OR) — pelo menos uma deve ser verdadeira"})]})]})]}),(e.extraConditions??[]).map((m,p)=>o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/40",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-[10px] text-muted-foreground font-medium uppercase",children:[e.logicOperator==="or"?"OU":"E"," — condição"," ",p+2]}),o.jsx(Ae,{variant:"ghost",size:"sm",className:"h-5 px-1 text-[10px] text-destructive hover:text-destructive",onClick:()=>c(p),children:"Remover"})]}),o.jsx(xd,{cond:m,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:f=>d(p,f)})]},p)),o.jsx(Ae,{variant:"outline",size:"sm",className:"h-6 text-[10px] w-full mt-1",onClick:l,children:"+ Adicionar condição"})]})]})},gd=[{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"}],YC=({subFields:e,onChange:t})=>{const[r,n]=N.useState(null),a=(i,l)=>{const c=e.map((d,u)=>u===i?{...d,...l}:d);t(c)},s=i=>{t(e.filter((l,c)=>c!==i)),n(null)};return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs font-semibold",children:"Sub-campos"}),o.jsxs(Ae,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs gap-1",onClick:()=>{const i={label:"Novo campo",name:`campo_${e.length+1}`,fieldType:"texto",required:!1};t([...e,i]),n(e.length)},children:[o.jsx(I.Plus,{className:"w-3 h-3"}),"Adicionar"]})]}),e.length===0&&o.jsx("p",{className:"text-[11px] text-muted-foreground italic py-1",children:"Nenhum sub-campo adicionado."}),e.map((i,l)=>{var c;return o.jsxs("div",{className:"border rounded-md text-xs overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 cursor-pointer hover:bg-muted/40 select-none",onClick:()=>n(r===l?null:l),children:[o.jsx($i,{variant:"secondary",className:"h-4 text-[9px] px-1 shrink-0",children:l+1}),o.jsx("span",{className:"flex-1 truncate font-medium",children:i.label||i.name||"Campo sem nome"}),o.jsx("span",{className:"text-muted-foreground text-[10px] shrink-0",children:((c=gd.find(d=>d.value===i.fieldType))==null?void 0:c.label)??i.fieldType}),o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 text-destructive hover:text-destructive shrink-0",onClick:d=>{d.stopPropagation(),s(l)},children:o.jsx(I.Trash2,{className:"w-3 h-3"})}),r===l?o.jsx(I.ChevronUp,{className:"w-3 h-3 text-muted-foreground shrink-0"}):o.jsx(I.ChevronDown,{className:"w-3 h-3 text-muted-foreground shrink-0"})]}),r===l&&o.jsxs("div",{className:"px-2 pb-2 space-y-2 border-t bg-muted/20",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Label"}),o.jsx(ue,{value:i.label,onChange:d=>a(l,{label:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: Nome"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Nome (campo)"}),o.jsx(ue,{value:i.name||"",onChange:d=>a(l,{name:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: nome"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Tipo de campo"}),o.jsxs(Vt,{value:i.fieldType,onValueChange:d=>a(l,{fieldType:d}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{})}),o.jsx(Rt,{children:gd.map(d=>o.jsx(Xe,{value:d.value,className:"text-xs",children:d.label},d.value))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Colunas (1-12)"}),o.jsx(ue,{type:"number",min:1,max:12,value:i.tamanho??"",onChange:d=>a(l,{tamanho:d.target.value?Number(d.target.value):void 0}),className:"h-7 text-xs",placeholder:"12"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-[10px]",children:"Placeholder"}),o.jsx(ue,{value:i.placeholder||"",onChange:d=>a(l,{placeholder:d.target.value}),className:"h-7 text-xs",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:`sf-req-${l}`,checked:i.required||!1,onCheckedChange:d=>a(l,{required:d===!0})}),o.jsx(ie,{htmlFor:`sf-req-${l}`,className:"text-[10px] cursor-pointer",children:"Obrigatório"})]}),["select","radio","checkbox_group"].includes(i.fieldType)&&o.jsx("div",{className:"pt-1",children:o.jsx(tx,{options:i.options||[],onChange:d=>a(l,{options:d})})})]})]},l)}),e.length>0&&o.jsx(it,{className:"mt-1"})]})},JC=({config:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:a})=>{const s=e.fieldType||"texto",i=["select","radio","checkbox_group","autocomplete"].includes(s),l=s==="field_array",c=e.locked===!0,d=s==="participation_type",u=s==="payment_method",m=s==="terms",p=s==="file",f=s==="slider",v=!!(e.isDisabled||e.isReadOnly),h=s==="rating",x=s==="date_range",b=s==="sub_form",{schemaId:y,uploadTermsPdf:j,deleteTermsPdf:w}=gt(),[C,S]=N.useState(e.termoPdfUploadId?"upload":"link"),[$,k]=N.useState({status:"idle"}),E=N.useRef(null),T=N.useRef(!0);N.useEffect(()=>()=>{T.current=!1},[]);const O=N.useCallback(async A=>{if(a({termoPdfUploadId:void 0}),w&&y)try{await w(A,y)}catch{}},[w,y,a]),L=N.useCallback(async A=>{if(A.type!=="application/pdf"){k({status:"error",message:"Apenas arquivos PDF são permitidos."});return}if(!y){k({status:"error",message:"Salve o schema primeiro para habilitar o upload de PDF."});return}if(!j){k({status:"error",message:"Upload de PDF não configurado. Forneça a prop uploadTermsPdf ao BuilderProvider."});return}const z=e.termoPdfUploadId;k({status:"uploading",fileName:A.name,progress:0});try{const X=await j(A,y,q=>k(Z=>Z.status==="uploading"?{...Z,progress:q}:Z));if(!T.current)return;if(z&&w)try{await w(z,y)}catch{}if(!T.current)return;a({termoPdfUploadId:X,termoPdfUrl:void 0}),k({status:"idle"})}catch(X){if(!T.current)return;k({status:"error",message:X instanceof Error?X.message:"Falha no upload do PDF."})}},[y,j,w,e.termoPdfUploadId,a]);return o.jsxs("div",{className:"space-y-4",children:[c&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-500/10 border border-amber-500/30 px-3 py-2",children:[o.jsx(I.Lock,{className:"h-4 w-4 text-amber-500 shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-amber-600 dark:text-amber-400",children:"Campo bloqueado"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tipo, nome e ID são fixos (integração automática)"})]})]}),d&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(I.Lock,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Tipo de Participação"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Datas, preços e vagas são carregados automaticamente do evento"})]})]}),m&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(I.ScrollText,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Termos e Condições"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Configure o texto ou URL do PDF abaixo"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Label"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.label,onChange:A=>a({label:A.target.value}),className:"h-8 text-sm"})]}),d||u?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ue,{value:e.hint||"",onChange:A=>a({hint:A.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"req",checked:e.required||!1,onCheckedChange:A=>a({required:A===!0})}),o.jsx(ie,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]})]}):m?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ue,{value:e.hint||"",onChange:A=>a({hint:A.target.value}),className:"h-8 text-sm",placeholder:"Ex: Leia os termos antes de continuar"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"req",checked:e.required||!1,onCheckedChange:A=>a({required:A===!0})}),o.jsx(ie,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Conteúdo dos termos"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Texto dos termos"}),o.jsx(io,{value:e.termoTexto||"",onChange:A=>a({termoTexto:A.target.value||void 0}),className:"text-sm min-h-[120px] resize-y",placeholder:"Escreva aqui os termos e condições que o usuário deverá ler e aceitar..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"PDF dos termos (opcional)"}),o.jsxs("div",{className:"flex gap-1 p-0.5 bg-muted rounded-md",children:[o.jsx("button",{type:"button",onClick:()=>S("link"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${C==="link"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Link externo"}),o.jsx("button",{type:"button",onClick:()=>S("upload"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${C==="upload"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Upload de PDF"})]}),C==="link"?o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{value:e.termoPdfUrl||"",onChange:A=>a({termoPdfUrl:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"https://exemplo.com/termos.pdf"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"URL pública de um PDF. Tem prioridade sobre o texto acima."})]}):o.jsxs("div",{className:"space-y-2",children:[e.termoPdfUploadId&&$.status==="idle"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-green-500/40 bg-green-500/10 px-2 py-1.5",children:[o.jsx(I.CheckCircle2,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),o.jsx("span",{className:"text-[11px] text-green-700 dark:text-green-400 flex-1",children:"PDF enviado ✓"}),o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>O(e.termoPdfUploadId),children:o.jsx(I.X,{className:"h-3 w-3"})})]}):null,$.status==="uploading"?o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[o.jsx(I.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),o.jsx("span",{className:"truncate",children:$.fileName}),o.jsxs("span",{className:"ml-auto",children:[$.progress,"%"]})]}),o.jsx(Ji,{value:$.progress,className:"h-1"})]}):null,$.status==="error"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-destructive/40 bg-destructive/10 px-2 py-1.5",children:[o.jsx(I.AlertCircle,{className:"h-3.5 w-3.5 text-destructive shrink-0"}),o.jsx("span",{className:"text-[11px] text-destructive",children:$.message}),o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 ml-auto",onClick:()=>k({status:"idle"}),children:o.jsx(I.X,{className:"h-3 w-3"})})]}):null,$.status!=="uploading"?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:E,type:"file",accept:"application/pdf",className:"hidden",onChange:A=>{var z;const X=(z=A.target.files)==null?void 0:z[0];X&&L(X),A.target.value=""}}),o.jsxs(Ae,{type:"button",variant:"outline",size:"sm",className:"w-full h-8 text-xs gap-1.5",disabled:!y,onClick:()=>{var A;return(A=E.current)==null?void 0:A.click()},children:[o.jsx(I.Upload,{className:"h-3.5 w-3.5"}),e.termoPdfUploadId?"Substituir PDF":"Selecionar PDF"]}),!y&&o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Salve o schema uma vez para habilitar o upload."})]}):null]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Nome (chave)"}),o.jsx(ue,{value:e.name||t.replace(/^field_/,""),onChange:A=>!c&&a({name:A.target.value}),className:"h-8 text-xs font-mono",placeholder:"nome_do_campo",disabled:c}),c?o.jsx("p",{className:"text-[9px] text-amber-500",children:"ID fixo — necessário para auto-preenchimento"}):o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Usado como chave no JSON do formulário"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Tipo do campo"}),o.jsxs(Vt,{value:s,onValueChange:A=>!c&&a({fieldType:A}),disabled:c,children:[o.jsx(Dt,{className:"h-8 text-sm",children:o.jsx(Bt,{})}),o.jsx(Rt,{children:Ir.map(A=>o.jsx(Xe,{value:A.component,children:A.label},A.component))})]})]}),o.jsx(Qh,{tamanho:e.tamanho||6,inicioColuna:e.inicioColuna||1,defaultTamanho:6,onTamanhoChange:A=>a({tamanho:A}),onPositionChange:A=>a({inicioColuna:A})}),s!=="file"&&!l&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Placeholder"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.placeholder||"",onChange:A=>a({placeholder:A.target.value}),className:"h-8 text-sm",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Dica (hint)"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.hint||"",onChange:A=>a({hint:A.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),s!=="file"&&!l&&!b&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Valor padrão"}),o.jsx(ue,{value:e.defaultValue||"",onChange:A=>a({defaultValue:A.target.value}),className:"h-8 text-sm",placeholder:"Valor inicial do campo"})]}),s!=="file"&&!l&&!b&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(ie,{className:"text-xs",children:"Valor inicial (runtime)"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.initialValue||"",onChange:A=>a({initialValue:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"{{evento.nome}} ou valor fixo"}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:['Sobrepõe "Valor padrão" — suporta variáveis'," ",o.jsx("code",{children:"{{evento.x}}"})]})]}),!l&&!b&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"req",checked:e.required||!1,onCheckedChange:A=>a({required:A===!0})}),o.jsx(ie,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),!l&&!b&&!c&&!p&&o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"readonly",checked:e.isReadOnly||!1,onCheckedChange:A=>a({isReadOnly:A===!0||void 0})}),o.jsx(ie,{htmlFor:"readonly",className:"text-xs cursor-pointer",children:"Somente leitura"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"disabled",checked:e.isDisabled||!1,onCheckedChange:A=>a({isDisabled:A===!0||void 0})}),o.jsx(ie,{htmlFor:"disabled",className:"text-xs cursor-pointer",children:"Desabilitado"})]})]}),f&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Slider"}),o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Mínimo"}),o.jsx(ue,{type:"number",value:e.minValue??0,onChange:A=>a({minValue:Number(A.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Máximo"}),o.jsx(ue,{type:"number",value:e.maxValue??100,onChange:A=>a({maxValue:Number(A.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Passo"}),o.jsx(ue,{type:"number",min:1,value:e.step??1,onChange:A=>a({step:Number(A.target.value)}),className:"h-8 text-sm"})]})]})]})]}),h&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Avaliação"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Número de estrelas"}),o.jsxs(Vt,{value:String(e.maxRating??5),onValueChange:A=>a({maxRating:Number(A)}),children:[o.jsx(Dt,{className:"h-8 text-sm",children:o.jsx(Bt,{})}),o.jsx(Rt,{children:[3,4,5,6,7,10].map(A=>o.jsxs(Xe,{value:String(A),children:[A," estrelas"]},A))})]})]})]})]}),x&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Período"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Label da data inicial"}),o.jsx(ue,{value:e.dateRangeStartLabel??"Data inicial",onChange:A=>a({dateRangeStartLabel:A.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Label da data final"}),o.jsx(ue,{value:e.dateRangeEndLabel??"Data final",onChange:A=>a({dateRangeEndLabel:A.target.value}),className:"h-8 text-sm"})]})]})]}),!l&&o.jsx(it,{}),!l&&!m&&!v&&o.jsx(GC,{fieldType:s,validation:e.validation,onChange:A=>a({validation:A})}),i&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),s==="radio"&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Estilo visual"}),o.jsxs(Vt,{value:e.visualStyle||"card",onValueChange:A=>a({visualStyle:A}),children:[o.jsx(Dt,{className:"h-8 text-sm",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"card",children:"Card (padrão)"}),o.jsx(Xe,{value:"default",children:"Radio simples"})]})]})]}),o.jsx(tx,{options:e.options||[],onChange:A=>a({options:A})})]}),l&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Lista de itens"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Mín. itens"}),o.jsx(ue,{type:"number",min:0,value:e.minItems??"",onChange:A=>a({minItems:A.target.value?Number(A.target.value):void 0}),className:"h-8 text-sm",placeholder:"0"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Máx. itens"}),o.jsx(ue,{type:"number",min:0,value:e.maxItems??"",onChange:A=>a({maxItems:A.target.value?Number(A.target.value):void 0}),className:"h-8 text-sm",placeholder:"Sem limite"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Label do item"}),o.jsx(ue,{value:e.itemLabel||"",onChange:A=>a({itemLabel:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Contato"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:'Prefixo exibido em cada item (ex: "Contato 1", "Contato 2")'})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Label do botão adicionar"}),o.jsx(ue,{value:e.addLabel||"",onChange:A=>a({addLabel:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Adicionar contato"})]}),o.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2",children:o.jsx("p",{className:"text-[11px] text-amber-700 dark:text-amber-400",children:"Os sub-campos são configurados visualmente no canvas: arraste campos da paleta para dentro da caixa laranja."})})]})]}),b&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Sub-formulário"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Título do grupo (opcional)"}),o.jsx(ue,{value:e.subSchemaTitle||"",onChange:A=>a({subSchemaTitle:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Endereço, Responsável..."})]}),o.jsx(YC,{subFields:e.subSchemaFields||[],onChange:A=>a({subSchemaFields:A})})]})]}),!v&&!m&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsx(KC,{condition:e.condition,selectedId:t,allFieldIds:r,getFieldLabel:n,onChange:A=>a({condition:A})})]}),!v&&!m&&e.condition&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs",children:"Valor ao ocultar (clearedValue)"}),o.jsx(ue,{value:e.clearedValue??"",onChange:A=>a({clearedValue:A.target.value||void 0}),className:"h-8 text-sm",placeholder:"Deixar vazio = não limpar"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Valor aplicado automaticamente quando o campo fica oculto."})]}),!l&&!b&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{className:"text-xs text-muted-foreground",children:"Resolver de props (avançado)"}),o.jsx(ue,{value:e.resolvePropsKey||"",onChange:A=>a({resolvePropsKey:A.target.value||void 0}),className:"h-8 text-xs font-mono",placeholder:"chaveDoResolver"}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Registre este key em"," ",o.jsx("code",{children:"RendererContext.fieldResolvers"})," para opções dinâmicas."]})]})]})]})},QC={glassmorphism:"Glass",card:"Card",flat:"Flat",bordered:"Bordered"},rx=()=>{const{previewTemplateId:e,setPreviewTemplateId:t}=gt(),[r,n]=N.useState(!1),a=Object.values(Zr),s=Zr[e];return o.jsxs(To,{open:r,onOpenChange:n,children:[o.jsx(Ao,{asChild:!0,children:o.jsxs(Ae,{variant:"outline",size:"sm",className:"gap-1.5",title:"Selecionar template visual",children:[o.jsx("span",{className:"w-3.5 h-3.5 rounded-full shrink-0 border border-white/20",style:{background:(s==null?void 0:s.colors.primary)??"#3b82f6"}}),o.jsx(I.Palette,{className:"w-3.5 h-3.5"}),o.jsx("span",{className:"hidden sm:inline",children:(s==null?void 0:s.displayName)??"Template"})]})}),o.jsxs(da,{side:"bottom",align:"end",className:"w-80 p-3",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase tracking-wider",children:"Template de Preview"}),o.jsx("div",{className:"grid grid-cols-3 gap-1.5 max-h-72 overflow-y-auto pr-0.5",children:a.map(i=>{const l=i.id===e,c=uu(i),d=QC[i.layout.containerStyle]??"";return o.jsxs("button",{onClick:()=>{t(i.id),n(!1)},className:Ut("relative flex flex-col items-center gap-1.5 rounded-lg p-2 border text-center transition-all hover:scale-[1.02]",l?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[o.jsxs("div",{className:"w-full h-8 rounded-md flex items-center justify-center gap-0.5",style:{background:i.colors.background.startsWith("#")||i.colors.background.startsWith("rgba")?i.colors.background:void 0},"data-muted":!i.colors.background.startsWith("#")&&!i.colors.background.startsWith("rgba")?"true":void 0,children:[o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i.colors.primary}}),o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i.colors.accent}})]}),o.jsx("span",{className:"text-[10px] font-medium leading-tight line-clamp-2",children:i.displayName}),o.jsxs("div",{className:"flex items-center gap-0.5 flex-wrap justify-center",children:[c&&o.jsx("span",{className:"text-[9px] px-1 rounded bg-zinc-800 text-zinc-300",children:"dark"}),d&&o.jsx("span",{className:"text-[9px] px-1 rounded bg-muted text-muted-foreground",children:d})]}),l&&o.jsx("div",{className:"absolute top-1 right-1",children:o.jsx(I.Check,{className:"w-3 h-3 text-primary"})})]},i.id)})})]})]})},eN=[{value:"numbers",label:"Números"},{value:"icons",label:"Ícones"},{value:"icons-labeled",label:"Ícones + rótulo"}],tN=[{value:"top-center",label:"Centralizado"},{value:"top-left",label:"Esquerda"}],rN=[{value:"horizontal",label:"Horizontal"},{value:"vertical",label:"Vertical (sidebar)"}],nN=()=>{const{stepConfig:e,updateStepConfig:t}=gt();return o.jsxs("div",{className:"space-y-5",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Template visual"}),o.jsx(rx,{})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Indicador de steps"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"sc-show-indicators",checked:e.showStepIndicators!==!1,onCheckedChange:r=>t({showStepIndicators:r===!0})}),o.jsx(ie,{htmlFor:"sc-show-indicators",className:"text-xs cursor-pointer",children:"Exibir indicador de steps"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"sc-show-progress",checked:e.showProgressBar===!0,onCheckedChange:r=>t({showProgressBar:r===!0})}),o.jsx(ie,{htmlFor:"sc-show-progress",className:"text-xs cursor-pointer",children:"Exibir barra de progresso"})]})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"Variante visual"}),o.jsx("div",{className:"flex flex-col gap-1.5",children:eN.map(r=>o.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&&o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"Orientação"}),o.jsx("div",{className:"flex gap-2",children:rN.map(r=>o.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&&o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ie,{className:"text-xs",children:"Posição (desktop)"}),o.jsx("div",{className:"flex gap-2",children:tN.map(r=>o.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&&o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]})]})},aN=()=>{const{selectedId:e,getConfig:t,updateConfig:r,getAllFieldIds:n}=gt();if(!e)return o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-4 max-h-[calc(100vh-160px)] overflow-y-auto",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Formulário"})}),o.jsx(it,{}),o.jsx(nN,{})]});const a=t(e),s=qe(e),i=c=>r(e,c),l=n().filter(c=>c!==e);return o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-4 max-h-[calc(100vh-160px)] overflow-y-auto",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"text-sm font-bold text-foreground",children:s==="step"?"Step":s==="container"?"Container":"Campo"}),o.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:e})]}),o.jsx(it,{}),s==="step"&&o.jsx(zC,{config:a,onUpdate:i}),s==="container"&&o.jsx(MC,{config:a,onUpdate:i}),s==="field"&&o.jsx(JC,{config:a,selectedId:e,allFieldIds:l,getFieldLabel:c=>t(c).label||c,onUpdate:i})]})};var ma=e=>e.type==="checkbox",Xr=e=>e instanceof Date,bt=e=>e==null;const nx=e=>typeof e=="object";var nt=e=>!bt(e)&&!Array.isArray(e)&&nx(e)&&!Xr(e),ax=e=>nt(e)&&e.target?ma(e.target)?e.target.checked:e.target.value:e,oN=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,ox=(e,t)=>e.has(oN(t)),sN=e=>{const t=e.constructor&&e.constructor.prototype;return nt(t)&&t.hasOwnProperty("isPrototypeOf")},Cl=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Me(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Cl&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(nt(e)&&sN(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=Me(e[a]));return n}var Uo=e=>/^\w*$/.test(e),Fe=e=>e===void 0,Ho=e=>Array.isArray(e)?e.filter(Boolean):[],Nl=e=>Ho(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ae=(e,t,r)=>{if(!t||!nt(e))return r;const n=(Uo(t)?[t]:Nl(t)).reduce((a,s)=>bt(a)?a:a[s],e);return Fe(n)||n===e?Fe(e[t])?r:e[t]:n},St=e=>typeof e=="boolean",ht=e=>typeof e=="function",Oe=(e,t,r)=>{let n=-1;const a=Uo(t)?[t]:Nl(t),s=a.length,i=s-1;for(;++n<s;){const l=a[n];let c=r;if(n!==i){const d=e[l];c=nt(d)||Array.isArray(d)?d:isNaN(+a[n+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=c,e=e[l]}};const Qa={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ft={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},xr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Sl=N.createContext(null);Sl.displayName="HookFormControlContext";const Wo=()=>N.useContext(Sl);var sx=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(a,s,{get:()=>{const i=s;return t._proxyFormState[i]!==Ft.all&&(t._proxyFormState[i]=!n||Ft.all),r&&(r[i]=!0),e[i]}});return a};const qo=typeof window<"u"?N.useLayoutEffect:N.useEffect;function ix(e){const t=Wo(),{control:r=t,disabled:n,name:a,exact:s}=e||{},[i,l]=N.useState(r._formState),c=N.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return qo(()=>r._subscribe({name:a,formState:c.current,exact:s,callback:d=>{!n&&l({...r._formState,...d})}}),[a,n,s]),N.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),N.useMemo(()=>sx(i,r,c.current,!1),[i,r])}var Et=e=>typeof e=="string",ci=(e,t,r,n,a)=>Et(e)?(n&&t.watch.add(e),ae(r,e,a)):Array.isArray(e)?e.map(s=>(n&&t.watch.add(s),ae(r,s))):(n&&(t.watchAll=!0),r),di=e=>bt(e)||!nx(e);function Zt(e,t,r=new WeakSet){if(di(e)||di(t))return Object.is(e,t);if(Xr(e)&&Xr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const i=e[s];if(!a.includes(s))return!1;if(s!=="ref"){const l=t[s];if(Xr(i)&&Xr(l)||nt(i)&&nt(l)||Array.isArray(i)&&Array.isArray(l)?!Zt(i,l,r):!Object.is(i,l))return!1}}return!0}function Fn(e){const t=Wo(),{control:r=t,name:n,defaultValue:a,disabled:s,exact:i,compute:l}=e||{},c=N.useRef(a),d=N.useRef(l),u=N.useRef(void 0),m=N.useRef(r),p=N.useRef(n);d.current=l;const[f,v]=N.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),h=N.useCallback(w=>{const C=ci(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(C):C},[r._formValues,r._names,n]),x=N.useCallback(w=>{if(!s){const C=ci(n,r._names,w||r._formValues,!1,c.current);if(d.current){const S=d.current(C);Zt(S,u.current)||(v(S),u.current=S)}else v(C)}},[r._formValues,r._names,s,n]);qo(()=>((m.current!==r||!Zt(p.current,n))&&(m.current=r,p.current=n,x()),r._subscribe({name:n,formState:{values:!0},exact:i,callback:w=>{x(w.values)}})),[r,i,n,x]),N.useEffect(()=>r._removeUnmounted());const b=m.current!==r,y=p.current,j=N.useMemo(()=>{if(s)return null;const w=!b&&!Zt(y,n);return b||w?h():null},[s,b,n,y,h]);return j!==null?j:f}function Be(e){const t=Wo(),{name:r,disabled:n,control:a=t,shouldUnregister:s,defaultValue:i,exact:l=!0}=e,c=ox(a._names.array,r),d=N.useMemo(()=>ae(a._formValues,r,ae(a._defaultValues,r,i)),[a,r,i]),u=Fn({control:a,name:r,defaultValue:d,exact:l}),m=ix({control:a,name:r,exact:l}),p=N.useRef(e),f=N.useRef(void 0),v=N.useRef(a.register(r,{...e.rules,value:u,...St(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const h=N.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ae(m.errors,r)},isDirty:{enumerable:!0,get:()=>!!ae(m.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ae(m.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ae(m.validatingFields,r)},error:{enumerable:!0,get:()=>ae(m.errors,r)}}),[m,r]),x=N.useCallback(w=>v.current.onChange({target:{value:ax(w),name:r},type:Qa.CHANGE}),[r]),b=N.useCallback(()=>v.current.onBlur({target:{value:ae(a._formValues,r),name:r},type:Qa.BLUR}),[r,a._formValues]),y=N.useCallback(w=>{const C=ae(a._fields,r);C&&C._f&&w&&(C._f.ref={focus:()=>ht(w.focus)&&w.focus(),select:()=>ht(w.select)&&w.select(),setCustomValidity:S=>ht(w.setCustomValidity)&&w.setCustomValidity(S),reportValidity:()=>ht(w.reportValidity)&&w.reportValidity()})},[a._fields,r]),j=N.useMemo(()=>({name:r,value:u,...St(n)||m.disabled?{disabled:m.disabled||n}:{},onChange:x,onBlur:b,ref:y}),[r,n,m.disabled,x,b,y,u]);return N.useEffect(()=>{const w=a._options.shouldUnregister||s,C=f.current;C&&C!==r&&!c&&a.unregister(C),a.register(r,{...p.current.rules,...St(p.current.disabled)?{disabled:p.current.disabled}:{}});const S=($,k)=>{const E=ae(a._fields,$);E&&E._f&&(E._f.mount=k)};if(S(r,!0),w){const $=Me(ae(a._options.defaultValues,r,p.current.defaultValue));Oe(a._defaultValues,r,$),Fe(ae(a._formValues,r))&&Oe(a._formValues,r,$)}return!c&&a.register(r),f.current=r,()=>{(c?w&&!a._state.action:w)?a.unregister(r):S(r,!1)}},[r,a,c,s]),N.useEffect(()=>{a._setDisabledField({disabled:n,name:r})},[n,r,a]),N.useMemo(()=>({field:j,formState:m,fieldState:h}),[j,m,h])}const $l=N.createContext(null);$l.displayName="HookFormContext";const iN=()=>N.useContext($l),lN=e=>{const{children:t,watch:r,getValues:n,getFieldState:a,setError:s,clearErrors:i,setValue:l,trigger:c,formState:d,resetField:u,reset:m,handleSubmit:p,unregister:f,control:v,register:h,setFocus:x,subscribe:b}=e;return N.createElement($l.Provider,{value:N.useMemo(()=>({watch:r,getValues:n,getFieldState:a,setError:s,clearErrors:i,setValue:l,trigger:c,formState:d,resetField:u,reset:m,handleSubmit:p,unregister:f,control:v,register:h,setFocus:x,subscribe:b}),[i,v,d,a,n,p,h,m,u,s,x,l,b,c,f,r])},N.createElement(Sl.Provider,{value:v},t))};var cN=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},yt=e=>Array.isArray(e)?e:[e],vd=()=>{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 lx(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],s=t[n];if(a&&nt(a)&&s){const i=lx(a,s);nt(i)&&(r[n]=i)}else e[n]&&(r[n]=s)}return r}var ct=e=>nt(e)&&!Object.keys(e).length,El=e=>e.type==="file",eo=e=>{if(!Cl)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},cx=e=>e.type==="select-multiple",Tl=e=>e.type==="radio",dN=e=>Tl(e)||ma(e),ks=e=>eo(e)&&e.isConnected;function uN(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Fe(e)?n++:e[t[n++]];return e}function mN(e){for(const t in e)if(e.hasOwnProperty(t)&&!Fe(e[t]))return!1;return!0}function He(e,t){const r=Array.isArray(t)?t:Uo(t)?[t]:Nl(t),n=r.length===1?e:uN(e,r),a=r.length-1,s=r[a];return n&&delete n[s],a!==0&&(nt(n)&&ct(n)||Array.isArray(n)&&mN(n))&&He(e,r.slice(0,-1)),e}var pN=e=>{for(const t in e)if(ht(e[t]))return!0;return!1};function dx(e){return Array.isArray(e)||nt(e)&&!pN(e)}function ui(e,t={}){for(const r in e){const n=e[r];dx(n)?(t[r]=Array.isArray(n)?[]:{},ui(n,t[r])):Fe(n)||(t[r]=!0)}return t}function hn(e,t,r){r||(r=ui(t));for(const n in e){const a=e[n];if(dx(a))Fe(t)||di(r[n])?r[n]=ui(a,Array.isArray(a)?[]:{}):hn(a,bt(t)?{}:t[n],r[n]);else{const s=t[n];r[n]=!Zt(a,s)}}return r}const bd={value:!1,isValid:!1},yd={value:!0,isValid:!0};var ux=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&&!Fe(e[0].attributes.value)?Fe(e[0].value)||e[0].value===""?yd:{value:e[0].value,isValid:!0}:yd:bd}return bd},mx=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Fe(e)?e:t?e===""?NaN:e&&+e:r&&Et(e)?new Date(e):n?n(e):e;const wd={isValid:!1,value:null};var px=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,wd):wd;function jd(e){const t=e.ref;return El(t)?t.files:Tl(t)?px(e.refs).value:cx(t)?[...t.selectedOptions].map(({value:r})=>r):ma(t)?ux(e.refs).value:mx(Fe(t.value)?e.ref.value:t.value,e)}var fN=(e,t,r,n)=>{const a={};for(const s of e){const i=ae(t,s);i&&Oe(a,s,i._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}},to=e=>e instanceof RegExp,Hn=e=>Fe(e)?e:to(e)?e.source:nt(e)?to(e.value)?e.value.source:e.value:e,vn=e=>({isOnSubmit:!e||e===Ft.onSubmit,isOnBlur:e===Ft.onBlur,isOnChange:e===Ft.onChange,isOnAll:e===Ft.all,isOnTouch:e===Ft.onTouched});const kd="AsyncFunction";var hN=e=>!!e&&!!e.validate&&!!(ht(e.validate)&&e.validate.constructor.name===kd||nt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===kd)),xN=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),mi=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const kn=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const s=ae(e,a);if(s){const{_f:i,...l}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],a)&&!n||i.ref&&t(i.ref,i.name)&&!n)return!0;if(kn(l,t))break}else if(nt(l)&&kn(l,t))break}}};function Cd(e,t,r){const n=ae(e,r);if(n||Uo(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const s=a.join("."),i=ae(t,s),l=ae(e,s);if(i&&!Array.isArray(i)&&r!==s)return{name:r};if(l&&l.type)return{name:s,error:l};if(l&&l.root&&l.root.type)return{name:`${s}.root`,error:l.root};a.pop()}return{name:r}}var gN=(e,t,r,n)=>{r(e);const{name:a,...s}=e;return ct(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===(!n||Ft.all))},vN=(e,t,r)=>!e||!t||e===t||yt(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),bN=(e,t,r,n,a)=>a.isOnAll?!1:!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:(r?n.isOnChange:a.isOnChange)?e:!0,yN=(e,t)=>!Ho(ae(e,t)).length&&He(e,t),fx=(e,t,r)=>{const n=yt(ae(e,r));return Oe(n,"root",t[r]),Oe(e,r,n),e};function Nd(e,t,r="validate"){if(Et(e)||Array.isArray(e)&&e.every(Et)||St(e)&&!e)return{type:r,message:Et(e)?e:"",ref:t}}var pn=e=>nt(e)&&!to(e)?e:{value:e,message:""},pi=async(e,t,r,n,a,s)=>{const{ref:i,refs:l,required:c,maxLength:d,minLength:u,min:m,max:p,pattern:f,validate:v,name:h,valueAsNumber:x,mount:b}=e._f,y=ae(r,h);if(!b||t.has(h))return{};const j=l?l[0]:i,w=L=>{a&&j.reportValidity&&(j.setCustomValidity(St(L)?"":L||""),j.reportValidity())},C={},S=Tl(i),$=ma(i),k=S||$,E=(x||El(i))&&Fe(i.value)&&Fe(y)||eo(i)&&i.value===""||y===""||Array.isArray(y)&&!y.length,T=cN.bind(null,h,n,C),O=(L,A,z,X=xr.maxLength,q=xr.minLength)=>{const Z=L?A:z;C[h]={type:L?X:q,message:Z,ref:i,...T(L?X:q,Z)}};if(s?!Array.isArray(y)||!y.length:c&&(!k&&(E||bt(y))||St(y)&&!y||$&&!ux(l).isValid||S&&!px(l).isValid)){const{value:L,message:A}=Et(c)?{value:!!c,message:c}:pn(c);if(L&&(C[h]={type:xr.required,message:A,ref:j,...T(xr.required,A)},!n))return w(A),C}if(!E&&(!bt(m)||!bt(p))){let L,A;const z=pn(p),X=pn(m);if(!bt(y)&&!isNaN(y)){const q=i.valueAsNumber||y&&+y;bt(z.value)||(L=q>z.value),bt(X.value)||(A=q<X.value)}else{const q=i.valueAsDate||new Date(y),Z=_=>new Date(new Date().toDateString()+" "+_),V=i.type=="time",M=i.type=="week";Et(z.value)&&y&&(L=V?Z(y)>Z(z.value):M?y>z.value:q>new Date(z.value)),Et(X.value)&&y&&(A=V?Z(y)<Z(X.value):M?y<X.value:q<new Date(X.value))}if((L||A)&&(O(!!L,z.message,X.message,xr.max,xr.min),!n))return w(C[h].message),C}if((d||u)&&!E&&(Et(y)||s&&Array.isArray(y))){const L=pn(d),A=pn(u),z=!bt(L.value)&&y.length>+L.value,X=!bt(A.value)&&y.length<+A.value;if((z||X)&&(O(z,L.message,A.message),!n))return w(C[h].message),C}if(f&&!E&&Et(y)){const{value:L,message:A}=pn(f);if(to(L)&&!y.match(L)&&(C[h]={type:xr.pattern,message:A,ref:i,...T(xr.pattern,A)},!n))return w(A),C}if(v){if(ht(v)){const L=await v(y,r),A=Nd(L,j);if(A&&(C[h]={...A,...T(xr.validate,A.message)},!n))return w(A.message),C}else if(nt(v)){let L={};for(const A in v){if(!ct(L)&&!n)break;const z=Nd(await v[A](y,r),j,A);z&&(L={...z,...T(A,z.message)},w(z.message),n&&(C[h]=L))}if(!ct(L)&&(C[h]={ref:j,...L},!n))return C}}return w(!0),C};const wN={mode:Ft.onSubmit,reValidateMode:Ft.onChange,shouldFocusError:!0};function jN(e={}){let t={...wN,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:ht(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},a=nt(t.defaultValues)||nt(t.values)?Me(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Me(a),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...u};let p={...m};const f={array:vd(),state:vd()},v=t.criteriaMode===Ft.all,h=P=>F=>{clearTimeout(d),d=setTimeout(P,F)},x=async P=>{if(!i.keepIsValid&&!t.disabled&&(m.isValid||p.isValid||P)){let F;t.resolver?(F=ct((await k()).errors),b()):F=await T(n,!0),F!==r.isValid&&f.state.next({isValid:F})}},b=(P,F)=>{!t.disabled&&(m.isValidating||m.validatingFields||p.isValidating||p.validatingFields)&&((P||Array.from(l.mount)).forEach(B=>{B&&(F?Oe(r.validatingFields,B,F):He(r.validatingFields,B))}),f.state.next({validatingFields:r.validatingFields,isValidating:!ct(r.validatingFields)}))},y=(P,F=[],B,le,oe=!0,re=!0)=>{if(le&&B&&!t.disabled){if(i.action=!0,re&&Array.isArray(ae(n,P))){const ye=B(ae(n,P),le.argA,le.argB);oe&&Oe(n,P,ye)}if(re&&Array.isArray(ae(r.errors,P))){const ye=B(ae(r.errors,P),le.argA,le.argB);oe&&Oe(r.errors,P,ye),yN(r.errors,P)}if((m.touchedFields||p.touchedFields)&&re&&Array.isArray(ae(r.touchedFields,P))){const ye=B(ae(r.touchedFields,P),le.argA,le.argB);oe&&Oe(r.touchedFields,P,ye)}(m.dirtyFields||p.dirtyFields)&&(r.dirtyFields=hn(a,s)),f.state.next({name:P,isDirty:L(P,F),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Oe(s,P,F)},j=(P,F)=>{Oe(r.errors,P,F),f.state.next({errors:r.errors})},w=P=>{r.errors=P,f.state.next({errors:r.errors,isValid:!1})},C=(P,F,B,le)=>{const oe=ae(n,P);if(oe){const re=ae(s,P,Fe(B)?ae(a,P):B);Fe(re)||le&&le.defaultChecked||F?Oe(s,P,F?re:jd(oe._f)):X(P,re),i.mount&&!i.action&&x()}},S=(P,F,B,le,oe)=>{let re=!1,ye=!1;const Pe={name:P};if(!t.disabled){if(!B||le){(m.isDirty||p.isDirty)&&(ye=r.isDirty,r.isDirty=Pe.isDirty=L(),re=ye!==Pe.isDirty);const _e=Zt(ae(a,P),F);ye=!!ae(r.dirtyFields,P),_e?He(r.dirtyFields,P):Oe(r.dirtyFields,P,!0),Pe.dirtyFields=r.dirtyFields,re=re||(m.dirtyFields||p.dirtyFields)&&ye!==!_e}if(B){const _e=ae(r.touchedFields,P);_e||(Oe(r.touchedFields,P,B),Pe.touchedFields=r.touchedFields,re=re||(m.touchedFields||p.touchedFields)&&_e!==B)}re&&oe&&f.state.next(Pe)}return re?Pe:{}},$=(P,F,B,le)=>{const oe=ae(r.errors,P),re=(m.isValid||p.isValid)&&St(F)&&r.isValid!==F;if(t.delayError&&B?(c=h(()=>j(P,B)),c(t.delayError)):(clearTimeout(d),c=null,B?Oe(r.errors,P,B):He(r.errors,P)),(B?!Zt(oe,B):oe)||!ct(le)||re){const ye={...le,...re&&St(F)?{isValid:F}:{},errors:r.errors,name:P};r={...r,...ye},f.state.next(ye)}},k=async P=>(b(P,!0),await t.resolver(s,t.context,fN(P||l.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),E=async P=>{const{errors:F}=await k(P);if(b(P),P)for(const B of P){const le=ae(F,B);le?Oe(r.errors,B,le):He(r.errors,B)}else r.errors=F;return F},T=async(P,F,B={valid:!0})=>{for(const le in P){const oe=P[le];if(oe){const{_f:re,...ye}=oe;if(re){const Pe=l.array.has(re.name),_e=oe._f&&hN(oe._f);_e&&m.validatingFields&&b([re.name],!0);const st=await pi(oe,l.disabled,s,v,t.shouldUseNativeValidation&&!F,Pe);if(_e&&m.validatingFields&&b([re.name]),st[re.name]&&(B.valid=!1,F||e.shouldUseNativeValidation))break;!F&&(ae(st,re.name)?Pe?fx(r.errors,st,re.name):Oe(r.errors,re.name,st[re.name]):He(r.errors,re.name))}!ct(ye)&&await T(ye,F,B)}}return B.valid},O=()=>{for(const P of l.unMount){const F=ae(n,P);F&&(F._f.refs?F._f.refs.every(B=>!ks(B)):!ks(F._f.ref))&&ne(P)}l.unMount=new Set},L=(P,F)=>!t.disabled&&(P&&F&&Oe(s,P,F),!Zt(se(),a)),A=(P,F,B)=>ci(P,l,{...i.mount?s:Fe(F)?a:Et(P)?{[P]:F}:F},B,F),z=P=>Ho(ae(i.mount?s:a,P,t.shouldUnregister?ae(a,P,[]):[])),X=(P,F,B={})=>{const le=ae(n,P);let oe=F;if(le){const re=le._f;re&&(!re.disabled&&Oe(s,P,mx(F,re)),oe=eo(re.ref)&&bt(F)?"":F,cx(re.ref)?[...re.ref.options].forEach(ye=>ye.selected=oe.includes(ye.value)):re.refs?ma(re.ref)?re.refs.forEach(ye=>{(!ye.defaultChecked||!ye.disabled)&&(Array.isArray(oe)?ye.checked=!!oe.find(Pe=>Pe===ye.value):ye.checked=oe===ye.value||!!oe)}):re.refs.forEach(ye=>ye.checked=ye.value===oe):El(re.ref)?re.ref.value="":(re.ref.value=oe,re.ref.type||f.state.next({name:P,values:Me(s)})))}(B.shouldDirty||B.shouldTouch)&&S(P,oe,B.shouldTouch,B.shouldDirty,!0),B.shouldValidate&&_(P)},q=(P,F,B)=>{for(const le in F){if(!F.hasOwnProperty(le))return;const oe=F[le],re=P+"."+le,ye=ae(n,re);(l.array.has(P)||nt(oe)||ye&&!ye._f)&&!Xr(oe)?q(re,oe,B):X(re,oe,B)}},Z=(P,F,B={})=>{const le=ae(n,P),oe=l.array.has(P),re=Me(F);Oe(s,P,re),oe?(f.array.next({name:P,values:Me(s)}),(m.isDirty||m.dirtyFields||p.isDirty||p.dirtyFields)&&B.shouldDirty&&f.state.next({name:P,dirtyFields:hn(a,s),isDirty:L(P,re)})):le&&!le._f&&!bt(re)?q(P,re,B):X(P,re,B),mi(P,l)?f.state.next({...r,name:P,values:Me(s)}):f.state.next({name:i.mount?P:void 0,values:Me(s)})},V=async P=>{i.mount=!0;const F=P.target;let B=F.name,le=!0;const oe=ae(n,B),re=_e=>{le=Number.isNaN(_e)||Xr(_e)&&isNaN(_e.getTime())||Zt(_e,ae(s,B,_e))},ye=vn(t.mode),Pe=vn(t.reValidateMode);if(oe){let _e,st;const er=F.type?jd(oe._f):ax(P),tr=P.type===Qa.BLUR||P.type===Qa.FOCUS_OUT,Xo=!xN(oe._f)&&!t.resolver&&!ae(r.errors,B)&&!oe._f.deps||bN(tr,ae(r.touchedFields,B),r.isSubmitted,Pe,ye),zn=mi(B,l,tr);Oe(s,B,er),tr?(!F||!F.readOnly)&&(oe._f.onBlur&&oe._f.onBlur(P),c&&c(0)):oe._f.onChange&&oe._f.onChange(P);const Ln=S(B,er,tr),Zo=!ct(Ln)||zn;if(!tr&&f.state.next({name:B,type:P.type,values:Me(s)}),Xo)return(m.isValid||p.isValid)&&(t.mode==="onBlur"?tr&&x():tr||x()),Zo&&f.state.next({name:B,...zn?{}:Ln});if(!tr&&zn&&f.state.next({...r}),t.resolver){const{errors:ha}=await k([B]);if(b([B]),re(er),le){const Ko=Cd(r.errors,n,B),on=Cd(ha,n,Ko.name||B);_e=on.error,B=on.name,st=ct(ha)}}else b([B],!0),_e=(await pi(oe,l.disabled,s,v,t.shouldUseNativeValidation))[B],b([B]),re(er),le&&(_e?st=!1:(m.isValid||p.isValid)&&(st=await T(n,!0)));le&&(oe._f.deps&&(!Array.isArray(oe._f.deps)||oe._f.deps.length>0)&&_(oe._f.deps),$(B,st,_e,Ln))}},M=(P,F)=>{if(ae(r.errors,F)&&P.focus)return P.focus(),1},_=async(P,F={})=>{let B,le;const oe=yt(P);if(t.resolver){const re=await E(Fe(P)?P:oe);B=ct(re),le=P?!oe.some(ye=>ae(re,ye)):B}else P?(le=(await Promise.all(oe.map(async re=>{const ye=ae(n,re);return await T(ye&&ye._f?{[re]:ye}:ye)}))).every(Boolean),!(!le&&!r.isValid)&&x()):le=B=await T(n);return f.state.next({...!Et(P)||(m.isValid||p.isValid)&&B!==r.isValid?{}:{name:P},...t.resolver||!P?{isValid:B}:{},errors:r.errors}),F.shouldFocus&&!le&&kn(n,M,P?oe:l.mount),le},se=(P,F)=>{let B={...i.mount?s:a};return F&&(B=lx(F.dirtyFields?r.dirtyFields:r.touchedFields,B)),Fe(P)?B:Et(P)?ae(B,P):P.map(le=>ae(B,le))},U=(P,F)=>({invalid:!!ae((F||r).errors,P),isDirty:!!ae((F||r).dirtyFields,P),error:ae((F||r).errors,P),isValidating:!!ae(r.validatingFields,P),isTouched:!!ae((F||r).touchedFields,P)}),Q=P=>{const F=P?yt(P):void 0;F==null||F.forEach(B=>He(r.errors,B)),F?F.forEach(B=>{f.state.next({name:B,errors:r.errors})}):f.state.next({errors:{}})},Y=(P,F,B)=>{const le=(ae(n,P,{_f:{}})._f||{}).ref,oe=ae(r.errors,P)||{},{ref:re,message:ye,type:Pe,..._e}=oe;Oe(r.errors,P,{..._e,...F,ref:le}),f.state.next({name:P,errors:r.errors,isValid:!1}),B&&B.shouldFocus&&le&&le.focus&&le.focus()},H=(P,F)=>ht(P)?f.state.subscribe({next:B=>"values"in B&&P(A(void 0,F),B)}):A(P,F,!0),W=P=>f.state.subscribe({next:F=>{vN(P.name,F.name,P.exact)&&gN(F,P.formState||m,dt,P.reRenderRoot)&&P.callback({values:{...s},...r,...F,defaultValues:a})}}).unsubscribe,G=P=>(i.mount=!0,p={...p,...P.formState},W({...P,formState:{...u,...P.formState}})),ne=(P,F={})=>{for(const B of P?yt(P):l.mount)l.mount.delete(B),l.array.delete(B),F.keepValue||(He(n,B),He(s,B)),!F.keepError&&He(r.errors,B),!F.keepDirty&&He(r.dirtyFields,B),!F.keepTouched&&He(r.touchedFields,B),!F.keepIsValidating&&He(r.validatingFields,B),!t.shouldUnregister&&!F.keepDefaultValue&&He(a,B);f.state.next({values:Me(s)}),f.state.next({...r,...F.keepDirty?{isDirty:L()}:{}}),!F.keepIsValid&&x()},J=({disabled:P,name:F})=>{if(St(P)&&i.mount||P||l.disabled.has(F)){const B=l.disabled.has(F)!==!!P;P?l.disabled.add(F):l.disabled.delete(F),B&&i.mount&&!i.action&&x()}},te=(P,F={})=>{let B=ae(n,P);const le=St(F.disabled)||St(t.disabled);return Oe(n,P,{...B||{},_f:{...B&&B._f?B._f:{ref:{name:P}},name:P,mount:!0,...F}}),l.mount.add(P),B?J({disabled:St(F.disabled)?F.disabled:t.disabled,name:P}):C(P,!0,F.value),{...le?{disabled:F.disabled||t.disabled}:{},...t.progressive?{required:!!F.required,min:Hn(F.min),max:Hn(F.max),minLength:Hn(F.minLength),maxLength:Hn(F.maxLength),pattern:Hn(F.pattern)}:{},name:P,onChange:V,onBlur:V,ref:oe=>{if(oe){te(P,F),B=ae(n,P);const re=Fe(oe.value)&&oe.querySelectorAll&&oe.querySelectorAll("input,select,textarea")[0]||oe,ye=dN(re),Pe=B._f.refs||[];if(ye?Pe.find(_e=>_e===re):re===B._f.ref)return;Oe(n,P,{_f:{...B._f,...ye?{refs:[...Pe.filter(ks),re,...Array.isArray(ae(a,P))?[{}]:[]],ref:{type:re.type,name:P}}:{ref:re}}}),C(P,!1,void 0,re)}else B=ae(n,P,{}),B._f&&(B._f.mount=!1),(t.shouldUnregister||F.shouldUnregister)&&!(ox(l.array,P)&&i.action)&&l.unMount.add(P)}}},ce=()=>t.shouldFocusError&&kn(n,M,l.mount),be=P=>{St(P)&&(f.state.next({disabled:P}),kn(n,(F,B)=>{const le=ae(n,B);le&&(F.disabled=le._f.disabled||P,Array.isArray(le._f.refs)&&le._f.refs.forEach(oe=>{oe.disabled=le._f.disabled||P}))},0,!1))},Ce=(P,F)=>async B=>{let le;B&&(B.preventDefault&&B.preventDefault(),B.persist&&B.persist());let oe=Me(s);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:re,values:ye}=await k();b(),r.errors=re,oe=Me(ye)}else await T(n);if(l.disabled.size)for(const re of l.disabled)He(oe,re);if(He(r.errors,"root"),ct(r.errors)){f.state.next({errors:{}});try{await P(oe,B)}catch(re){le=re}}else F&&await F({...r.errors},B),ce(),setTimeout(ce);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ct(r.errors)&&!le,submitCount:r.submitCount+1,errors:r.errors}),le)throw le},ve=(P,F={})=>{ae(n,P)&&(Fe(F.defaultValue)?Z(P,Me(ae(a,P))):(Z(P,F.defaultValue),Oe(a,P,Me(F.defaultValue))),F.keepTouched||He(r.touchedFields,P),F.keepDirty||(He(r.dirtyFields,P),r.isDirty=F.defaultValue?L(P,Me(ae(a,P))):L()),F.keepError||(He(r.errors,P),m.isValid&&x()),f.state.next({...r}))},me=(P,F={})=>{const B=P?Me(P):a,le=Me(B),oe=ct(P),re=oe?a:le;if(F.keepDefaultValues||(a=B),!F.keepValues){if(F.keepDirtyValues){const ye=new Set([...l.mount,...Object.keys(hn(a,s))]);for(const Pe of Array.from(ye)){const _e=ae(r.dirtyFields,Pe),st=ae(s,Pe),er=ae(re,Pe);_e&&!Fe(st)?Oe(re,Pe,st):!_e&&!Fe(er)&&Z(Pe,er)}}else{if(Cl&&Fe(P))for(const ye of l.mount){const Pe=ae(n,ye);if(Pe&&Pe._f){const _e=Array.isArray(Pe._f.refs)?Pe._f.refs[0]:Pe._f.ref;if(eo(_e)){const st=_e.closest("form");if(st){st.reset();break}}}}if(F.keepFieldsRef)for(const ye of l.mount)Z(ye,ae(re,ye));else n={}}s=t.shouldUnregister?F.keepDefaultValues?Me(a):{}:Me(re),f.array.next({values:{...re}}),f.state.next({values:{...re}})}l={mount:F.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!m.isValid||!!F.keepIsValid||!!F.keepDirtyValues||!t.shouldUnregister&&!ct(re),i.watch=!!t.shouldUnregister,i.keepIsValid=!!F.keepIsValid,i.action=!1,F.keepErrors||(r.errors={}),f.state.next({submitCount:F.keepSubmitCount?r.submitCount:0,isDirty:oe?!1:F.keepDirty?r.isDirty:!!(F.keepDefaultValues&&!Zt(P,a)),isSubmitted:F.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:oe?{}:F.keepDirtyValues?F.keepDefaultValues&&s?hn(a,s):r.dirtyFields:F.keepDefaultValues&&P?hn(a,P):F.keepDirty?r.dirtyFields:{},touchedFields:F.keepTouched?r.touchedFields:{},errors:F.keepErrors?r.errors:{},isSubmitSuccessful:F.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:a})},Te=(P,F)=>me(ht(P)?P(s):P,{...t.resetOptions,...F}),ze=(P,F={})=>{const B=ae(n,P),le=B&&B._f;if(le){const oe=le.refs?le.refs[0]:le.ref;oe.focus&&setTimeout(()=>{oe.focus(),F.shouldSelect&&ht(oe.select)&&oe.select()})}},dt=P=>{r={...r,...P}},Ve={control:{register:te,unregister:ne,getFieldState:U,handleSubmit:Ce,setError:Y,_subscribe:W,_runSchema:k,_updateIsValidating:b,_focusError:ce,_getWatch:A,_getDirty:L,_setValid:x,_setFieldArray:y,_setDisabledField:J,_setErrors:w,_getFieldArray:z,_reset:me,_resetDefaultValues:()=>ht(t.defaultValues)&&t.defaultValues().then(P=>{Te(P,t.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:O,_disableForm:be,_subjects:f,_proxyFormState:m,get _fields(){return n},get _formValues(){return s},get _state(){return i},set _state(P){i=P},get _defaultValues(){return a},get _names(){return l},set _names(P){l=P},get _formState(){return r},get _options(){return t},set _options(P){t={...t,...P}}},subscribe:G,trigger:_,register:te,handleSubmit:Ce,watch:H,setValue:Z,getValues:se,reset:Te,resetField:ve,clearErrors:Q,unregister:ne,setError:Y,setFocus:ze,getFieldState:U};return{...Ve,formControl:Ve}}var Tr=()=>{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)})},Cs=(e,t,r={})=>r.shouldFocus||Fe(r.shouldFocus)?r.focusName||`${e}.${Fe(r.focusIndex)?t:r.focusIndex}.`:"",Ns=(e,t)=>[...e,...yt(t)],Ss=e=>Array.isArray(e)?e.map(()=>{}):void 0;function $s(e,t,r){return[...e.slice(0,t),...yt(r),...e.slice(t)]}var Es=(e,t,r)=>Array.isArray(e)?(Fe(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[],Ts=(e,t)=>[...yt(t),...yt(e)];function kN(e,t){let r=0;const n=[...e];for(const a of t)n.splice(a-r,1),r++;return Ho(n).length?n:[]}var As=(e,t)=>Fe(t)?[]:kN(e,yt(t).sort((r,n)=>r-n)),Ds=(e,t,r)=>{[e[t],e[r]]=[e[r],e[t]]},Sd=(e,t,r)=>(e[t]=r,e);function hx(e){const t=Wo(),{control:r=t,name:n,keyName:a="id",shouldUnregister:s,rules:i}=e,[l,c]=N.useState(r._getFieldArray(n)),d=N.useRef(r._getFieldArray(n).map(Tr)),u=N.useRef(!1);r._names.array.add(n),N.useMemo(()=>i&&l.length>=0&&r.register(n,i),[r,n,l.length,i]),qo(()=>r._subjects.array.subscribe({next:({values:w,name:C})=>{if(C===n||!C){const S=ae(w,n);Array.isArray(S)&&(c(S),d.current=S.map(Tr))}}}).unsubscribe,[r,n]);const m=N.useCallback(w=>{u.current=!0,r._setFieldArray(n,w)},[r,n]),p=(w,C)=>{const S=yt(Me(w)),$=Ns(r._getFieldArray(n),S);r._names.focus=Cs(n,$.length-1,C),d.current=Ns(d.current,S.map(Tr)),m($),c($),r._setFieldArray(n,$,Ns,{argA:Ss(w)})},f=(w,C)=>{const S=yt(Me(w)),$=Ts(r._getFieldArray(n),S);r._names.focus=Cs(n,0,C),d.current=Ts(d.current,S.map(Tr)),m($),c($),r._setFieldArray(n,$,Ts,{argA:Ss(w)})},v=w=>{const C=As(r._getFieldArray(n),w);d.current=As(d.current,w),m(C),c(C),!Array.isArray(ae(r._fields,n))&&Oe(r._fields,n,void 0),r._setFieldArray(n,C,As,{argA:w})},h=(w,C,S)=>{const $=yt(Me(C)),k=$s(r._getFieldArray(n),w,$);r._names.focus=Cs(n,w,S),d.current=$s(d.current,w,$.map(Tr)),m(k),c(k),r._setFieldArray(n,k,$s,{argA:w,argB:Ss(C)})},x=(w,C)=>{const S=r._getFieldArray(n);Ds(S,w,C),Ds(d.current,w,C),m(S),c(S),r._setFieldArray(n,S,Ds,{argA:w,argB:C},!1)},b=(w,C)=>{const S=r._getFieldArray(n);Es(S,w,C),Es(d.current,w,C),m(S),c(S),r._setFieldArray(n,S,Es,{argA:w,argB:C},!1)},y=(w,C)=>{const S=Me(C),$=Sd(r._getFieldArray(n),w,S);d.current=[...$].map((k,E)=>!k||E===w?Tr():d.current[E]),m($),c([...$]),r._setFieldArray(n,$,Sd,{argA:w,argB:S},!0,!1)},j=w=>{const C=yt(Me(w));d.current=C.map(Tr),m([...C]),c([...C]),r._setFieldArray(n,[...C],S=>S,{},!0,!1)};return N.useEffect(()=>{if(r._state.action=!1,mi(n,r._names)&&r._subjects.state.next({...r._formState}),u.current&&(!vn(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!vn(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([n]).then(w=>{r._updateIsValidating([n]);const C=ae(w.errors,n),S=ae(r._formState.errors,n);(S?!C&&S.type||C&&(S.type!==C.type||S.message!==C.message):C&&C.type)&&(C?Oe(r._formState.errors,n,C):He(r._formState.errors,n),r._subjects.state.next({errors:r._formState.errors}))});else{const w=ae(r._fields,n);w&&w._f&&!(vn(r._options.reValidateMode).isOnSubmit&&vn(r._options.mode).isOnSubmit)&&pi(w,r._names.disabled,r._formValues,r._options.criteriaMode===Ft.all,r._options.shouldUseNativeValidation,!0).then(C=>!ct(C)&&r._subjects.state.next({errors:fx(r._formState.errors,C,n)}))}r._subjects.state.next({name:n,values:Me(r._formValues)}),r._names.focus&&kn(r._fields,(w,C)=>{if(r._names.focus&&C.startsWith(r._names.focus)&&w.focus)return w.focus(),1}),r._names.focus="",r._setValid(),u.current=!1},[l,n,r]),N.useEffect(()=>(!ae(r._formValues,n)&&r._setFieldArray(n),()=>{const w=(C,S)=>{const $=ae(r._fields,C);$&&$._f&&($._f.mount=S)};r._options.shouldUnregister||s?r.unregister(n):w(n,!1)}),[n,r,a,s]),{swap:N.useCallback(x,[m,n,r]),move:N.useCallback(b,[m,n,r]),prepend:N.useCallback(f,[m,n,r]),append:N.useCallback(p,[m,n,r]),remove:N.useCallback(v,[m,n,r]),insert:N.useCallback(h,[m,n,r]),update:N.useCallback(y,[m,n,r]),replace:N.useCallback(j,[m,n,r]),fields:N.useMemo(()=>l.map((w,C)=>({...w,[a]:d.current[C]||Tr()})),[l,a])}}function CN(e={}){const t=N.useRef(void 0),r=N.useRef(void 0),[n,a]=N.useState({isDirty:!1,isValidating:!1,isLoading:ht(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:ht(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!ht(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...l}=jN(e);t.current={...l,formState:n}}const s=t.current.control;return s._options=e,qo(()=>{const i=s._subscribe({formState:s._proxyFormState,callback:()=>a({...s._formState}),reRenderRoot:!0});return a(l=>({...l,isReady:!0})),s._formState.isReady=!0,i},[s]),N.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),N.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),N.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),N.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),N.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==n.isDirty&&s._subjects.state.next({isDirty:i})}},[s,n.isDirty]),N.useEffect(()=>{var i;e.values&&!Zt(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),!((i=s._options.resetOptions)===null||i===void 0)&&i.keepIsValid||s._setValid(),r.current=e.values,a(l=>({...l}))):s._resetDefaultValues()},[s,e.values]),N.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=N.useMemo(()=>sx(n,s),[s,n]),t.current}var NN=Object.defineProperty,SN=(e,t,r)=>t in e?NN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$d=(e,t,r)=>SN(e,typeof t!="symbol"?t+"":t,r);const fi=N.createContext({}),Ur=()=>N.useContext(fi),Ed=new Set(["__proto__","constructor","prototype"]),Aa=(e,t,r)=>{const n=t.split(".");let a=e;for(let i=0;i<n.length-1;i++){const l=n[i];if(Ed.has(l))return;(a[l]==null||typeof a[l]!="object")&&(a[l]={}),a=a[l]}const s=n[n.length-1];Ed.has(s)||(a[s]=r)},bn=async(e,t,r,n,a,s)=>{for(const i of e){const l=s[i.type];if(!l)continue;const c=await l(r,n,i,a);if(c)return i.message??c}},$N=(e,t={},r={})=>async n=>{var a,s,i,l,c;const d={},{errors:u}=yi(e,n,t);for(const p of u){const f=p.campo.replace(/\[(\d+)\]/g,".$1");Aa(d,f,{type:"custom",message:p.message})}const m=[...e.containers].sort((p,f)=>p.ordem-f.ordem);for(const p of m)if(!p.repeatable&&$e(p.condicional,n,t))for(const f of p.campos){if(f.tipo===D.HIDDEN||f.isDisabled||f.isReadOnly||!$e(f.condicional,n,t))continue;if(f.tipo===D.FIELD_ARRAY){const h=Array.isArray(n[f.nome])?n[f.nome]:[];for(let x=0;x<h.length;x++){const b=h[x];for(const y of f.subFields??[]){if(y.isDisabled||y.isReadOnly||!$e(y.condicional,b,t)||!((a=y.validate)!=null&&a.length)||d[`${f.nome}.${x}.${y.nome}`])continue;const j=await bn(y.validate,y.nome,b[y.nome],b,t,r);j&&Aa(d,`${f.nome}.${x}.${y.nome}`,{type:"custom",message:j})}}continue}if(f.tipo===D.SUB_FORM){const h=n[f.nome]??{};for(const x of((s=f.subSchema)==null?void 0:s.fields)??[]){if(x.isDisabled||x.isReadOnly||!((i=x.validate)!=null&&i.length)||d[`${f.nome}.${x.nome}`])continue;const b=await bn(x.validate,x.nome,h[x.nome],h,t,r);b&&Aa(d,`${f.nome}.${x.nome}`,{type:"custom",message:b})}continue}if(!((l=f.validate)!=null&&l.length)||d[f.nome])continue;const v=await bn(f.validate,f.nome,n[f.nome],n,t,r);v&&(d[f.nome]={type:"custom",message:v})}for(const p of m){if(!p.repeatable||!p.nome||!$e(p.condicional,n,t))continue;const f=Array.isArray(n[p.nome])?n[p.nome]:[];for(let v=0;v<f.length;v++){const h=f[v];for(const x of p.campos){if(x.tipo===D.HIDDEN||x.isDisabled||x.isReadOnly||!$e(x.condicional,h,t)||!((c=x.validate)!=null&&c.length)||d[`${p.nome}.${v}.${x.nome}`])continue;const b=await bn(x.validate,x.nome,h[x.nome],h,t,r);b&&Aa(d,`${p.nome}.${v}.${x.nome}`,{type:"custom",message:b})}}}return Object.keys(d).length>0?{values:{},errors:d}:{values:n,errors:{}}},EN=(e,t={},r={})=>async n=>{var a,s;const i={},l=[...e.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l)if(!(c.condicional&&!$e(c.condicional,n,t))){if(c.repeatable&&c.nome){const d=Array.isArray(n[c.nome])?n[c.nome]:[];for(let u=0;u<d.length;u++){const m=d[u];for(const p of[...c.campos].sort((f,v)=>f.ordem-v.ordem)){if(!((a=p.warn)!=null&&a.length)||!$e(p.condicional,m,t))continue;const f=await bn(p.warn,p.nome,m[p.nome],m,t,r);f&&(i[`${c.nome}.${u}.${p.nome}`]=f)}}continue}for(const d of[...c.campos].sort((u,m)=>u.ordem-m.ordem)){if(!((s=d.warn)!=null&&s.length)||!$e(d.condicional,n,t))continue;const u=await bn(d.warn,d.nome,n[d.nome],n,t,r);u&&(i[d.nome]=u)}}return i},TN=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,wt=(e,t)=>e?e.replace(TN,(r,n)=>t[`evento.${n}`]??t[n]??r):e??"",AN=(e,t)=>({...e,label:wt(e.label,t)}),DN=(e,t)=>{var r;return{...e,label:wt(e.label,t),placeholder:wt(e.placeholder,t),hint:wt(e.hint,t),defaultValue:typeof e.defaultValue=="string"?wt(e.defaultValue,t):e.defaultValue,opcoes:(r=e.opcoes)==null?void 0:r.map(n=>AN(n,t))}},Al=(e,t)=>({...e,titulo:wt(e.titulo,t),descricao:wt(e.descricao,t),campos:e.campos.map(r=>DN(r,t))}),RN=(e,t)=>({...e,titulo:wt(e.titulo,t),descricao:wt(e.descricao,t),containers:e.containers.map(r=>Al(r,t))}),xx=()=>{const e=ra(),t=e.layout.containerStyle,r=e.layout.roundness??"rounded-xl",n=K("overflow-hidden",r,t==="card"?"border":"",t==="bordered"?"border":"",t==="glassmorphism"?"backdrop-blur-sm":""),a=t==="glassmorphism"?{background:"var(--t-surface)",borderColor:"var(--t-border)",borderWidth:"1px",borderStyle:"solid"}:{},s=K("border-b px-6 py-4",t==="flat"?"border-transparent":"");return{wrapperClass:n,wrapperStyle:a,headerClass:s,headerStyle:t==="glassmorphism"?{borderColor:"var(--t-border)"}:{},tmpl:e}},Lt=({name:e,control:t,placeholder:r,type:n="text",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),d=!!c.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...l,value:l.value??"",type:n,placeholder:r,disabled:a,readOnly:s,className:K(d&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Dl=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsx(io,{...i,value:i.value??"",placeholder:r,disabled:n,readOnly:a,rows:3,className:K(l.error&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Rl=({name:e,control:t,placeholder:r,options:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(Vt,{value:l.value??"",onValueChange:d=>!s&&l.onChange(d),disabled:a||s,children:[o.jsx(Dt,{className:K(c.error&&"border-destructive focus:ring-destructive"),onBlur:l.onBlur,children:o.jsx(Bt,{placeholder:r??"Selecione..."})}),o.jsx(Rt,{children:n.map(d=>o.jsx(Xe,{value:d.valor,disabled:d.disabled,children:d.label},d.valor))})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Pl=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(rt,{name:i.name,checked:!!i.value,onCheckedChange:c=>!a&&i.onChange(!!c),onBlur:i.onBlur,disabled:n}),r&&o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},gx=({name:e,control:t,options:r,disabled:n})=>{var a;const{field:s,fieldState:i}=Be({name:e,control:t}),l=Array.isArray(s.value)?s.value:[],c=d=>{const u=l.includes(d)?l.filter(m=>m!==d):[...l,d];s.onChange(u)};return o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex flex-col gap-2",onBlur:s.onBlur,children:r.map(d=>o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(rt,{checked:l.includes(d.valor),onCheckedChange:()=>c(d.valor),disabled:n||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},vx=({name:e,control:t,options:r,visualStyle:n="default",disabled:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),c=n==="card";return o.jsxs("div",{className:"space-y-1",onBlur:i.onBlur,children:[o.jsx(Ri,{value:i.value??"",onValueChange:i.onChange,className:K(c?"grid grid-cols-2 gap-2 sm:grid-cols-3":"flex flex-col gap-2"),children:r.map(d=>o.jsxs("label",{className:K("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",(a||d.disabled)&&"cursor-not-allowed opacity-50"),"data-selected":i.value===d.valor?"true":void 0,children:[o.jsx(Pi,{value:d.valor,disabled:a||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},bx=e=>{const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`},PN=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),bx(t)},_N=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),bx(t)},ea=({name:e,control:t,isDatetime:r,disabled:n,readOnly:a,validacao:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),d=r?"datetime-local":"date",u=f=>r?f+"T00:00":f,m=(s==null?void 0:s.minAge)!=null?u(PN(s.minAge)):(s==null?void 0:s.maxDate)!=null?u(s.maxDate):void 0,p=(s==null?void 0:s.maxAge)!=null?u(_N(s.maxAge)):(s==null?void 0:s.minDate)!=null?u(s.minDate):void 0;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value??"",onChange:l.onChange,onBlur:l.onBlur,type:d,min:p,max:m,disabled:n,readOnly:a,className:K(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})};function IN(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const yx={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};for(const[e,t]of Object.entries(yx));let Td;function ON(){if(!(typeof globalThis.TextDecoder>"u"))return Td??(Td=new globalThis.TextDecoder("utf-8"))}const Dn=32*1024,Gt=65533;function FN(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{const r=ON();return r?r.decode(e):LN(e)}case"utf-16le":return MN(e);case"us-ascii":case"ascii":return VN(e);case"latin1":case"iso-8859-1":return BN(e);case"windows-1252":return UN(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function _l(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function Qe(e,t,r){t.push(r),t.length>=Dn&&_l(e,t)}function zN(e,t,r){if(r<=65535){Qe(e,t,r);return}r-=65536,Qe(e,t,55296+(r>>10)),Qe(e,t,56320+(r&1023))}function LN(e){const t=[],r=[];let n=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(n=3);n<e.length;){const a=e[n];if(a<=127){Qe(t,r,a),n++;continue}if(a<194||a>244){Qe(t,r,Gt),n++;continue}if(a<=223){if(n+1>=e.length){Qe(t,r,Gt),n++;continue}const d=e[n+1];if((d&192)!==128){Qe(t,r,Gt),n++;continue}const u=(a&31)<<6|d&63;Qe(t,r,u),n+=2;continue}if(a<=239){if(n+2>=e.length){Qe(t,r,Gt),n++;continue}const d=e[n+1],u=e[n+2];if(!((d&192)===128&&(u&192)===128&&!(a===224&&d<160)&&!(a===237&&d>=160))){Qe(t,r,Gt),n++;continue}const m=(a&15)<<12|(d&63)<<6|u&63;Qe(t,r,m),n+=3;continue}if(n+3>=e.length){Qe(t,r,Gt),n++;continue}const s=e[n+1],i=e[n+2],l=e[n+3];if(!((s&192)===128&&(i&192)===128&&(l&192)===128&&!(a===240&&s<144)&&!(a===244&&s>143))){Qe(t,r,Gt),n++;continue}const c=(a&7)<<18|(s&63)<<12|(i&63)<<6|l&63;zN(t,r,c),n+=4}return _l(t,r),t.join("")}function MN(e){const t=[],r=[],n=e.length;let a=0;for(;a+1<n;){const s=e[a]|e[a+1]<<8;if(a+=2,s>=55296&&s<=56319){if(a+1<n){const i=e[a]|e[a+1]<<8;i>=56320&&i<=57343?(Qe(t,r,s),Qe(t,r,i),a+=2):Qe(t,r,Gt)}else Qe(t,r,Gt);continue}if(s>=56320&&s<=57343){Qe(t,r,Gt);continue}Qe(t,r,s)}return a<n&&Qe(t,r,Gt),_l(t,r),t.join("")}function VN(e){const t=[];for(let r=0;r<e.length;r+=Dn){const n=Math.min(e.length,r+Dn),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s]&127;t.push(String.fromCharCode.apply(null,a))}return t.join("")}function BN(e){const t=[];for(let r=0;r<e.length;r+=Dn){const n=Math.min(e.length,r+Dn),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s];t.push(String.fromCharCode.apply(null,a))}return t.join("")}function UN(e){const t=[];let r="";for(let n=0;n<e.length;n++){const a=e[n],s=a>=128&&a<=159?yx[a]:void 0;r+=s??String.fromCharCode(a),r.length>=Dn&&(t.push(r),r="")}return r&&t.push(r),t.join("")}function Ct(e){return new DataView(e.buffer,e.byteOffset)}const HN={len:1,get(e,t){return Ct(e).getUint8(t)},put(e,t,r){return Ct(e).setUint8(t,r),t+1}},Ge={len:2,get(e,t){return Ct(e).getUint16(t,!0)},put(e,t,r){return Ct(e).setUint16(t,r,!0),t+2}},fn={len:2,get(e,t){return Ct(e).getUint16(t)},put(e,t,r){return Ct(e).setUint16(t,r),t+2}},Ke={len:4,get(e,t){return Ct(e).getUint32(t,!0)},put(e,t,r){return Ct(e).setUint32(t,r,!0),t+4}},Ad={len:4,get(e,t){return Ct(e).getUint32(t)},put(e,t,r){return Ct(e).setUint32(t,r),t+4}},WN={len:4,get(e,t){return Ct(e).getInt32(t)},put(e,t,r){return Ct(e).setInt32(t,r),t+4}},qN={len:8,get(e,t){return Ct(e).getBigUint64(t,!0)},put(e,t,r){return Ct(e).setBigUint64(t,r,!0),t+8}};class vr{constructor(t,r){this.len=t,this.encoding=r}get(t,r=0){const n=t.subarray(r,r+this.len);return FN(n,this.encoding)}}const GN="End-Of-Stream";class tt extends Error{constructor(){super(GN),this.name="EndOfStreamError"}}class XN extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}class wx{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,r=!1){const n=await this.read(t,r);return this.peekQueue.push(t.subarray(0,n)),n}async read(t,r=!1){if(t.length===0)return 0;let n=this.readFromPeekBuffer(t);if(this.endOfStream||(n+=await this.readRemainderFromStream(t.subarray(n),r)),n===0&&!r)throw new tt;return n}readFromPeekBuffer(t){let r=t.length,n=0;for(;this.peekQueue.length>0&&r>0;){const a=this.peekQueue.pop();if(!a)throw new Error("peekData should be defined");const s=Math.min(a.length,r);t.set(a.subarray(0,s),n),n+=s,r-=s,s<a.length&&this.peekQueue.push(a.subarray(s))}return n}async readRemainderFromStream(t,r){let n=0;for(;n<t.length&&!this.endOfStream;){if(this.interrupted)throw new XN;const a=await this.readFromStream(t.subarray(n),r);if(a===0)break;n+=a}if(!r&&n<t.length)throw new tt;return n}}class ZN extends wx{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}class KN extends ZN{async readFromStream(t,r){if(t.length===0)return 0;const n=await this.reader.read(new Uint8Array(t.length),{min:r?void 0:t.length});return n.done&&(this.endOfStream=n.done),n.value?(t.set(n.value),n.value.length):0}}class Dd extends wx{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,r){const n=Math.min(r.length,t.length);return t.set(r.subarray(0,n)),n<r.length?this.buffer=r.subarray(n):this.buffer=null,n}async readFromStream(t,r){if(t.length===0)return 0;let n=0;for(this.buffer&&(n+=this.writeChunk(t,this.buffer));n<t.length&&!this.endOfStream;){const a=await this.reader.read();if(a.done){this.endOfStream=!0;break}a.value&&(n+=this.writeChunk(t.subarray(n),a.value))}if(!r&&n===0&&this.endOfStream)throw new tt;return n}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}function YN(e){try{const t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new Dd(t):new KN(t)}catch(t){if(t instanceof TypeError)return new Dd(e.getReader());throw t}}class Il{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t==null?void 0:t.onClose,t!=null&&t.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.readBuffer(n,{position:r})<t.len)throw new tt;return t.get(n,0)}async peekToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.peekBuffer(n,{position:r})<t.len)throw new tt;return t.get(n,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new tt;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new tt;return t.get(this.numBuffer,0)}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");if(this.fileInfo.size!==void 0){const r=this.fileInfo.size-this.position;if(t>r)return this.position+=r,r}return this.position+=t,t}async close(){var t;await this.abort(),await((t=this.onClose)==null?void 0:t.call(this))}normalizeOptions(t,r){if(!this.supportsRandomAccess()&&r&&r.position!==void 0&&r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:t.length,position:this.position,...r}}abort(){return Promise.resolve()}}const JN=256e3;class QN extends Il{constructor(t,r){super(r),this.streamReader=t,this.fileInfo=(r==null?void 0:r.fileInfo)??{}}async readBuffer(t,r){const n=this.normalizeOptions(t,r),a=n.position-this.position;if(a>0)return await this.ignore(a),this.readBuffer(t,r);if(a<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;const s=await this.streamReader.read(t.subarray(0,n.length),n.mayBeLess);if(this.position+=s,(!r||!r.mayBeLess)&&s<n.length)throw new tt;return s}async peekBuffer(t,r){const n=this.normalizeOptions(t,r);let a=0;if(n.position){const s=n.position-this.position;if(s>0){const i=new Uint8Array(n.length+s);return a=await this.peekBuffer(i,{mayBeLess:n.mayBeLess}),t.set(i.subarray(s)),a-s}if(s<0)throw new Error("Cannot peek from a negative offset in a stream")}if(n.length>0){try{a=await this.streamReader.peek(t.subarray(0,n.length),n.mayBeLess)}catch(s){if(r!=null&&r.mayBeLess&&s instanceof tt)return 0;throw s}if(!n.mayBeLess&&a<n.length)throw new tt}return a}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");const r=Math.min(JN,t),n=new Uint8Array(r);let a=0;for(;a<t;){const s=t-a,i=await this.readBuffer(n,{length:Math.min(r,s)});if(i<0)return i;a+=i}return a}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}class e2 extends Il{constructor(t,r){super(r),this.uint8Array=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.length}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new tt;return t.set(this.uint8Array.subarray(n.position,n.position+a)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}class t2 extends Il{constructor(t,r){super(r),this.blob=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.size,mimeType:t.type}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.blob.size-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new tt;const s=await this.blob.slice(n.position,n.position+a).arrayBuffer();return t.set(new Uint8Array(s)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}function r2(e,t){const r=YN(e),n=t??{},a=n.onClose;return n.onClose=async()=>{if(await r.close(),a)return a()},new QN(r,n)}function n2(e,t){return new e2(e,t)}function a2(e,t){return new t2(e,t)}var hi={exports:{}},Rs,Rd;function o2(){if(Rd)return Rs;Rd=1;var e=1e3,t=e*60,r=t*60,n=r*24,a=n*7,s=n*365.25;Rs=function(u,m){m=m||{};var p=typeof u;if(p==="string"&&u.length>0)return i(u);if(p==="number"&&isFinite(u))return m.long?c(u):l(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function i(u){if(u=String(u),!(u.length>100)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(m){var p=parseFloat(m[1]),f=(m[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return p*s;case"weeks":case"week":case"w":return p*a;case"days":case"day":case"d":return p*n;case"hours":case"hour":case"hrs":case"hr":case"h":return p*r;case"minutes":case"minute":case"mins":case"min":case"m":return p*t;case"seconds":case"second":case"secs":case"sec":case"s":return p*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}}}function l(u){var m=Math.abs(u);return m>=n?Math.round(u/n)+"d":m>=r?Math.round(u/r)+"h":m>=t?Math.round(u/t)+"m":m>=e?Math.round(u/e)+"s":u+"ms"}function c(u){var m=Math.abs(u);return m>=n?d(u,m,n,"day"):m>=r?d(u,m,r,"hour"):m>=t?d(u,m,t,"minute"):m>=e?d(u,m,e,"second"):u+" ms"}function d(u,m,p,f){var v=m>=p*1.5;return Math.round(u/p)+" "+f+(v?"s":"")}return Rs}function s2(e){r.debug=r,r.default=r,r.coerce=c,r.disable=i,r.enable=a,r.enabled=l,r.humanize=o2(),r.destroy=d,Object.keys(e).forEach(u=>{r[u]=e[u]}),r.names=[],r.skips=[],r.formatters={};function t(u){let m=0;for(let p=0;p<u.length;p++)m=(m<<5)-m+u.charCodeAt(p),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=t;function r(u){let m,p=null,f,v;function h(...x){if(!h.enabled)return;const b=h,y=Number(new Date),j=y-(m||y);b.diff=j,b.prev=m,b.curr=y,m=y,x[0]=r.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let w=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(C,S)=>{if(C==="%%")return"%";w++;const $=r.formatters[S];if(typeof $=="function"){const k=x[w];C=$.call(b,k),x.splice(w,1),w--}return C}),r.formatArgs.call(b,x),(b.log||r.log).apply(b,x)}return h.namespace=u,h.useColors=r.useColors(),h.color=r.selectColor(u),h.extend=n,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(f!==r.namespaces&&(f=r.namespaces,v=r.enabled(u)),v),set:x=>{p=x}}),typeof r.init=="function"&&r.init(h),h}function n(u,m){const p=r(this.namespace+(typeof m>"u"?":":m)+u);return p.log=this.log,p}function a(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];const m=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const p of m)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function s(u,m){let p=0,f=0,v=-1,h=0;for(;p<u.length;)if(f<m.length&&(m[f]===u[p]||m[f]==="*"))m[f]==="*"?(v=f,h=p,f++):(p++,f++);else if(v!==-1)f=v+1,h++,p=h;else return!1;for(;f<m.length&&m[f]==="*";)f++;return f===m.length}function i(){const u=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),u}function l(u){for(const m of r.skips)if(s(u,m))return!1;for(const m of r.names)if(s(u,m))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}var i2=s2;(function(e,t){t.formatArgs=n,t.save=a,t.load=s,t.useColors=r,t.storage=i(),t.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const d="color: "+this.color;c.splice(1,0,d,"color: inherit");let u=0,m=0;c[0].replace(/%[a-zA-Z%]/g,p=>{p!=="%%"&&(u++,p==="%c"&&(m=u))}),c.splice(m,0,d)}t.log=console.debug||console.log||(()=>{});function a(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function s(){let c;try{c=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function i(){try{return localStorage}catch{}}e.exports=i2(t);const{formatters:l}=e.exports;l.j=function(c){try{return JSON.stringify(c)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}})(hi,hi.exports);var l2=hi.exports;const c2=IN(l2),yn={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Pd={get(e){return{signature:Ke.get(e,0),compressedSize:Ke.get(e,8),uncompressedSize:Ke.get(e,12)}},len:16},d2={get(e){const t=Ge.get(e,6);return{signature:Ke.get(e,0),minVersion:Ge.get(e,4),dataDescriptor:!!(t&8),compressedMethod:Ge.get(e,8),compressedSize:Ke.get(e,18),uncompressedSize:Ke.get(e,22),filenameLength:Ge.get(e,26),extraFieldLength:Ge.get(e,28),filename:null}},len:30},u2={get(e){return{signature:Ke.get(e,0),nrOfThisDisk:Ge.get(e,4),nrOfThisDiskWithTheStart:Ge.get(e,6),nrOfEntriesOnThisDisk:Ge.get(e,8),nrOfEntriesOfSize:Ge.get(e,10),sizeOfCd:Ke.get(e,12),offsetOfStartOfCd:Ke.get(e,16),zipFileCommentLength:Ge.get(e,20)}},len:22},m2={get(e){const t=Ge.get(e,8);return{signature:Ke.get(e,0),minVersion:Ge.get(e,6),dataDescriptor:!!(t&8),compressedMethod:Ge.get(e,10),compressedSize:Ke.get(e,20),uncompressedSize:Ke.get(e,24),filenameLength:Ge.get(e,28),extraFieldLength:Ge.get(e,30),fileCommentLength:Ge.get(e,32),relativeOffsetOfLocalHeader:Ke.get(e,42),filename:null}},len:46};function jx(e){const t=new Uint8Array(Ke.len);return Ke.put(t,0,e),t}const ar=c2("tokenizer:inflate"),Ps=256*1024,p2=jx(yn.DataDescriptor),Da=jx(yn.EndOfCentralDirectory);class pa{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Ps)}async isZip(){return await this.peekSignature()===yn.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Ke)}async findEndOfCentralDirectoryLocator(){const t=this.tokenizer,r=Math.min(16*1024,t.fileInfo.size),n=this.syncBuffer.subarray(0,r);await this.tokenizer.readBuffer(n,{position:t.fileInfo.size-r});for(let a=n.length-4;a>=0;a--)if(n[a]===Da[0]&&n[a+1]===Da[1]&&n[a+2]===Da[2]&&n[a+3]===Da[3])return t.fileInfo.size-r+a;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){ar("Cannot reading central-directory without random-read support");return}ar("Reading central-directory...");const t=this.tokenizer.position,r=await this.findEndOfCentralDirectoryLocator();if(r>0){ar("Central-directory 32-bit signature found");const n=await this.tokenizer.readToken(u2,r),a=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let s=0;s<n.nrOfEntriesOfSize;++s){const i=await this.tokenizer.readToken(m2);if(i.signature!==yn.CentralFileHeader)throw new Error("Expected Central-File-Header signature");i.filename=await this.tokenizer.readToken(new vr(i.filenameLength,"utf-8")),await this.tokenizer.ignore(i.extraFieldLength),await this.tokenizer.ignore(i.fileCommentLength),a.push(i),ar(`Add central-directory file-entry: n=${s+1}/${a.length}: filename=${a[s].filename}`)}return this.tokenizer.setPosition(t),a}this.tokenizer.setPosition(t)}async unzip(t){const r=await this.readCentralDirectory();if(r)return this.iterateOverCentralDirectory(r,t);let n=!1;do{const a=await this.readLocalFileHeader();if(!a)break;const s=t(a);n=!!s.stop;let i;if(await this.tokenizer.ignore(a.extraFieldLength),a.dataDescriptor&&a.compressedSize===0){const l=[];let c=Ps;ar("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let d=-1;for(;d<0&&c===Ps;){c=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),d=f2(this.syncBuffer.subarray(0,c),p2);const u=d>=0?d:c;if(s.handler){const m=new Uint8Array(u);await this.tokenizer.readBuffer(m),l.push(m)}else await this.tokenizer.ignore(u)}ar(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(a,h2(l),s.handler)}else s.handler?(ar(`Reading compressed-file-data: ${a.compressedSize} bytes`),i=new Uint8Array(a.compressedSize),await this.tokenizer.readBuffer(i),await this.inflate(a,i,s.handler)):(ar(`Ignoring compressed-file-data: ${a.compressedSize} bytes`),await this.tokenizer.ignore(a.compressedSize));if(ar(`Reading data-descriptor at pos=${this.tokenizer.position}`),a.dataDescriptor&&(await this.tokenizer.readToken(Pd)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Pd.len}`)}while(!n)}async iterateOverCentralDirectory(t,r){for(const n of t){const a=r(n);if(a.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);const s=await this.readLocalFileHeader();if(s){await this.tokenizer.ignore(s.extraFieldLength);const i=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(i),await this.inflate(s,i,a.handler)}}if(a.stop)break}}async inflate(t,r,n){if(t.compressedMethod===0)return n(r);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);ar(`Decompress filename=${t.filename}, compressed-size=${r.length}`);const a=await pa.decompressDeflateRaw(r);return n(a)}static async decompressDeflateRaw(t){const r=new ReadableStream({start(s){s.enqueue(t),s.close()}}),n=new DecompressionStream("deflate-raw"),a=r.pipeThrough(n);try{const s=await new Response(a).arrayBuffer();return new Uint8Array(s)}catch(s){const i=s instanceof Error?`Failed to deflate ZIP entry: ${s.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(i)}}async readLocalFileHeader(){const t=await this.tokenizer.peekToken(Ke);if(t===yn.LocalFileHeader){const r=await this.tokenizer.readToken(d2);return r.filename=await this.tokenizer.readToken(new vr(r.filenameLength,"utf-8")),r}if(t===yn.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}function f2(e,t){const r=e.length,n=t.length;if(n>r)return-1;for(let a=0;a<=r-n;a++){let s=!0;for(let i=0;i<n;i++)if(e[a+i]!==t[i]){s=!1;break}if(s)return a}return-1}function h2(e){const t=e.reduce((a,s)=>a+s.length,0),r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}class x2{constructor(t){this.tokenizer=t}inflate(){const t=this.tokenizer;return new ReadableStream({async pull(r){const n=new Uint8Array(1024),a=await t.readBuffer(n,{mayBeLess:!0});if(a===0){r.close();return}r.enqueue(n.subarray(0,a))}}).pipeThrough(new DecompressionStream("gzip"))}}new globalThis.TextDecoder("utf8");new globalThis.TextEncoder;Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function _d(e){const{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}function g2(e,t){if(t==="utf-16le"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a&255,a>>8&255)}return r}if(t==="utf-16be"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a>>8&255,a&255)}return r}return[...e].map(r=>r.charCodeAt(0))}function v2(e,t=0){const r=Number.parseInt(new vr(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let n=256;for(let a=t;a<t+148;a++)n+=e[a];for(let a=t+156;a<t+512;a++)n+=e[a];return r===n}const b2={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},y2=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],w2=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"],Xn=4100,j2=Xn-2,ur=1024*1024,Id=1024,k2=2**31-1,Mt=16*1024*1024,Go=ur,Od=ur,C2=Mt,N2=1,Fd=100,_s=Mt,zd=64,Ld=Go,S2=256,$2=512,E2=Mt,T2=512,A2=512,Md=256,Vd=Go,Bd=Go,D2=Go,Ud=Mt,R2=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),P2=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],_2=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);class Yr extends Error{}function I2(e){var t;const r=e==null?void 0:e.streamReader;if(((t=r==null?void 0:r.constructor)==null?void 0:t.name)!=="WebStreamByobReader")return e;const{reader:n}=r,a=async()=>{await n.cancel(),n.releaseLock()};return r.close=a,r.abort=async()=>{r.interrupted=!0,await a()},e}function Ol(e,t,r){if(!Number.isFinite(e)||e<0||e>t)throw new Yr(`${r} has invalid size ${e} (maximum ${t} bytes)`);return e}async function Rr(e,t,{maximumLength:r=Mt,reason:n="skip"}={}){const a=Ol(t,r,n);await e.ignore(a)}async function Is(e,t,r,{maximumLength:n=t.length,reason:a="read"}={}){const s=t.length,i=Ol(s,n,a);return e.readBuffer(t,{...r,length:i})}async function O2(e,{maximumLength:t=ur}={}){const r=new ReadableStream({start(l){l.enqueue(e),l.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),n=[];let a=0;try{for(;;){const{done:l,value:c}=await r.read();if(l)break;if(a+=c.length,a>t)throw await r.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);n.push(c)}}finally{r.releaseLock()}const s=new Uint8Array(a);let i=0;for(const l of n)s.set(l,i),i+=l.length;return s}const kx=134695760,ro=16,F2=ro-1;function z2(e,t){if(e.length<ro)return-1;const r=e.length-ro;for(let n=0;n<=r;n++)if(Ke.get(e,n)===kx&&Ke.get(e,n+8)===t+n)return n;return-1}function L2(e){return(e.codePointAt(0)&32)!==0}function M2(e,t){const r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}async function V2(e,{shouldBuffer:t,maximumLength:r=ur}={}){const{syncBuffer:n}=e,{length:a}=n,s=[];let i=0;for(;;){const l=await e.tokenizer.peekBuffer(n,{mayBeLess:!0}),c=z2(n.subarray(0,l),i),d=c>=0?0:l===a?Math.min(F2,l-1):0,u=c>=0?c:l-d;if(u===0)break;if(i+=u,i>r)throw new Error(`ZIP entry compressed data exceeds ${r} bytes`);if(t){const m=new Uint8Array(u);await e.tokenizer.readBuffer(m),s.push(m)}else await e.tokenizer.ignore(u);if(c>=0)break}if(pt(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=i),!!t)return M2(s,i)}function B2(e,t){return pt(e.tokenizer)?Math.max(0,Mt-(e.tokenizer.position-t)):Math.max(0,ur-e.knownSizeDescriptorScannedBytes)}async function U2(e,t,{shouldBuffer:r,maximumDescriptorLength:n=ur}={}){if(t.dataDescriptor&&t.compressedSize===0)return V2(e,{shouldBuffer:r,maximumLength:n});if(!r){await Rr(e.tokenizer,t.compressedSize,{maximumLength:pt(e.tokenizer)?ur:e.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}const a=K2(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>a)throw new Error(`ZIP entry compressed data exceeds ${a} bytes`);const s=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(s),s}pa.prototype.inflate=async function(e,t,r){if(e.compressedMethod===0)return r(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);const n=await O2(t,{maximumLength:ur});return r(n)};pa.prototype.unzip=async function(e){let t=!1,r=0;const n=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Zn(this.tokenizer,n,Mt))throw new Yr(`ZIP stream probing exceeds ${Mt} bytes`);const a=await this.readLocalFileHeader();if(!a)break;if(r++,r>Id)throw new Error(`ZIP entry count exceeds ${Id}`);const s=e(a);t=!!s.stop,await this.tokenizer.ignore(a.extraFieldLength);const i=await U2(this,a,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(ur,B2(this,n))});if(s.handler&&await this.inflate(a,i,s.handler),a.dataDescriptor){const l=new Uint8Array(ro);if(await this.tokenizer.readBuffer(l),Ke.get(l,0)!==kx)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(Zn(this.tokenizer,n,Mt))throw new Yr(`ZIP stream probing exceeds ${Mt} bytes`)}while(!t)};function H2(e,t){const r=e.getReader();let n=0,a=!1,s=!1;const i=async l=>{a||s||(s=!0,await r.cancel(l))};return new ReadableStream({async pull(l){if(n>=t){l.close(),await i();return}const{done:c,value:d}=await r.read();if(c||!d){a=!0,l.close();return}const u=t-n;if(d.length>u){l.enqueue(d.subarray(0,u)),n+=u,l.close(),await i();return}l.enqueue(d),n+=d.length},async cancel(l){await i(l)}})}async function W2(e,t){return new Fl(t).fromBlob(e)}function Hd(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:e};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:e};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:e};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:e};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:e};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"}}}function or(e,t,r){r={offset:0,...r};for(const[n,a]of t.entries())if(r.mask){if(a!==(r.mask[n]&e[n+r.offset]))return!1}else if(a!==e[n+r.offset])return!1;return!0}function q2(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):Xn}function G2(e,t,r){return r===void 0?e.read(t):(r.throwIfAborted(),new Promise((n,a)=>{const s=()=>{r.removeEventListener("abort",i)},i=()=>{const l=r.reason;s(),(async()=>{try{await e.cancel(l)}catch{}})(),a(l)};r.addEventListener("abort",i,{once:!0}),(async()=>{try{const l=await e.read(t);s(),n(l)}catch(l){s(),a(l)}})()}))}function X2(e){return Number.isFinite(e)?Math.max(0,Math.min(j2,Math.trunc(e))):0}function Z2(e){return Number.isFinite(e)?Math.max(0,e):Number.MAX_SAFE_INTEGER}function pt(e){const t=e.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Zn(e,t,r){return pt(e)&&e.position-t>r}function K2(e){const t=e.fileInfo.size,r=Number.isFinite(t)?Math.max(0,t-e.position):Number.MAX_SAFE_INTEGER;return Math.min(r,k2)}function Y2(e){if(e instanceof tt||e instanceof Yr)return!0;if(!(e instanceof Error))return!1;if(R2.has(e.message)||_2.has(e.code))return!0;for(const t of P2)if(e.message.startsWith(t))return!0;return!1}function Wd(e,t=ur){const r=[e.compressedSize,e.uncompressedSize];for(const n of r)if(!Number.isFinite(n)||n<0||n>t)return!1;return!0}function J2(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function Q2(e,t){t.startsWith("word/")&&(e.hasWordDirectory=!0),t.startsWith("ppt/")&&(e.hasPresentationDirectory=!0),t.startsWith("xl/")&&(e.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(e.hasThreeDimensionalModelEntry=!0)}function qd(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(e.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(e.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(e.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function eS(e){const t=e.indexOf('.main+xml"');if(t===-1){const a="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return e.includes(`ContentType="${a}"`)?a:void 0}const r=e.slice(0,t),n=r.lastIndexOf('"');return r.slice(n+1)}class Fl{constructor(t){$d(this,"detectConfident",async n=>{if(this.buffer=new Uint8Array(Xn),n.fileInfo.size===void 0&&(n.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=n,pt(n)&&(await n.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(n);if(await n.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await n.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=Md?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(n));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(n);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await Rr(n,6,{maximumLength:6,reason:"ID3 header prefix"});const a=await n.readToken(b2),s=pt(n);if(!Number.isFinite(a)||a<0||s&&(a>_s||n.position+a>_s))return;if(n.position+a>n.fileInfo.size)return s?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await Rr(n,a,{maximumLength:s?_s:n.fileInfo.size,reason:"ID3 payload"})}catch(i){if(i instanceof tt)return;throw i}return this.detectionReentryCount>=Md?void 0:(this.detectionReentryCount++,this.parseTokenizer(n,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let a;const s=J2();try{await new pa(n).unzip(i=>{Q2(s,i.filename);const l=i.filename==="[Content_Types].xml",c=qd(s);if(!l&&c)return a=c,{stop:!0};switch(i.filename){case"META-INF/mozilla.rsa":return a={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return a={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return Wd(i,Od)?{async handler(d){const u=new TextDecoder("utf-8").decode(d).trim();a=Hd(u)},stop:!0}:{};case"[Content_Types].xml":return s.hasContentTypesEntry=!0,Wd(i,Od)?(s.isParsingContentTypes=!0,{async handler(d){const u=new TextDecoder("utf-8").decode(d),m=eS(u);m&&(a=Hd(m)),s.hasParsedContentTypesEntry=!0,s.isParsingContentTypes=!1},stop:!0}):(s.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(i.filename)?(a={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(i){if(!Y2(i))throw i;s.isParsingContentTypes&&(s.isParsingContentTypes=!1,s.hasUnparseableContentTypes=!0)}return a??qd(s)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await n.ignore(28);const a=new Uint8Array(8);return await n.readBuffer(a),or(a,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:or(a,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:or(a,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:or(a,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:or(a,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:or(a,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const a=await this.readTiffHeader(!1);if(a)return a}if(this.check([77,77])){const a=await this.readTiffHeader(!0);if(a)return a}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function a(){const d=await n.peekNumber(HN);let u=128,m=0;for(;!(d&u)&&u!==0;)++m,u>>=1;const p=new Uint8Array(m+1);return await Is(n,p,void 0,{maximumLength:p.length,reason:"EBML field"}),p}async function s(){const d=await a(),u=await a();u[0]^=128>>u.length-1;const m=Math.min(6,u.length),p=new DataView(d.buffer),f=new DataView(u.buffer,u.length-m,m);return{id:_d(p),len:_d(f)}}async function i(d){let u=0;for(;d>0;){if(u++,u>S2||Zn(n,c,Mt))return;const m=n.position,p=await s();if(p.id===17026){if(p.len>zd)return;const f=Ol(p.len,zd,"EBML DocType");return(await n.readToken(new vr(f))).replaceAll(/\00.*$/g,"")}if(pt(n)&&(!Number.isFinite(p.len)||p.len<0||p.len>Ld)||(await Rr(n,p.len,{maximumLength:pt(n)?Ld:n.fileInfo.size,reason:"EBML payload"}),--d,n.position<=m))return}}const l=await s(),c=n.position;switch(await i(l.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){const a=Ad.get(this.buffer,4),s=fn.get(this.buffer,6);if(a>0&&a<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(s>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const a=new vr(4,"latin1").get(this.buffer,2);if(a.match("^d*")&&a>=1e3&&a<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await n.ignore(8),await n.readToken(new vr(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
83
- `,"\r"," "," ","\0"].some(a=>this.checkString(a,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){const a={ext:"png",mime:"image/png"},s={ext:"apng",mime:"image/apng"};await n.ignore(8);async function i(){return{length:await n.readToken(WN),type:await n.readToken(new vr(4,"latin1"))}}const l=pt(n),c=n.position;let d=0,u=!1;do{if(d++,d>$2||Zn(n,c,E2))break;const m=n.position,p=await i();if(p.length<0)return;if(p.type==="IHDR"){if(p.length!==13)return;u=!0}switch(p.type){case"IDAT":return a;case"acTL":return s;default:if(!u&&p.type!=="CgBI")return;if(l&&p.length>Vd)return u&&L2(p.type)?a:void 0;try{await Rr(n,p.length+4,{maximumLength:l?Vd+4:n.fileInfo.size,reason:"PNG chunk payload"})}catch(f){if(!l&&(f instanceof Yr||f instanceof tt))return a;throw f}}if(n.position<=m)break}while(n.position+8<n.fileInfo.size);return a}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&this.buffer[8]&96){const a=new vr(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(a){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return a.startsWith("3g")?a.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
84
- `))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){let a=!1;try{async function s(){const d=new Uint8Array(16);return await Is(n,d,void 0,{maximumLength:d.length,reason:"ASF header GUID"}),{id:d,size:Number(await n.readToken(qN))}}await Rr(n,30,{maximumLength:30,reason:"ASF header prelude"});const i=pt(n),l=n.position;let c=0;for(;n.position+24<n.fileInfo.size&&(c++,!(c>T2||Zn(n,l,Mt)));){const d=n.position,u=await s();let m=u.size-24;if(!Number.isFinite(m)||m<0){a=!0;break}if(or(u.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const p=new Uint8Array(16);if(m-=await Is(n,p,void 0,{maximumLength:p.length,reason:"ASF stream type GUID"}),or(p,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(or(p,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(i&&m>Bd){a=!0;break}if(await Rr(n,m,{maximumLength:i?Bd:n.fileInfo.size,reason:"ASF header payload"}),n.position<=d){a=!0;break}}}catch(s){if(s instanceof tt||s instanceof Yr)pt(n)&&(a=!0);else throw s}return a?void 0:{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await n.ignore(20),await n.readToken(new vr(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await n.peekBuffer(this.buffer,{length:Math.min(256,n.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const a=new DataView(this.buffer.buffer).getUint32(12,!0);if(a>12&&this.buffer.length>=a+16)try{const s=new TextDecoder().decode(this.buffer.subarray(16,a+16));if(JSON.parse(s).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await n.peekBuffer(this.buffer,{length:Math.min(512,n.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&v2(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){const a="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:a})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:a})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
85
- `,{offset:2,encoding:a})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}}),$d(this,"detectImprecise",async n=>{this.buffer=new Uint8Array(Xn);const a=Z2(n.fileInfo.size);if(await n.peekBuffer(this.buffer,{length:Math.min(8,a),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await n.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,a),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let s=0;s<=this.options.mpegOffsetTolerance;++s){const i=this.scanMpeg(s);if(i)return i}});const r=X2(t==null?void 0:t.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:r},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return I2(r2(t,this.getTokenizerOptions()))}async parseTokenizer(t,r=0){this.detectionReentryCount=r;const n=t.position;for(const a of this.detectors){let s;try{s=await a.detect(t)}catch(i){if(i instanceof tt||i instanceof Yr)return;throw i}if(s)return s;if(n!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);const r=t instanceof Uint8Array?t:new Uint8Array(t);if((r==null?void 0:r.length)>1)return this.fromTokenizer(n2(r,this.getTokenizerOptions()))}async fromBlob(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=a2(t,this.getTokenizerOptions());return this.fromTokenizer(n)}async fromStream(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=this.createTokenizerFromWebStream(t);return this.fromTokenizer(n)}async toDetectionStream(t,r){const n=q2((r==null?void 0:r.sampleSize)??Xn);let a,s;const i=t.getReader({mode:"byob"});try{const{value:d,done:u}=await G2(i,new Uint8Array(n),this.options.signal);if(s=d,!u&&d)try{a=await this.fromBuffer(d.subarray(0,n))}catch(m){if(!(m instanceof tt))throw m;a=void 0}s=d}finally{i.releaseLock()}const l=new TransformStream({async start(d){d.enqueue(s)},transform(d,u){u.enqueue(d)}}),c=t.pipeThrough(l);return c.fileType=a,c}async detectGzip(t){var r;if(this.gzipProbeDepth>=N2)return{ext:"gz",mime:"application/gzip"};const n=new x2(t),a=H2(n.inflate(),C2),s=pt(t);let i,l,c,d;if(s){const u=new AbortController;i=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${Fd} ms`,"TimeoutError"))},Fd),l=this.options.signal===void 0?u.signal:AbortSignal.any([this.options.signal,u.signal]),c=new Fl({...this.options,signal:l}),c.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{d=await(c??this).fromStream(a)}catch(u){if((u==null?void 0:u.name)==="AbortError"&&((r=l==null?void 0:l.reason)==null?void 0:r.name)!=="TimeoutError")throw u}finally{clearTimeout(i),s||this.gzipProbeDepth--}return(d==null?void 0:d.ext)==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,r){return or(this.buffer,t,r)}checkString(t,r){return this.check(g2(t,r==null?void 0:r.encoding),r)}async readTiffTag(t){const r=await this.tokenizer.readToken(t?fn:Ge);switch(await this.tokenizer.ignore(10),r){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(t){const r=await this.tokenizer.readToken(t?fn:Ge);if(!(r>A2)&&!(pt(this.tokenizer)&&2+r*12>Ud))for(let n=0;n<r;++n){const a=await this.readTiffTag(t);if(a)return a}}async readTiffHeader(t){const r={ext:"tif",mime:"image/tiff"},n=(t?fn:Ge).get(this.buffer,2),a=(t?Ad:Ke).get(this.buffer,4);if(n===42){if(a>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(a>=8){const l=(t?fn:Ge).get(this.buffer,8),c=(t?fn:Ge).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(pt(this.tokenizer)&&a>D2)return r;const s=pt(this.tokenizer)?Ud:this.tokenizer.fileInfo.size;try{await Rr(this.tokenizer,a,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof tt)return;throw l}let i;try{i=await this.readTiffIFD(t)}catch(l){if(l instanceof tt)return;throw l}return i??r}if(n===43)return r}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}}new Set(y2);new Set(w2);const Gd=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,Cx=({name:e,control:t,disabled:r,campo:n,fileTypes:a,maxFileSize:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),{uploadFile:d,deleteUploadedFile:u}=Ur(),[m,p]=N.useState({status:"idle"}),f=N.useRef(null),[v,h]=N.useState(!1),x=N.useRef(!0);N.useEffect(()=>()=>{x.current=!1},[]);const b=typeof l.value=="string"&&l.value?l.value:null,y=N.useCallback(async S=>{var $;if(a&&a.length>0){const k=await W2(S),E=(k==null?void 0:k.ext)??"",T=(k==null?void 0:k.mime)??"",O=(($=S.name.split(".").pop())==null?void 0:$.toLowerCase())??"",L=S.type.toLowerCase();if(!a.some(A=>{const z=A.toLowerCase();return!!(E&&(z===E||z===T)||T&&z.endsWith("/*")&&T.startsWith(z.slice(0,-1))||!E&&(z===O||z===L||z.endsWith("/*")&&L.startsWith(z.slice(0,-1))))})){p({status:"error",message:`Tipo de arquivo não permitido. Permitidos: ${a.join(", ")}`});return}}if(s&&S.size>s){p({status:"error",message:`Arquivo muito grande. Tamanho máximo: ${Gd(s)}`});return}if(!d){p({status:"error",message:"Preview: upload não disponível sem configuração."});return}p({status:"uploading",fileName:S.name,progress:0});try{if(b&&u)try{await u(b)}catch{}const k=await d(S,n??e,E=>{x.current&&p(T=>T.status==="uploading"?{...T,progress:Math.min(100,E)}:T)});if(!x.current)return;l.onChange(k),p({status:"done",uploadId:k,fileName:S.name,size:S.size})}catch{if(!x.current)return;p({status:"error",message:"Falha no upload. Tente novamente."})}},[d,u,b,n,e,l,a,s]),j=N.useCallback(S=>{var $;const k=($=S.target.files)==null?void 0:$[0];k&&y(k),S.target.value=""},[y]),w=N.useCallback(()=>{b&&u&&u(b).catch(()=>{}),l.onChange(""),p({status:"idle"}),f.current&&(f.current.value="")},[l,b,u]);if(m.status==="done"||m.status==="idle"&&b){const S=m.status==="done"?m.fileName:"Arquivo enviado",$=m.status==="done"?m.size:null;return o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-green-500 bg-green-500/5 px-4 py-3 gap-2",children:[o.jsxs("svg",{className:"shrink-0 text-green-500",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[o.jsx("rect",{width:"20",height:"20",rx:"4",fill:"currentColor",fillOpacity:"0.15"}),o.jsx("path",{d:"M5 10.5L8.5 14L15 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:S}),$!==null&&o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:Gd($)}),!r&&o.jsx("button",{type:"button",onClick:w,className:"ml-2 shrink-0 text-muted-foreground hover:text-destructive transition-colors","aria-label":"Remover arquivo",children:"✕"})]})}if(m.status==="uploading"){const{fileName:S,progress:$}=m;return o.jsxs("div",{className:"rounded-lg border border-input px-4 py-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:S}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:[$,"%"]})]}),o.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary transition-all duration-200 rounded-full",style:{width:`${$}%`}})})]})}const C=m.status==="error";return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{role:"button",tabIndex:r?-1:0,"aria-label":"Selecionar arquivo",className:K("flex items-center justify-center rounded-lg border-2 border-dashed px-4 py-6 transition-colors cursor-pointer",v?"border-primary bg-primary/5":C||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 S;return!r&&((S=f.current)==null?void 0:S.click())},onKeyDown:S=>{var $;(S.key==="Enter"||S.key===" ")&&(($=f.current)==null||$.click())},onDragOver:S=>{S.preventDefault(),r||h(!0)},onDragLeave:()=>h(!1),onDrop:r?void 0:S=>{var $;S.preventDefault(),h(!1);const k=($=S.dataTransfer.files)==null?void 0:$[0];k&&y(k)},onBlur:l.onBlur,children:[o.jsx("input",{ref:f,type:"file",onChange:j,disabled:r,className:"sr-only"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:v?"Solte o arquivo aqui":"Clique ou arraste um arquivo"})]}),C&&o.jsxs("p",{className:"text-sm text-destructive",children:[m.message," · ",o.jsx("button",{type:"button",className:"underline hover:no-underline",onClick:()=>p({status:"idle"}),children:"Tentar novamente"})]}),!C&&((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},tS={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")},Jr=({name:e,control:t,placeholder:r,maskType:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),d=tS[n||""],u=N.useCallback(m=>{l.onChange(d?d(m.target.value):m.target.value)},[l,d]);return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value||"",onChange:u,onBlur:l.onBlur,placeholder:r,disabled:a,readOnly:s,className:K(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},zl=({name:e,control:t})=>{const{field:r}=Be({name:e,control:t});return o.jsx("input",{type:"hidden",...r,value:r.value??""})},Nx=e=>e.replace(/\D/g,""),rS=e=>{const t=Nx(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},nS=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()},Sx=({name:e,control:t,placeholder:r="00000-000",disabled:n,readOnly:a,cepFillMap:s})=>{var i,l;const{field:c,fieldState:d}=Be({name:e,control:t}),{setValue:u}=iN(),{cepLookup:m}=Ur(),[p,f]=N.useState("idle"),[v,h]=N.useState(null),x=N.useRef(null),b=N.useRef(!0);N.useEffect(()=>()=>{var w;b.current=!1,(w=x.current)==null||w.abort()},[]);const y=N.useCallback(async()=>{var w;c.onBlur();const C=Nx(c.value??"");if(C.length===8){(w=x.current)==null||w.abort(),x.current=new AbortController,f("loading"),h(null);try{let S;if(m){const E=x.current;if(S=await m(C,E.signal),E.signal.aborted||!b.current)return}else{const E=await nS(C,x.current.signal);if(!b.current)return;if(E.erro){f("error"),h("CEP não encontrado");return}S={logradouro:E.logradouro,bairro:E.bairro,cidade:E.localidade,estado:E.uf}}if(!b.current)return;if(S.erro){f("error"),h("CEP não encontrado");return}const $=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",k=(E,T,O)=>{if(!O)return;const L=s!=null&&s[E]?`${$}${s[E]}`:`${$}${T}`;u(L,O,{shouldDirty:!0,shouldValidate:!0})};k("logradouro","_address_logradouro",S.logradouro),k("bairro","_address_bairro",S.bairro),k("cidade","_address_cidade",S.cidade),k("estado","_address_estado",S.estado),f("success")}catch(S){if(S instanceof Error&&S.name==="AbortError"||!b.current)return;f("error"),h("Erro ao buscar CEP")}}},[c,m,u,e,s]),j=N.useCallback(w=>{c.onChange(rS(w.target.value))},[c]);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{name:c.name,value:c.value||"",onChange:j,onBlur:y,placeholder:r,disabled:n,readOnly:a,className:K("pr-9",d.error&&"border-destructive focus-visible:ring-destructive")}),o.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",children:[p==="loading"&&o.jsx(I.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"}),p==="success"&&o.jsx(I.Check,{className:"h-4 w-4 text-green-500"}),p==="error"&&o.jsx(I.AlertCircle,{className:"h-4 w-4 text-destructive"})]})]}),(((i=d.error)==null?void 0:i.message)||v)&&o.jsx("p",{className:"text-sm text-destructive",children:((l=d.error)==null?void 0:l.message)||v})]})},aS=({field:e,control:t,nameOverride:r})=>{const n={name:r,control:t,placeholder:e.placeholder};switch(e.tipo){case D.TEXTO:return o.jsx(Lt,{...n,type:"text"});case D.EMAIL:return o.jsx(Lt,{...n,type:"email"});case D.NUMBER:return o.jsx(Lt,{...n,type:"number"});case D.TEXTAREA:return o.jsx(Dl,{...n});case D.SELECT:return o.jsx(Rl,{...n,options:e.opcoes??[]});case D.RADIO:return o.jsx(vx,{...n,options:e.opcoes??[]});case D.CHECKBOX:return o.jsx(Pl,{name:r,control:t,label:e.label});case D.CHECKBOX_GROUP:return o.jsx(gx,{...n,options:e.opcoes??[]});case D.DATE:return o.jsx(ea,{...n,validacao:e.validacao});case D.DATETIME:return o.jsx(ea,{...n,isDatetime:!0,validacao:e.validacao});case D.FILE:return o.jsx(Cx,{name:r,control:t});case D.TELEFONE:return o.jsx(Jr,{...n,maskType:"telefone"});case D.CPF:return o.jsx(Jr,{...n,maskType:"cpf"});case D.CEP:return o.jsx(Sx,{name:r,control:t,placeholder:e.placeholder});case D.HIDDEN:return o.jsx(zl,{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.`),o.jsx(Lt,{...n,type:"text"})}},oS=({name:e,control:t,subFields:r=[],minItems:n=1,maxItems:a,itemLabel:s="Item",addLabel:i})=>{var l;const{fields:c,append:d,remove:u}=hx({control:t,name:e}),{errors:m}=ix({control:t}),p=(l=m[e])==null?void 0:l.message,f=N.useCallback(()=>{const b={};for(const y of r)y.initialValue!==void 0?b[y.nome]=y.initialValue:y.defaultValue!==void 0&&(b[y.nome]=y.defaultValue);return b},[r]);N.useEffect(()=>{if(c.length<n)for(let b=c.length;b<n;b++)d(f())},[n]);const v=[...r].sort((b,y)=>b.ordem-y.ordem),h=!a||c.length<a,x=i??`Adicionar ${s.toLowerCase()}`;return o.jsxs("div",{className:"space-y-3",children:[c.map((b,y)=>o.jsxs("div",{className:"rounded-lg border border-input p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary/10 text-xs font-bold text-primary shrink-0",children:y+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[s," ",y+1]})]}),c.length>n&&o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",onClick:()=>u(y),"aria-label":`Remover ${s.toLowerCase()} ${y+1}`,className:"text-muted-foreground hover:text-destructive",children:o.jsx(I.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:v.map(j=>{const w=`${e}.${y}.${j.nome}`,C=`span ${j.tamanho??12}`,S=o.jsx(aS,{field:j,control:t,nameOverride:w});return j.tipo===D.CHECKBOX||j.tipo===D.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:C},children:S},j.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:C},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1 text-sm text-foreground",children:[j.label,j.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),S,j.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:j.hint})]},j.id)})})]},b.id)),h&&o.jsxs(Ae,{type:"button",variant:"outline",className:"w-full",onClick:()=>d(f()),children:[o.jsx(I.Plus,{className:"w-4 h-4"}),x]}),a&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",a," ",s.toLowerCase(),a>1?"s":""]}),p&&o.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[o.jsx(I.AlertCircle,{className:"w-4 h-4 shrink-0"}),p]})]})},Xd=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,sS=(e,t)=>{const r=new Date(e.slice(0,10)+"T00:00:00Z"),n=new Date(t.slice(0,10)+"T00:00:00Z");return Math.round((n.getTime()-r.getTime())/864e5)+1},iS=(e,t)=>{const r=[],n=new Date(e.slice(0,10)+"T00:00:00Z"),a=new Date(t.slice(0,10)+"T00:00:00Z");let s=0;for(;n<=a&&s<60;)r.push(n.toISOString().slice(0,10)),n.setUTCDate(n.getUTCDate()+1),s++;return r},lS=e=>{const[t,r,n]=e.split("-").map(Number),a=new Date(Date.UTC(t,r-1,n)),s=String(n).padStart(2,"0"),i=String(r).padStart(2,"0"),l=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(a),c=l.charAt(0).toUpperCase()+l.slice(1);return`${s}/${i} - ${c}`},cS=(e,t)=>{const r=n=>{const[a,s,i]=n.slice(0,10).split("-");return`${i}/${s}/${a}`};return`${r(e)} a ${r(t)}`},dS=({name:e,control:t})=>{var r;const{field:n,fieldState:a}=Be({name:e,control:t}),{externalData:s={}}=Ur(),i=n.value??null,l=(r=a.error)==null?void 0:r.message,c=V=>s[`evento.${V}`]??s[V],d=c("dataInicioEvento")??"",u=c("dataFimEvento")??"",m=Number(c("valor")??0),p=Number(c("valorPorDia")??0),f=c("vagasTotal"),v=c("vagasPorDia"),h=c("vagasMasculinas"),x=c("vagasFemininas"),b=f!=null?Number(f):null,y=v!=null?Number(v):null,j=h!=null?Number(h):null,w=x!=null?Number(x):null,C=d&&u?iS(d,u):[],S=(d&&u?sS(d,u):0)>1,$=j!=null&&j>0&&w!=null&&w>0,k=j!=null&&w==null?"masculino":w!=null&&j==null?"feminino":null,E=(i==null?void 0:i.tipo)??null,T=(i==null?void 0:i.data)??null,O=(i==null?void 0:i.genero)??null,L=N.useRef(i);L.current=i;const A=N.useRef(n.onChange);A.current=n.onChange,N.useEffect(()=>{var V,M,_;k&&((V=L.current)==null?void 0:V.genero)!==k&&A.current({tipo:((M=L.current)==null?void 0:M.tipo)??null,data:((_=L.current)==null?void 0:_.data)??null,genero:k})},[k]);const z=V=>{const M={tipo:V,data:null};($||k)&&(M.genero=O??k??void 0),n.onChange(M)},X=V=>{const M={tipo:"por_dia",data:V};($||k)&&(M.genero=O??k??void 0),n.onChange(M)},q=V=>{n.onChange({tipo:E,data:T,genero:V})},Z=V=>E===V;return o.jsxs("div",{className:"space-y-3",children:[$&&o.jsxs("div",{className:"flex items-center gap-2 px-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Você é:"}),o.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(V=>o.jsx("button",{type:"button",onClick:()=>q(V),className:K("px-3 py-1 rounded-full text-xs font-medium border transition-all",O===V?"border-primary bg-primary/10 text-primary":"border-input text-muted-foreground hover:border-primary/50"),children:V==="masculino"?"Masculino":"Feminino"},V))})]}),o.jsxs("button",{type:"button",onClick:()=>z("todos_os_dias"),className:K("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("todos_os_dias")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsx("div",{className:K("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("todos_os_dias")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(I.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar todos os dias"}),d&&u?o.jsx("p",{className:"text-xs text-muted-foreground",children:cS(d,u)}):o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Datas do evento"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[m>0&&o.jsx("p",{className:K("font-bold text-sm",Z("todos_os_dias")?"text-primary":"text-foreground"),children:Xd(m)}),b!=null&&b>0&&o.jsxs("p",{className:"text-xs flex items-center justify-end gap-1 text-muted-foreground",children:[o.jsx(I.Users,{className:"w-3 h-3"}),b," vagas disponíveis"]})]})]}),S?o.jsxs("button",{type:"button",onClick:()=>z("por_dia"),className:K("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("por_dia")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsx("div",{className:K("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("por_dia")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(I.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado abaixo"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[p>0&&o.jsx("p",{className:K("font-bold text-sm",Z("por_dia")?"text-primary":"text-foreground"),children:Xd(p)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"por dia"})]})]}):d?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg border border-input bg-muted/30",children:[o.jsx(I.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.'})]}):null,E==="por_dia"&&o.jsxs("div",{className:"pl-2 space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-primary",children:"Selecione o dia:"}),C.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Nenhuma data configurada no evento"}):C.map(V=>o.jsxs("button",{type:"button",onClick:()=>X(V),className:K("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",T===V?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:K("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center transition-colors",T===V?"border-primary bg-primary":"border-input"),children:T===V&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-white"})}),o.jsx("span",{className:"text-sm",children:lS(V)})]}),y!=null&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[y," vagas"]})]},V))]}),l&&o.jsx("p",{className:"text-sm text-destructive",children:l})]})},Zd=.0315,Kd=.124,Yd=7,Jd=12,uS=[{id:"pix",label:"PIX",description:"Transferência instantânea (à vista)",Icon:I.Smartphone,taxa:0},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:I.Banknote,taxa:0},{id:"cartao",label:"Cartão de Crédito",description:"Débito ou crédito na maquininha",Icon:I.CreditCard,taxa:Zd,taxaLabel:`Taxa: ${(Zd*100).toFixed(2).replace(".",",")}%`}],mS=[{id:"pix",label:"PIX à Vista",description:"Pagamento instantâneo sem parcelamento",Icon:I.Smartphone,taxa:0},{id:"pix_parcelado",label:"PIX Parcelado",description:`Parcelado em até ${Yd}x sem juros`,Icon:I.Smartphone,taxa:0,parcelas:Yd},{id:"cartao",label:"Cartão de Crédito",description:`Parcelado em até ${Jd}x`,Icon:I.CreditCard,taxa:Kd,parcelas:Jd,taxaLabel:`Taxa: ${(Kd*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:I.Banknote,taxa:0}],Ra=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,Qd=(e,t)=>Math.round(e*(1+t)*100)/100,pS=(e,t)=>Math.round(e/t*100)/100,fS=({name:e,control:t,relatedFieldName:r="tipo_participacao"})=>{var n;const{field:a,fieldState:s}=Be({name:e,control:t}),{externalData:i={},paymentMethodOptions:l}=Ur(),c=a.value??null,d=(n=s.error)==null?void 0:n.message,u=Fn({control:t,name:r}),m=(u==null?void 0:u.tipo)??null,p=j=>i[`evento.${j}`]??i[j],f=Number(p("valor")??0),v=Number(p("valorPorDia")??0),h=m==="por_dia"&&v>0?v:f,x=m==="por_dia"?(l==null?void 0:l.porDia)??uS:(l==null?void 0:l.todosOsDias)??mS,b=m==="por_dia"?(()=>{if(!(u!=null&&u.data))return"Um dia";const j=u.data.split("-");if(j.length===3){const[w,C,S]=j;return`${S}/${C}/${w}`}return u.data})():"Todos os dias",y=j=>{if(j.disabled)return;const w=Qd(h,j.taxa),C={metodo:j.id,valorTotal:w};j.parcelas&&(C.parcelas=j.parcelas),a.onChange(C)};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-input px-4 py-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:b})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Valor base"}),o.jsx("p",{className:"text-lg font-bold text-primary",children:Ra(h)})]})]}),o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-input bg-muted/30 px-3 py-2.5",children:[o.jsx(I.Info,{className:"h-4 w-4 mt-0.5 shrink-0 text-muted-foreground"}),o.jsxs("p",{className:"text-xs",children:[o.jsx("span",{className:"font-bold",children:"Importante:"})," Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:x.map(j=>{const{Icon:w}=j,C=(c==null?void 0:c.metodo)===j.id,S=Qd(h,j.taxa),$=!!j.parcelas&&j.parcelas>1,k=$?pS(S,j.parcelas):null;return o.jsxs("button",{type:"button",disabled:j.disabled,onClick:()=>y(j),className:K("w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all",C?"border-primary bg-primary/5":"border-input hover:border-primary/50",j.disabled&&"opacity-50 cursor-not-allowed"),children:[o.jsx("div",{className:K("flex items-center justify-center w-10 h-10 rounded-lg shrink-0 transition-colors",C?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(w,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:j.label}),o.jsx("p",{className:"text-xs text-muted-foreground",children:j.description}),j.taxaLabel&&o.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["* ",j.taxaLabel]}),j.taxa>0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",Ra(S)]})]}),o.jsx("div",{className:"text-right shrink-0",children:$?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold text-primary",children:Ra(k)})]}):o.jsx("p",{className:"text-base font-bold text-primary",children:Ra(S)})})]},j.id)})}),d&&o.jsx("p",{className:"text-xs text-destructive",children:d})]})},hS=({name:e,control:t,label:r,termoTexto:n,termoPdfUrl:a,termoPdfUploadId:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),{resolveTermsUploadUrl:d}=Ur(),u=!!c.error,m=(i=c.error)==null?void 0:i.message,[p,f]=N.useState(null),[v,h]=N.useState(!1),[x,b]=N.useState(!1),y=N.useRef(null);N.useEffect(()=>{var $;x&&(($=y.current)==null||$.focus())},[x]),N.useEffect(()=>{if(!s||!d){f(null);return}let $=!1;return h(!0),d(s).then(k=>{$||f(k)}).catch(()=>{$||f(null)}).finally(()=>{$||h(!1)}),()=>{$=!0}},[s,d]);const j=l.value==="accepted",w=p||a||null,C=!!(n||w||s),S=!!w;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:K("rounded-lg border p-4 space-y-4 transition-colors",u?"border-destructive bg-destructive/5":j?"border-green-500 bg-green-500/5":"border-input"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(I.ScrollText,{className:"h-4 w-4 shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:r||"Termos e condições"})]}),C?o.jsxs(Ae,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:v,onClick:()=>b(!0),children:[v?o.jsx(I.Loader2,{className:"h-3 w-3 animate-spin"}):o.jsx(I.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:s&&v?"Carregando PDF...":"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx(rt,{className:"mt-0.5",checked:j,onCheckedChange:$=>l.onChange($?"accepted":"")}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito ",r?`"${r}"`:"os termos e condições"]}),j&&o.jsx(I.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]}),u&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(I.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),m||"Você precisa aceitar os termos para continuar"]}),x&&o.jsx("div",{ref:y,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:()=>b(!1),onKeyDown:$=>{$.key==="Escape"&&b(!1)},children:o.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:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-input",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(I.ScrollText,{className:"h-4 w-4"}),o.jsx("span",{className:"font-semibold",children:"Termos e condições"})]}),o.jsx(Ae,{type:"button",variant:"ghost",size:"icon",onClick:()=>b(!1),children:o.jsx(I.X,{className:"h-4 w-4"})})]}),o.jsx("div",{className:"flex-1 overflow-auto p-4",children:S?o.jsx("iframe",{src:w,className:"w-full rounded border",style:{height:"62vh"},title:"Termos e condições",sandbox:"allow-scripts"}):o.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:n})})]})})]})},xS=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),[c,d]=N.useState(!1),u=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{...i,value:i.value??"",type:c?"text":"password",placeholder:r,disabled:n,readOnly:a,className:K("pr-10",u&&"border-destructive focus-visible:ring-destructive")}),o.jsx("button",{type:"button",tabIndex:-1,onClick:()=>d(m=>!m),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?o.jsx(I.EyeOff,{size:16}):o.jsx(I.Eye,{size:16})})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},$x=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),c=!!i.value;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[o.jsx(_i,{checked:c,onCheckedChange:d=>!a&&i.onChange(d),disabled:n||a,onBlur:i.onBlur}),o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},gS=({name:e,control:t,minValue:r=0,maxValue:n=100,step:a=1,disabled:s,readOnly:i})=>{var l;const{field:c,fieldState:d}=Be({name:e,control:t}),u=c.value??r;return N.useEffect(()=>{(c.value===void 0||c.value===null)&&c.onChange(r)},[]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(So,{min:r,max:n,step:a,value:[u],onValueChange:m=>!i&&c.onChange(m[0]),disabled:s||i,className:"flex-1"}),o.jsx("span",{className:"text-sm font-medium text-primary min-w-[3rem] text-right tabular-nums",children:u})]}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:r}),o.jsx("span",{children:n})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",children:d.error.message})]})},Os=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),vS=({name:e,control:t,disabled:r,readOnly:n})=>{var a;const{field:s,fieldState:i}=Be({name:e,control:t}),l=s.value||"#000000",[c,d]=N.useState(l);return N.useEffect(()=>{d(l)},[l]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("input",{type:"color",value:Os(l)?l:"#000000",disabled:r||n,onChange:u=>s.onChange(u.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"}),o.jsx(ue,{type:"text",value:c,readOnly:n,disabled:r,onChange:u=>{const m=u.target.value;d(m),Os(m)&&s.onChange(m.toUpperCase())},onBlur:()=>{Os(c)||d(l),s.onBlur()},className:K("flex-1 font-mono uppercase",i.error&&"border-destructive focus-visible:ring-destructive"),maxLength:7,placeholder:"#000000"})]}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},bS=({name:e,control:t,options:r,placeholder:n,disabled:a,readOnly:s})=>{var i,l;const{field:c,fieldState:d}=Be({name:e,control:t}),[u,m]=N.useState(""),[p,f]=N.useState(!1),[v,h]=N.useState(-1),x=N.useRef(null),b=N.useRef(null),y=`autocomplete-${e}-listbox`,j=((i=r.find(T=>T.valor===c.value))==null?void 0:i.label)??"",w=u.length>0?r.filter(T=>T.label.toLowerCase().includes(u.toLowerCase())):r;N.useEffect(()=>{const T=O=>{x.current&&!x.current.contains(O.target)&&(f(!1),m(""),h(-1))};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const C=()=>{f(!1),m(""),h(-1)};N.useEffect(()=>{if(v<0||!b.current)return;const T=b.current.querySelector(`[id="${y}-option-${v}"]`);T==null||T.scrollIntoView({block:"nearest"})},[v,y]);const S=T=>{T.disabled||(c.onChange(T.valor),C())},$=()=>{c.onChange(""),m(""),h(-1)},k=T=>{if(!p){(T.key==="ArrowDown"||T.key==="ArrowUp")&&(T.preventDefault(),f(!0),h(0));return}switch(T.key){case"ArrowDown":T.preventDefault(),h(O=>O<w.length-1?O+1:O);break;case"ArrowUp":T.preventDefault(),h(O=>O>0?O-1:0);break;case"Enter":T.preventDefault(),v>=0&&w[v]&&!w[v].disabled&&S(w[v]);break;case"Escape":T.preventDefault(),C();break;case"Tab":C();break}},E=p&&v>=0?`${y}-option-${v}`:void 0;return o.jsxs("div",{className:"space-y-1",ref:x,children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{type:"text",role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":y,"aria-activedescendant":E,value:p?u:j,placeholder:n??"Buscar...",disabled:a,readOnly:s,onChange:T=>{m(T.target.value),h(-1),f(!0)},onFocus:()=>!s&&f(!0),onKeyDown:k,className:K("pr-8",d.error&&"border-destructive focus-visible:ring-destructive"),autoComplete:"off"}),o.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:c.value?o.jsx("button",{type:"button",onClick:$,className:"text-[var(--t-text-muted)] hover:text-[var(--t-text)]",tabIndex:-1,"aria-label":"Limpar seleção",children:o.jsx(I.X,{size:14})}):o.jsx(I.ChevronDown,{size:16,className:"text-muted-foreground pointer-events-none","aria-hidden":"true"})}),p&&!a&&!s&&o.jsx("ul",{role:"listbox",id:y,ref:b,"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:w.length===0?o.jsx("li",{role:"option","aria-selected":!1,className:"px-3 py-2 text-sm text-muted-foreground",children:"Nenhuma opção encontrada"}):w.map((T,O)=>o.jsx("li",{id:`${y}-option-${O}`,role:"option","aria-selected":c.value===T.valor,"aria-disabled":T.disabled,onMouseDown:()=>S(T),className:["flex cursor-pointer items-center px-3 py-2 text-sm",T.disabled?"cursor-not-allowed opacity-40":O===v?"bg-accent":"hover:bg-accent",c.value===T.valor?"font-medium text-primary":"text-foreground"].join(" "),children:T.label},T.valor))})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",role:"alert",children:d.error.message})]})},Ex=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),c=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...i,value:i.value??"",type:"time",placeholder:r,disabled:n,readOnly:a,className:K(c&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},yS=({name:e,control:t,startLabel:r="Data inicial",endLabel:n="Data final",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),d=l.value??{},u=(p,f)=>{l.onChange({...d,[p]:f})},m=!!c.error;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{children:r}),o.jsx(ue,{type:"date",value:d.start??"",disabled:a,readOnly:s,onChange:p=>u("start",p.target.value),max:d.end??void 0,className:K(m&&"border-destructive focus-visible:ring-destructive")})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(ie,{children:n}),o.jsx(ue,{type:"date",value:d.end??"",disabled:a,readOnly:s,onChange:p=>u("end",p.target.value),min:d.start??void 0,className:K(m&&"border-destructive focus-visible:ring-destructive")})]})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},wS=({name:e,control:t,maxRating:r=5,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),c=i.value??0,d=Array.from({length:r},(u,m)=>m+1);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[d.map(u=>o.jsx("button",{type:"button",disabled:n||a,onClick:()=>i.onChange(u===c?0:u),className:"transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":`${u} estrela${u>1?"s":""}`,children:o.jsx(I.Star,{size:24,className:"transition-colors",fill:u<=c?"var(--color-primary)":"transparent",stroke:u<=c?"var(--color-primary)":"currentColor"})},u)),c>0&&o.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[c,"/",r]})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},jS=({field:e,name:t,control:r,disabled:n,readOnly:a})=>{const s=n||e.isDisabled,i=a||e.isReadOnly;switch(e.tipo){case D.EMAIL:return o.jsx(Lt,{name:t,control:r,type:"email",placeholder:e.placeholder,disabled:s,readOnly:i});case D.NUMBER:return o.jsx(Lt,{name:t,control:r,type:"number",placeholder:e.placeholder,disabled:s,readOnly:i});case D.PASSWORD:return o.jsx(Lt,{name:t,control:r,type:"password",placeholder:e.placeholder,disabled:s,readOnly:i});case D.TELEFONE:return o.jsx(Jr,{name:t,control:r,maskType:"telefone",placeholder:e.placeholder??"(00) 00000-0000",disabled:s,readOnly:i});case D.CPF:return o.jsx(Jr,{name:t,control:r,maskType:"cpf",placeholder:e.placeholder??"000.000.000-00",disabled:s,readOnly:i});case D.CEP:return o.jsx(Jr,{name:t,control:r,maskType:"cep",placeholder:e.placeholder??"00000-000",disabled:s,readOnly:i});case D.TEXTAREA:return o.jsx(Dl,{name:t,control:r,placeholder:e.placeholder,disabled:s,readOnly:i});case D.SELECT:return o.jsx(Rl,{name:t,control:r,options:e.opcoes??[],placeholder:e.placeholder,disabled:s,readOnly:i});case D.CHECKBOX:return o.jsx(Pl,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case D.SWITCH:return o.jsx($x,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case D.DATE:return o.jsx(ea,{name:t,control:r,disabled:s,readOnly:i});case D.TIME:return o.jsx(Ex,{name:t,control:r,disabled:s,readOnly:i});case D.HIDDEN:return o.jsx(zl,{name:t,control:r});default:return o.jsx(Lt,{name:t,control:r,type:"text",placeholder:e.placeholder,disabled:s,readOnly:i})}},kS=({name:e,control:t,subSchema:r,disabled:n,readOnly:a})=>{if(!r||r.fields.length===0)return null;const s=[...r.fields].sort((i,l)=>i.ordem-l.ordem);return o.jsxs("div",{className:"rounded-xl border border-input bg-muted/30 p-4 space-y-4",children:[r.titulo&&o.jsx("h4",{className:"text-sm font-semibold text-muted-foreground",children:r.titulo}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:s.map(i=>{const l=`${e}.${i.nome}`,c=i.tipo===D.CHECKBOX||i.tipo===D.SWITCH||i.tipo===D.HIDDEN,d=i.tamanho??6;return o.jsxs("div",{className:`col-span-${d}`,children:[!c&&o.jsxs("label",{className:"mb-1 block text-sm font-medium text-foreground",children:[i.label,i.obrigatorio&&o.jsx("span",{className:"text-destructive",children:" *"})]}),o.jsx(jS,{field:i,name:l,control:t,disabled:n,readOnly:a})]},i.id)})})]})},Tx=({field:e,control:t,nameOverride:r})=>{var n,a;const s=r??e.nome,{componentMapper:i}=Ur(),l=i==null?void 0:i[e.tipo];if(l)return o.jsx(l,{name:s,control:t,field:e});const c={name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly};switch(e.tipo){case D.TEXTO:return o.jsx(Lt,{...c,type:"text"});case D.EMAIL:return o.jsx(Lt,{...c,type:"email"});case D.NUMBER:return o.jsx(Lt,{...c,type:"number"});case D.PASSWORD:return o.jsx(xS,{...c});case D.TEXTAREA:return o.jsx(Dl,{...c});case D.SELECT:return o.jsx(Rl,{...c,options:e.opcoes??[]});case D.AUTOCOMPLETE:return o.jsx(bS,{...c,options:e.opcoes??[]});case D.SWITCH:return o.jsx($x,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.SLIDER:return o.jsx(gS,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.RATING:return o.jsx(wS,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.COLOR:return o.jsx(vS,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.TIME:return o.jsx(Ex,{...c});case D.DATE_RANGE:return o.jsx(yS,{name:s,control:t,startLabel:e.dateRangeStartLabel,endLabel:e.dateRangeEndLabel,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.RADIO:return o.jsx(vx,{...c,options:e.opcoes??[]});case D.CHECKBOX:return o.jsx(Pl,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case D.CHECKBOX_GROUP:return o.jsx(gx,{...c,options:e.opcoes??[]});case D.DATE:return o.jsx(ea,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case D.DATETIME:return o.jsx(ea,{name:s,control:t,isDatetime:!0,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case D.FILE:return o.jsx(Cx,{name:s,control:t,disabled:e.isDisabled,fileTypes:(n=e.validacao)==null?void 0:n.fileTypes,maxFileSize:(a=e.validacao)==null?void 0:a.maxFileSize});case D.TELEFONE:return o.jsx(Jr,{...c,maskType:"telefone"});case D.CPF:return o.jsx(Jr,{...c,maskType:"cpf"});case D.CEP:return o.jsx(Sx,{name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly,cepFillMap:e.cepFillMap});case D.HIDDEN:return o.jsx(zl,{name:s,control:t});case D.PARTICIPATION_TYPE:return o.jsx(dS,{name:s,control:t});case D.PAYMENT_METHOD:return o.jsx(fS,{name:s,control:t,relatedFieldName:e.relatedFieldName});case D.TERMS:return o.jsx(hS,{name:s,control:t,label:e.label,termoTexto:e.termoTexto,termoPdfUrl:e.termoPdfUrl,termoPdfUploadId:e.termoPdfUploadId});case D.FIELD_ARRAY:return o.jsx(oS,{name:s,control:t,subFields:e.subFields,minItems:e.minItems,maxItems:e.maxItems,itemLabel:e.itemLabel,addLabel:e.addLabel});case D.SUB_FORM:return o.jsx(kS,{name:s,control:t,subSchema:e.subSchema,disabled:e.isDisabled,readOnly:e.isReadOnly});default:return o.jsx(Lt,{...c,type:"text"})}},CS=({container:e,control:t})=>{var r;const{externalData:n={},fieldResolvers:a}=Ur(),s=e.icone?Pt[e.icone]:void 0,i=n,l=N.useMemo(()=>Al(e,i),[e,JSON.stringify(i)]),c=N.useMemo(()=>[...l.campos].sort((x,b)=>x.ordem-b.ordem),[l.campos]),d=Fn({control:t}),{wrapperClass:u,wrapperStyle:m,headerClass:p,headerStyle:f,tmpl:v}=xx(),h=x=>{if(!$e(x.condicional,d,n))return null;let b=x;if(x.resolvePropsKey&&a!=null&&a[x.resolvePropsKey]){const S=a[x.resolvePropsKey](x,d,n);b={...x,...S}}if(b.opcoesFromVar){const S=n[b.opcoesFromVar];Array.isArray(S)&&(b={...b,opcoes:S.map($=>typeof $=="string"?{valor:$,label:$}:$&&typeof $=="object"&&"valor"in $&&"label"in $?$:{valor:String($),label:String($)})})}const y=b.tamanho??12,j=b.inicioColuna,w=j?`${j} / span ${y}`:`span ${y}`,C=o.jsx(Tx,{field:b,control:t});return b.tipo===D.CHECKBOX||b.tipo===D.HIDDEN||b.tipo===D.SWITCH?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:w},children:C},b.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:w},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[b.label,b.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),C,b.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:b.hint})]},b.id)};return o.jsxs("div",{className:u,style:m,children:[(l.titulo||s)&&o.jsx("div",{className:p,style:f,children:o.jsxs("div",{className:"flex items-center gap-3",children:[s&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(s,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=v.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:l.titulo}),l.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:l.descricao})]})]})}),o.jsx("div",{className:"p-6 grid grid-cols-12 gap-4",children:c.map(h)})]})},NS=({container:e,control:t})=>{var r;const{externalData:n={}}=Ur(),a=e.nome??"__invalid__",s=e.minItems??1,i=e.maxItems,l=e.itemLabel??"Item",c=e.icone?Pt[e.icone]:void 0,d=n,u=N.useMemo(()=>Al(e,d),[e,JSON.stringify(d)]),m=N.useMemo(()=>[...u.campos].sort((k,E)=>k.ordem-E.ordem),[u.campos]),p=N.useCallback(()=>{const k={};for(const E of m)E.initialValue!==void 0?k[E.nome]=typeof E.initialValue=="string"?wt(E.initialValue,d):E.initialValue:E.defaultValue!==void 0&&(k[E.nome]=E.defaultValue);return k},[m,d]),{fields:f,append:v,remove:h}=hx({control:t,name:a});N.useEffect(()=>{if(e.nome&&f.length<s)for(let k=f.length;k<s;k++)v(p())},[s]);const x=Fn({control:t}),b=N.useMemo(()=>{const k=x[a];return Array.isArray(k)?k:[]},[x,a]),{wrapperClass:y,wrapperStyle:j,headerClass:w,headerStyle:C,tmpl:S}=xx();if(!e.nome)return console.error("[RepeatableContainerRenderer] container.nome é obrigatório para containers repetíveis. Container id:",e.id),null;const $=(k,E)=>{const T=b[E]??{};if(!$e(k.condicional,T,n))return null;const O=`${a}.${E}.${k.nome}`,L=k.tamanho??12,A=k.inicioColuna,z=A?`${A} / span ${L}`:`span ${L}`,X=o.jsx(Tx,{field:k,control:t,nameOverride:O});return k.tipo===D.CHECKBOX||k.tipo===D.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:z},children:X},`${k.id}-${E}`):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:z},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[k.label,k.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),X,k.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:k.hint})]},`${k.id}-${E}`)};return o.jsxs("div",{className:y,style:j,children:[(u.titulo||c)&&o.jsx("div",{className:w,style:C,children:o.jsxs("div",{className:"flex items-center gap-3",children:[c&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(c,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=S.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:u.titulo}),u.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:u.descricao})]})]})}),o.jsxs("div",{className:"p-6 space-y-4",children:[f.map((k,E)=>o.jsxs("div",{className:"border border-input rounded-lg p-4 bg-muted/30",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 bg-primary text-primary-foreground",children:E+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[l," ",E+1]})]}),f.length>s&&o.jsx("button",{type:"button",onClick:()=>h(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:o.jsx(I.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:m.map(T=>$(T,E))})]},k.id)),(!i||f.length<i)&&o.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:()=>v(p()),children:[o.jsx(I.Plus,{className:"w-4 h-4"}),"Adicionar ",l.toLowerCase()]}),i&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",i," ",l.toLowerCase(),i>1?"s":""]})]})]})},SS=e=>e.container.repeatable&&e.container.nome?o.jsx(NS,{...e}):o.jsx(CS,{...e}),$S=({step:e,control:t,externalData:r={}})=>{const n=N.useMemo(()=>[...e.containers].sort((s,i)=>s.ordem-i.ordem),[e.containers]),a=Fn({control:t});return o.jsx("div",{className:"grid grid-cols-12 gap-4",children:n.map(s=>{if(s.condicional&&!$e(s.condicional,a,r))return null;const i=s.tamanho??12,l=s.inicioColuna,c=l?`${l} / span ${i}`:`span ${i}`;return o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:c},children:o.jsx(SS,{container:s,control:t})},s.id)})})},ES=N.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),TS=ES.Provider,eu=({stepIndex:e,totalSteps:t,step:r,defaultValues:n,externalData:a,fieldErrors:s,isSubmitting:i,submitError:l,validatorMapper:c={},onWarningsChange:d,onValuesChange:u,onSubmit:m,onBack:p})=>{const f=e===t-1,v=N.useMemo(()=>JSON.stringify(a),[a]),h=N.useMemo(()=>$N(r,a,c),[r.id,v]),x=N.useMemo(()=>EN(r,a,c),[r.id,v]),[b,y]=N.useState({}),j=N.useRef(d);j.current=d;const w=a,C=N.useMemo(()=>RN(r,w),[r,v]),S=CN({resolver:h,defaultValues:n,mode:"onTouched"}),{control:$,handleSubmit:k,setError:E,clearErrors:T,setValue:O}=S;N.useEffect(()=>{T();for(const[U,Q]of Object.entries(s))E(U,{type:"server",message:Q})},[s,E,T]);const L=N.useMemo(()=>r.containers.filter(U=>!U.repeatable).flatMap(U=>U.campos).filter(U=>!!U.condicional),[r.containers]),A=N.useMemo(()=>r.containers.filter(U=>!!U.condicional),[r.containers]),z=N.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]),X=N.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]),q=N.useRef({}),Z=N.useRef(!0),V=Fn({control:$}),M=N.useRef(u);M.current=u,N.useEffect(()=>{var U;(U=M.current)==null||U.call(M,V)},[V]),N.useEffect(()=>{let U=!1;return x(V).then(Q=>{var Y;U||(y(Q),(Y=j.current)==null||Y.call(j,Q))}).catch(Q=>{U||console.error("[StepForm] warnComputer error:",Q)}),()=>{U=!0}},[V,x]),N.useEffect(()=>{var U;if(!L.length&&!z.length&&!A.length&&!X.length)return;const Q=V;for(const H of L)if(!$e(H.condicional,Q,a)){if(T(H.nome),H.tipo===D.FIELD_ARRAY){const W=Q[H.nome];Array.isArray(W)&&W.forEach((G,ne)=>{(H.subFields??[]).forEach(J=>T(`${H.nome}.${ne}.${J.nome}`))})}if(H.clearedValue!==void 0){const W=H.clearedValue??"";Q[H.nome]!==W&&O(H.nome,W,{shouldValidate:!1})}}for(const H of A)if(!$e(H.condicional,Q,a))if(H.repeatable&&H.nome)(Array.isArray(Q[H.nome])?Q[H.nome]:[]).forEach((W,G)=>{for(const ne of H.campos)T(`${H.nome}.${G}.${ne.nome}`)});else for(const W of H.campos){T(W.nome);const G=W.clearedValue!==void 0?W.clearedValue:void 0;G!==void 0&&Q[W.nome]!==G&&O(W.nome,G,{shouldValidate:!1})}for(const{container:H,fields:W}of X){const G=H.nome,ne=Array.isArray(Q[G])?Q[G]:[];for(let J=0;J<ne.length;J++){const te=ne[J];for(const ce of W)if(!$e(ce.condicional,te,a)&&(T(`${G}.${J}.${ce.nome}`),ce.clearedValue!==void 0)){const be=ce.clearedValue??"";te[ce.nome]!==be&&O(`${G}.${J}.${ce.nome}`,be,{shouldValidate:!1})}}}const Y=Z.current;for(const H of z){const W=$e(H.condicional,Q,a),G=Y?W:q.current[H.nome]??!1;if(W&&!G&&(U=H.setValues)!=null&&U.length)for(const ne of H.setValues){const J=typeof ne.valor=="string"?wt(ne.valor,w):ne.valor;O(ne.campo,J,{shouldValidate:!1})}q.current[H.nome]=W}Z.current=!1},[V,L,z,A,X,a,O,T]);const _=C.icone?Pt[C.icone]:void 0,se=N.useMemo(()=>()=>{S.handleSubmit(m)()},[m]);return o.jsx(lN,{...S,children:o.jsx(TS,{value:{submitting:i,warnings:b,requestSubmit:se},children:o.jsx("form",{onSubmit:k(m),noValidate:!0,onKeyDown:U=>{U.key==="Enter"&&U.target.tagName==="INPUT"&&U.preventDefault()},children:o.jsxs("div",{className:"space-y-6",children:[C.showLabel!==!1&&o.jsxs("div",{className:"text-center space-y-2",children:[_&&o.jsx("div",{className:"w-12 h-12 mx-auto rounded-xl flex items-center justify-center",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(_,{className:"w-6 h-6",style:{color:"var(--t-primary)"}})}),o.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:C.titulo}),C.descricao&&o.jsx("p",{className:"text-sm text-muted-foreground",children:C.descricao})]}),o.jsx($S,{step:C,control:$,externalData:a}),o.jsxs("div",{className:"flex items-center justify-between gap-4 pt-6 pb-2",children:[o.jsxs(Ae,{type:"button",variant:"outline",onClick:p,disabled:e===0,className:K(e>0&&"border-primary/40 text-primary hover:bg-primary/5"),children:[o.jsx(I.ChevronLeft,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),o.jsxs("span",{className:"text-xs font-semibold tabular-nums sm:hidden text-muted-foreground",children:[e+1,"/",t]}),o.jsxs(Ae,{type:"submit",disabled:i,children:[i?o.jsx(I.Loader2,{className:"w-4 h-4 animate-spin"}):f?o.jsx(I.Check,{className:"w-4 h-4"}):o.jsx(I.ChevronRight,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:f?"Finalizar":"Próximo"})]})]}),l&&o.jsx("p",{className:"text-sm text-destructive mt-2 text-center",children:l})]})})})})},no=e=>{if(e)return Pt[e]},AS=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:s=>s.key==="Enter"&&(r==null?void 0:r(a)),className:K("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:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(I.Check,{className:"w-4 h-4"}):a+1},n.id))}),DS=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>{const s=no(n.icone)??I.CircleDot;return o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:i=>i.key==="Enter"&&(r==null?void 0:r(a)),className:K("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(I.Check,{className:"w-4 h-4"}):o.jsx(s,{className:"w-4 h-4"})},n.id)})}),RS=({steps:e,currentStep:t,position:r,orientation:n="horizontal",onStepClick:a})=>n==="vertical"?o.jsx("div",{className:"flex flex-col gap-0",children:e.map((s,i)=>{const l=no(s.icone)??I.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:K("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#fff",boxShadow:"0 0 10px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#fff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(I.Check,{className:"w-3.5 h-3.5"}):o.jsx(l,{className:"w-3.5 h-3.5"})}),!u&&o.jsx("div",{className:"w-[2px] my-1",style:{height:"24px",background:d?"#22c55e":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]}),o.jsx("span",{className:"text-sm font-medium leading-tight mt-1.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]},s.id)})}):o.jsx("div",{className:"w-full flex items-start",children:e.map((s,i)=>{const l=no(s.icone)??I.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:K("flex items-start",!u&&"flex-1"),children:[o.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:K("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 12px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#ffffff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(I.Check,{className:"w-4 h-4"}):o.jsx(l,{className:"w-4 h-4"})}),o.jsx("span",{className:"text-[10px] font-medium text-center leading-tight line-clamp-2 px-0.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]}),!u&&o.jsx("div",{className:"flex-1 h-[1.5px] mt-5 mx-1",style:{background:d?"linear-gradient(90deg, var(--t-primary), color-mix(in srgb, var(--t-primary) 40%, transparent))":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]},s.id)})}),Ax=({steps:e,currentStep:t,onStepClick:r,className:n,forceShow:a})=>{const s=ra(),{layout:i}=s;if(!i.showStepIndicators||e.length<=1&&!a)return null;const l=i.stepIndicatorVariant??"numbers",c=i.stepIndicatorPosition??"top-center",d=i.stepIndicatorOrientation??"horizontal",u=(t+1)/e.length*100,m=e[t],p=no(m==null?void 0:m.icone)??I.CircleDot,f=o.jsx("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"color-mix(in srgb, var(--t-primary) 15%, transparent)"},children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${u}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),v=o.jsxs("div",{className:"block sm:hidden space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:o.jsx(p,{className:"w-5 h-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:(m==null?void 0:m.label)??(m==null?void 0:m.id)}),o.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),f]}),h=o.jsxs("div",{className:"hidden sm:block",children:[l==="numbers"&&o.jsx(AS,{steps:e,currentStep:t,onStepClick:r}),l==="icons"&&o.jsx(DS,{steps:e,currentStep:t,onStepClick:r}),l==="icons-labeled"&&o.jsx(RS,{steps:e,currentStep:t,position:c,orientation:d,onStepClick:r})]}),x=i.showProgressBar?o.jsx("div",{className:"hidden sm:block",children:f}):null;return d==="vertical"?o.jsxs("div",{className:K("flex gap-6 items-start",n),children:[v,o.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[h,x&&o.jsx("div",{className:"flex-1 pt-4",children:x})]})]}):o.jsxs("div",{className:K("space-y-3",n),children:[v,o.jsxs("div",{className:"hidden sm:block space-y-3",children:[h,x]})]})},PS=(e,t,r)=>{var n;const a={...t},s=r;for(const i of e.containers){for(const l of i.campos)if(a[l.nome]===void 0&&(l.initialValue!==void 0?a[l.nome]=typeof l.initialValue=="string"?wt(l.initialValue,s):l.initialValue:l.defaultValue!==void 0&&(a[l.nome]=l.defaultValue)),l.tipo===D.FIELD_ARRAY&&(n=l.subFields)!=null&&n.length){const c=a[l.nome];Array.isArray(c)&&c.length>0&&(a[l.nome]=c.map(d=>{const u={...d};for(const m of l.subFields)u[m.nome]===void 0&&(m.initialValue!==void 0?u[m.nome]=typeof m.initialValue=="string"?wt(m.initialValue,s):m.initialValue:m.defaultValue!==void 0&&(u[m.nome]=m.defaultValue));return u}))}if(i.repeatable&&i.nome){const l=a[i.nome];Array.isArray(l)&&l.length>0&&(a[i.nome]=l.map(c=>{const d={...c};for(const u of i.campos)d[u.nome]===void 0&&(u.initialValue!==void 0?d[u.nome]=typeof u.initialValue=="string"?wt(u.initialValue,s):u.initialValue:u.defaultValue!==void 0&&(d[u.nome]=u.defaultValue));return d}))}}return a},_S=({schema:e,initialValues:t={},initialStep:r=0,onSubmitStep:n,onComplete:a,template:s,formTitle:i,externalData:l={},fieldErrors:c={},uploadFile:d,deleteUploadedFile:u,cepLookup:m,resolveTermsUploadUrl:p,fieldResolvers:f,validatorMapper:v,componentMapper:h,paymentMethodOptions:x,onValuesChange:b,className:y,StepIndicator:j=Ax})=>{const[w,C]=N.useState(()=>r),[S,$]=N.useState({...t}),[k,E]=N.useState(()=>r),[T,O]=N.useState(!1),[L,A]=N.useState(null),[z,X]=N.useState({}),q=N.useRef(p);q.current=p;const Z=N.useCallback(me=>q.current(me),[]),V=!!p,M=N.useRef(u);M.current=u;const _=N.useCallback(me=>M.current(me),[]),se=!!u,U=N.useMemo(()=>JSON.stringify(l),[l]),Q=N.useMemo(()=>JSON.stringify(e.stepConfig),[e.stepConfig]),Y=N.useMemo(()=>{const me=oo(s);return e.stepConfig?{...me,layout:{...me.layout,...e.stepConfig}}:me},[s,Q]),H=N.useMemo(()=>[...e.steps].sort((me,Te)=>me.ordem-Te.ordem),[e.steps]),W=H.length,G=W>0?H[Math.min(w,W-1)]:null,ne=N.useMemo(()=>G?PS(G,S,l):{},[G,S,U]),J=N.useMemo(()=>({uploadFile:d,deleteUploadedFile:se?_:void 0,cepLookup:m,resolveTermsUploadUrl:V?Z:void 0,externalData:l,fieldResolvers:f,validatorMapper:v,fieldWarnings:z,componentMapper:h,paymentMethodOptions:x}),[d,se,_,m,Z,V,f,v,z,h,x,U]),te=N.useCallback(async me=>{if(!T){O(!0),A(null);try{const{cleaned:Te,fileIdsToDelete:ze}=bi(G,me,l);ze.length&&u&&await Promise.allSettled(ze.map(Ve=>u(Ve)));const dt={...S,...Te};if($(dt),n&&await n(w,Te),w===W-1)a&&await a(dt);else{const Ve=w+1;C(Ve),E(P=>Math.max(P,Ve))}}catch(Te){console.error("[FormRenderer] Submit error:",Te);const ze=Te instanceof Error?Te.message:"Ocorreu um erro. Tente novamente.";A(ze)}finally{O(!1)}}},[w,S,T,W,n,a,G,l,u]),ce=N.useCallback(()=>{w>0&&C(me=>me-1)},[w]);if(!G)return o.jsx(fi.Provider,{value:J,children:o.jsx(Kn,{config:Y,className:`min-h-dvh ${Y.wrapperClass??""} ${y??""}`,renderWrapper:!0,children:o.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 be=Y.layout.eventTitleStyle??"bar",Ce=(Y.layout.stepIndicatorOrientation??"horizontal")==="vertical",ve=W>=1?o.jsx(j,{steps:H.map(me=>({id:me.id,label:me.titulo,icone:me.icone})),currentStep:w,onStepClick:me=>{me!==w&&me<=k&&C(me)}}):null;return o.jsx(fi.Provider,{value:J,children:o.jsx(Kn,{config:Y,className:`min-h-dvh ${Y.wrapperClass??""} ${y??""}`,renderWrapper:!0,children:o.jsxs("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6",children:[i&&be==="bar"&&o.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:i}),i&&be==="inline"&&o.jsxs("div",{className:"text-center mb-6",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest mb-1",style:{color:"var(--t-text-muted)"},children:"Inscrição"}),o.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:i}),o.jsx("div",{className:"h-0.5 w-12 mx-auto mt-3 rounded-full",style:{background:"var(--t-primary)"}})]}),Ce?o.jsxs("div",{className:"flex gap-6 items-start",children:[o.jsx("div",{className:"hidden sm:block shrink-0 w-44 pt-1",children:ve}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"sm:hidden mb-6",children:ve}),o.jsx(eu,{stepIndex:w,totalSteps:W,step:G,defaultValues:ne,externalData:l,fieldErrors:c,isSubmitting:T,submitError:L,validatorMapper:v,onWarningsChange:X,onValuesChange:b,onSubmit:te,onBack:ce},w)]})]}):o.jsxs(o.Fragment,{children:[ve&&o.jsx("div",{className:"mb-8",children:ve}),o.jsx(eu,{stepIndex:w,totalSteps:W,step:G,defaultValues:ne,externalData:l,fieldErrors:c,isSubmitting:T,submitError:L,validatorMapper:v,onWarningsChange:X,onValuesChange:b,onSubmit:te,onBack:ce},w)]})]})})})},IS=({onFillMock:e,onClear:t})=>o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(rx,{}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Ae,{variant:"outline",size:"sm",onClick:e,children:[o.jsx(I.FlaskConical,{className:"w-3.5 h-3.5 mr-1"}),"Preencher mock"]}),o.jsxs(Ae,{variant:"ghost",size:"sm",onClick:t,children:[o.jsx(I.Eraser,{className:"w-3.5 h-3.5 mr-1"}),"Limpar"]})]})]}),OS=({onRestart:e})=>o.jsxs("div",{className:"max-w-4xl mx-auto flex flex-col items-center justify-center py-16 space-y-4",children:[o.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:o.jsx(I.PartyPopper,{className:"w-8 h-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Formulário enviado!"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Este é um preview simulado. Nenhum dado foi enviado."}),o.jsxs(Ae,{variant:"outline",onClick:e,children:[o.jsx(I.RotateCcw,{className:"w-4 h-4 mr-1"}),"Recomeçar"]})]}),FS=e=>o.jsx(Ax,{...e,forceShow:!0}),zS=async(e,t,r)=>{for(let n=20;n<=100;n+=20)await new Promise(a=>setTimeout(a,80)),r==null||r(n);return`mock-upload-${Date.now()}`},LS=async e=>({}),tu={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 MS(e){var t,r;const n=e.tipo;if(!(n==="hidden"||n==="terms"||n==="field_array"))return tu[n]!==void 0?tu[n]:(n==="select"||n==="radio"||n==="autocomplete")&&(t=e.opcoes)!=null&&t.length?e.opcoes[0].valor:n==="checkbox_group"&&(r=e.opcoes)!=null&&r.length?[e.opcoes[0].valor]:"Teste"}function VS(e){const t={};for(const r of e.steps)for(const n of r.containers)for(const a of n.campos){const s=MS(a);s!==void 0&&(t[a.nome]=s)}return t}const BS=({eventoData:e})=>{const{containers:t,configs:r,previewTemplateId:n,stepConfig:a}=gt(),s=N.useMemo(()=>yl({containers:t},r,{nome:"Preview",status:vi.RASCUNHO,template:n,stepConfig:a}),[t,r,n,a]),[i,l]=N.useState(0),[c,d]=N.useState({}),[u,m]=N.useState(!1),p=N.useCallback(()=>{d(VS(s)),l(h=>h+1),m(!1)},[s]),f=N.useCallback(()=>{d({}),l(h=>h+1),m(!1)},[]),v=N.useCallback(()=>{d({}),l(h=>h+1),m(!1)},[]);return s.steps.length===0?o.jsx("div",{className:"rounded-lg border border-dashed border-border/40 p-6 text-center text-xs text-muted-foreground/50",children:"Adicione steps, containers e campos para ver o preview ao vivo"}):u?o.jsx(OS,{onRestart:v}):o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"px-1",children:o.jsx(IS,{onFillMock:p,onClear:f})}),o.jsx(_S,{schema:s,initialValues:c,template:n,externalData:e,uploadFile:zS,cepLookup:LS,onComplete:async()=>m(!0),StepIndicator:FS},i)]})},Dx=({id:e,currentTamanho:t,inicioColuna:r,onResize:n,pushSnapshot:a})=>{const s=N.useRef(null),[i,l]=N.useState(!1),[c,d]=N.useState(null),u=N.useRef(null);N.useEffect(()=>()=>{var p;(p=u.current)==null||p.call(u)},[]);const m=N.useCallback(p=>{p.preventDefault(),p.stopPropagation(),a==null||a();const f=s.current;if(!f)return;const v=f.parentElement;if(!v)return;const h=v.getBoundingClientRect().width,x=f.getBoundingClientRect().width,b=p.clientX,y=r?13-r:12;l(!0);const j=C=>{const S=C.clientX-b,$=(x+S)/h,k=Math.max(1,Math.min(y,Math.round($*12)));d(k),n(k)},w=()=>{l(!1),d(null),u.current=null,window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",w)};u.current=()=>{l(!1),d(null),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",w)},window.addEventListener("mousemove",j),window.addEventListener("mouseup",w)},[r,n,a]);return{resizeRef:s,resizing:i,resizePreview:c,handleResizeStart:m}},US=({id:e,elementRef:t,onPositionApply:r,setPositionDrag:n,setSelected:a,pushSnapshot:s})=>{const i=N.useRef(null);return N.useEffect(()=>()=>{var l;(l=i.current)==null||l.call(i)},[]),{handlePositionMouseDown:N.useCallback(l=>{l.preventDefault(),l.stopPropagation(),s==null||s(),a(e);const c=t.current;if(!c)return;const d=c.parentElement;if(!d)return;const u=d.getBoundingClientRect(),m=u.width/12,p=c.getBoundingClientRect(),f=Math.max(1,Math.round(p.width/m)),v=p.left-u.left,h=l.clientX-p.left,x=w=>{const C=w-u.left-h,S=Math.round(C/m)+1;return Math.max(1,Math.min(13-f,S))},b=Math.max(1,Math.min(12,Math.round(v/m)+1));n({itemId:e,ghostStart:b,ghostSpan:f,cursorX:l.clientX,cursorY:l.clientY});const y=w=>{n({itemId:e,ghostStart:x(w.clientX),ghostSpan:f,cursorX:w.clientX,cursorY:w.clientY})},j=w=>{r(x(w.clientX)),n(null),i.current=null,window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",j)};i.current=()=>{n(null),window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",j)},window.addEventListener("mousemove",y),window.addEventListener("mouseup",j)},[e,t,r,n,a,s])}},fa=({id:e,container:t})=>{const{attributes:r,listeners:n,setNodeRef:a,transform:s,transition:i,isDragging:l}=Kt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{selectedId:c,setSelected:d,getConfig:u,updateConfig:m,removeItem:p,setPositionDrag:f,positionDrag:v,pushSnapshot:h}=gt(),x=u(e),b=Ah(e),y=(b==null?void 0:b.icon)||I.Type,j=c===e,w=x.tamanho||6,C=(v==null?void 0:v.itemId)===e,[S,$]=N.useState(!1),k="var(--t-primary, hsl(var(--primary)))",E=j?k:S?`color-mix(in srgb, ${k} 60%, transparent)`:`color-mix(in srgb, ${k} 25%, transparent)`,T=j?`0 0 0 2px color-mix(in srgb, ${k} 30%, transparent)`:void 0,{resizeRef:O,resizing:L,resizePreview:A,handleResizeStart:z}=Dx({id:e,currentTamanho:w,inicioColuna:x.inicioColuna,onResize:q=>m(e,{tamanho:q}),pushSnapshot:h}),{handlePositionMouseDown:X}=US({id:e,elementRef:O,onPositionApply:q=>m(e,{inicioColuna:q}),setPositionDrag:f,setSelected:d,pushSnapshot:h});return o.jsxs("div",{ref:q=>{a(q),O.current=q},onClick:q=>{q.stopPropagation(),d(e)},"data-field-id":e,onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1),className:Ut("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",L&&"ring-2 ring-blue-400/50",C&&"opacity-0 pointer-events-none"),style:{gridColumn:x.inicioColuna?`${x.inicioColuna} / span ${w}`:`span ${w}`,transform:ta.CSS.Transform.toString(s),transition:i,opacity:l?0:1,borderColor:E,boxShadow:T},children:[o.jsx("div",{onMouseDown:X,onClick:q=>q.stopPropagation(),className:"cursor-ew-resize shrink-0 p-0.5 rounded hover:bg-primary/20 transition-colors",title:"Arrastar para mudar coluna",children:o.jsx(I.ArrowLeftRight,{className:"h-3 w-3 text-primary/60"})}),o.jsx("div",{...n,...r,className:"cursor-grab shrink-0",onClick:q=>q.stopPropagation(),children:o.jsx(I.GripVertical,{className:"h-3 w-3 text-primary"})}),o.jsx(y,{className:"h-3.5 w-3.5 text-primary shrink-0"}),o.jsx("span",{className:"font-medium truncate flex-1",children:x.label}),x.condition&&o.jsx(I.Zap,{className:"h-3 w-3 text-amber-500 shrink-0"}),x.required&&o.jsx("span",{className:"text-destructive font-bold",children:"*"}),o.jsxs("span",{className:"text-[9px] text-muted-foreground shrink-0",children:[A??w,"/12"]}),o.jsx("button",{onClick:q=>{q.stopPropagation(),p(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:S?1:0},children:o.jsx(I.Trash2,{className:"h-3 w-3 text-destructive"})}),o.jsx("div",{className:"absolute left-2 -bottom-0.5 font-mono truncate max-w-[90%] pointer-events-none text-[8px] text-muted-foreground/30",children:e}),o.jsx("div",{"data-resize":!0,onMouseDown:z,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-primary/20 transition-colors flex items-center justify-center",children:o.jsx(I.GripHorizontal,{className:"h-3 w-3 text-primary/40 rotate-90"})})]})},HS=({id:e,container:t})=>{var r;const{attributes:n,listeners:a,setNodeRef:s,transform:i,transition:l,isDragging:c}=Kt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{setNodeRef:d,isOver:u}=Xt.useDroppable({id:`zone-${e}`}),{selectedId:m,setSelected:p,getConfig:f,removeItem:v,moveItem:h,containers:x}=gt(),b=f(e),y=(((r=x[e])==null?void 0:r.children)??[]).filter(C=>qe(C)==="field"),j=m===e,w=b.tamanho||12;return o.jsxs("div",{ref:s,onClick:C=>{C.stopPropagation(),p(e)},className:Ut("group/fa relative rounded-lg border overflow-hidden transition-all",c&&"opacity-0 pointer-events-none",j?"border-amber-500 ring-2 ring-amber-500/20 shadow-lg":"border-amber-500/30 hover:border-amber-500/55"),style:{gridColumn:b.inicioColuna?`${b.inicioColuna} / span ${w}`:`span ${w}`,transform:ta.CSS.Transform.toString(i),transition:l},children:[o.jsxs("div",{className:Ut("flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",j?"bg-amber-500/15 border-amber-500/30":"bg-amber-500/10 border-amber-500/20"),children:[o.jsx("div",{...a,...n,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-amber-500/20 transition-colors",onClick:C=>C.stopPropagation(),children:o.jsx(I.GripVertical,{className:"h-3.5 w-3.5 text-amber-500"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:C=>{C.stopPropagation(),h(e,"up")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(I.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})}),o.jsx("button",{onClick:C=>{C.stopPropagation(),h(e,"down")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(I.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})})]}),o.jsx(I.List,{className:"h-3.5 w-3.5 text-amber-500 shrink-0"}),o.jsx("span",{className:"text-xs font-semibold truncate flex-1 text-amber-700 dark:text-amber-300",children:b.label}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-amber-500/10 px-1.5 rounded",children:[b.itemLabel||"Item"," · ",y.length," campo",y.length!==1?"s":""]}),o.jsx("button",{onClick:C=>{C.stopPropagation(),v(e)},className:"opacity-0 group-hover/fa:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",children:o.jsx(I.Trash2,{className:"h-3 w-3 text-destructive"})})]}),o.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),o.jsxs("div",{ref:d,className:Ut("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",u?"bg-amber-500/10 ring-2 ring-inset ring-amber-500/40":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[y.length===0&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),o.jsx(Kt.SortableContext,{items:y,strategy:Kt.rectSortingStrategy,children:y.map(C=>o.jsx(fa,{id:C,container:e},C))})]})]})},ru=5,WS=({id:e,elementRef:t,tamanho:r,inicioColuna:n,onPositionApply:a,setPositionDrag:s,setSelected:i,reorderStrategy:l})=>{const c=N.useRef({inicioColuna:n,tamanho:r});c.current={inicioColuna:n,tamanho:r};const d=N.useRef(null);return N.useEffect(()=>()=>{var u;(u=d.current)==null||u.call(d)},[]),{handleGripMouseDown:N.useCallback(u=>{u.preventDefault(),u.stopPropagation(),i(e);const m=u.clientX,p=u.clientY;let f=!1;const v=()=>{d.current=null,window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",x)},h=j=>{const w=Math.abs(j.clientX-m),C=Math.abs(j.clientY-p);w<ru&&C<ru||(f=!0,v(),w>=C?b(j):y(j))},x=()=>{f||v()};window.addEventListener("mousemove",h),window.addEventListener("mouseup",x),d.current=v;const b=j=>{const w=t.current;if(!w)return;const C=w.parentElement;if(!C)return;const S=C.getBoundingClientRect(),$=S.width/12,{tamanho:k}=c.current,E=w.getBoundingClientRect(),T=E.left-S.left,O=Math.max(1,Math.min(12,Math.round(T/$)+1)),L=E.left;s({itemId:e,ghostStart:O,ghostSpan:k,cursorX:j.clientX,cursorY:j.clientY});const A=q=>{const Z=q-L,V=Math.round(Z/$)+1;return Math.max(1,Math.min(13-k,V))};s({itemId:e,ghostStart:A(j.clientX),ghostSpan:k,cursorX:j.clientX,cursorY:j.clientY});const z=q=>{s({itemId:e,ghostStart:A(q.clientX),ghostSpan:k,cursorX:q.clientX,cursorY:q.clientY})},X=q=>{a(A(q.clientX)),s(null),d.current=null,window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",X)};window.addEventListener("mousemove",z),window.addEventListener("mouseup",X),d.current=()=>{s(null),window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",X)}},y=j=>{const w=l,C=t.current;if(!C)return;const S=C.parentElement;if(!S)return;const $=w.dataAttribute||"data-container-id";w.pushSnapshot(),w.setReorderDrag({draggingId:e});let k=j.clientY;const E=O=>{const L=Array.from(S.children).filter(A=>A!==C&&A.getAttribute($));for(const A of L){const z=A.getBoundingClientRect(),X=z.top+z.height/2;if(O.clientY<X&&O.clientY>z.top&&O.clientY<k){w.moveItemNoSnapshot(e,"up"),k=O.clientY;break}else if(O.clientY>X&&O.clientY<z.bottom&&O.clientY>k){w.moveItemNoSnapshot(e,"down"),k=O.clientY;break}}},T=()=>{w.setReorderDrag(null),d.current=null,window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",T)};window.addEventListener("mousemove",E),window.addEventListener("mouseup",T),d.current=()=>{w.setReorderDrag(null),window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",T)}}},[e,t,a,s,i,l])}},Ll=({showGuides:e,positionDrag:t})=>!e&&!t?null:o.jsxs(o.Fragment,{children:[e&&o.jsx("div",{className:"absolute inset-0 pointer-events-none z-10",style:{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",padding:"inherit",gap:"inherit"},children:Array.from({length:12},(r,n)=>o.jsx("div",{className:"border border-dashed border-muted-foreground/20 rounded-sm flex items-end justify-center pb-1",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/40 font-mono",children:n+1})},n))}),t&&o.jsx("div",{className:"absolute pointer-events-none z-20 rounded-lg border-2 border-dashed border-destructive/60 bg-destructive/10",style:{top:"12px",bottom:"12px",left:`calc(${(t.ghostStart-1)/12*100}% + 12px)`,width:`calc(${t.ghostSpan/12*100}% - 8px)`,transition:"left 0.1s ease-out, width 0.1s ease-out"},children:o.jsxs("div",{className:"absolute -top-5 left-1/2 -translate-x-1/2 bg-destructive text-destructive-foreground text-[10px] font-bold px-2 py-0.5 rounded whitespace-nowrap",children:[t.ghostStart," →"," ",t.ghostStart+t.ghostSpan-1]})})]}),Ml=({id:e,container:t})=>{var r;const{setNodeRef:n,isOver:a}=Xt.useDroppable({id:`zone-${e}`}),{selectedId:s,setSelected:i,getConfig:l,updateConfig:c,removeItem:d,moveItem:u,moveItemNoSnapshot:m,setPositionDrag:p,positionDrag:f,reorderDrag:v,setReorderDrag:h,pushSnapshot:x,containers:b}=gt(),y=l(e),j=((r=b[e])==null?void 0:r.children)??[],w=j.filter(Y=>qe(Y)==="field"),C=s===e,S=y.tamanho||12,$=(f==null?void 0:f.itemId)===e,k=(v==null?void 0:v.draggingId)===e,E=f&&j.includes(f.itemId),T=s&&j.includes(s)&&qe(s)==="field",[O,L]=N.useState(!1),A="var(--t-primary, hsl(var(--primary)))",z=C?A:O?"rgba(59,130,246,0.55)":"rgba(59,130,246,0.3)",X=C?`color-mix(in srgb, ${A} 15%, transparent)`:O?"rgba(59,130,246,0.12)":"rgba(59,130,246,0.07)",q=C?`color-mix(in srgb, ${A} 30%, transparent)`:O?"rgba(59,130,246,0.28)":"rgba(59,130,246,0.18)",Z=C?`0 0 0 3px color-mix(in srgb, ${A} 20%, transparent)`:O?"0 0 0 2px rgba(59,130,246,0.25)":void 0,{resizeRef:V,resizing:M,resizePreview:_,handleResizeStart:se}=Dx({id:e,currentTamanho:S,inicioColuna:y.inicioColuna,onResize:Y=>c(e,{tamanho:Y}),pushSnapshot:x}),U=N.useMemo(()=>({kind:"custom",moveItemNoSnapshot:m,pushSnapshot:x,setReorderDrag:h,dataAttribute:"data-container-id"}),[m,x,h]),{handleGripMouseDown:Q}=WS({id:e,elementRef:V,tamanho:S,inicioColuna:y.inicioColuna||1,onPositionApply:Y=>c(e,{inicioColuna:Y}),setPositionDrag:p,setSelected:i,reorderStrategy:U});return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:Y=>{V.current=Y},onClick:Y=>{Y.stopPropagation(),i(e)},onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),className:Ut("relative rounded-lg border overflow-hidden transition-all",M&&"ring-2 ring-blue-400/50",$&&"opacity-0 pointer-events-none",k&&"opacity-50"),"data-container-id":e,style:{gridColumn:y.inicioColuna?`${y.inicioColuna} / span ${S}`:`span ${S}`,minWidth:"80px",borderColor:z,boxShadow:Z},children:[o.jsxs("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",style:{backgroundColor:X,borderColor:q},children:[o.jsx("div",{"data-grip":!0,onMouseDown:Q,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-primary/20 transition-colors",children:o.jsx(I.GripVertical,{className:"h-3.5 w-3.5 text-blue-500"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:Y=>{Y.stopPropagation(),u(e,"up")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(I.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})}),o.jsx("button",{onClick:Y=>{Y.stopPropagation(),u(e,"down")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(I.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})})]}),o.jsx(I.BoxSelect,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"}),o.jsx("span",{className:Ut("text-xs font-semibold truncate flex-1",y.showLabel===!1?"text-blue-500/50 italic":"text-blue-700 dark:text-blue-300"),children:y.label}),y.showAsCard&&o.jsx(I.SquareStack,{className:"h-3 w-3 text-blue-400 shrink-0"}),y.showLabel===!1&&o.jsx(I.EyeOff,{className:"h-3 w-3 text-muted-foreground/50 shrink-0"}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-blue-500/10 px-1.5 rounded",children:[_??S,"/12"]}),o.jsx("button",{onClick:Y=>{Y.stopPropagation(),d(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:O?1:0},children:o.jsx(I.Trash2,{className:"h-3 w-3 text-destructive"})})]}),o.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),o.jsxs("div",{ref:n,className:Ut("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",a?"bg-primary/15 ring-2 ring-inset ring-primary/50":(E||T)&&"bg-muted/30"),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[o.jsx(Ll,{showGuides:!!E||!!T,positionDrag:E?f:null}),j.length===0&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),o.jsx(Kt.SortableContext,{items:w,strategy:Kt.rectSortingStrategy,children:j.filter(Y=>qe(Y)==="field").map(Y=>l(Y).fieldType==="field_array"?o.jsx(HS,{id:Y,container:e},Y):o.jsx(fa,{id:Y,container:e},Y))})]}),o.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:o.jsx(I.GripHorizontal,{className:"h-3 w-3 text-blue-500/40 rotate-90"})})]}),$&&f&&xi.createPortal(o.jsxs("div",{style:{position:"fixed",left:f.cursorX+14,top:f.cursorY-18,zIndex:9999,pointerEvents:"none"},className:"flex items-center gap-1 bg-foreground text-background text-[10px] font-mono px-2 py-0.5 rounded shadow-xl border border-border/20",children:[o.jsx(I.BoxSelect,{className:"h-2.5 w-2.5"}),"col ",f.ghostStart,"–",f.ghostStart+f.ghostSpan-1]}),document.body)," "]})},Rx=({id:e,container:t,index:r})=>{var n;const{attributes:a,listeners:s,setNodeRef:i,transform:l,transition:c,isDragging:d}=Kt.useSortable({id:e,data:{isCanvasItem:!0,type:"step",id:e}}),{setNodeRef:u,isOver:m}=Xt.useDroppable({id:`zone-${e}`}),{selectedId:p,setSelected:f,getConfig:v,removeItem:h,containers:x,positionDrag:b}=gt(),y=v(e),j=((n=x[e])==null?void 0:n.children)??[],w=p===e,C=b&&j.includes(b.itemId),[S,$]=N.useState(!1),k="var(--t-primary, hsl(var(--primary)))",E=w?k:S?`color-mix(in srgb, ${k} 60%, transparent)`:`color-mix(in srgb, ${k} 25%, transparent)`,T=w?`color-mix(in srgb, ${k} 14%, transparent)`:S?`color-mix(in srgb, ${k} 10%, transparent)`:`color-mix(in srgb, ${k} 6%, transparent)`,O=w?`color-mix(in srgb, ${k} 28%, transparent)`:`color-mix(in srgb, ${k} 15%, transparent)`,L=w?`0 0 0 3px color-mix(in srgb, ${k} 20%, transparent)`:void 0,A={transform:ta.CSS.Transform.toString(l),transition:c,opacity:d?0:1};return o.jsxs("div",{ref:i,style:{...A,borderWidth:"2px",borderStyle:"solid",borderColor:E,boxShadow:L},onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1),onClick:z=>{z.stopPropagation(),f(e)},className:"group/step rounded-xl overflow-hidden transition-all",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2",style:{backgroundColor:T,borderColor:O},children:[o.jsx("div",{...s,...a,className:"cursor-grab shrink-0",onClick:z=>z.stopPropagation(),children:o.jsx(I.GripVertical,{className:"h-3.5 w-3.5 text-primary"})}),o.jsx(I.Layers,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{className:"text-sm font-bold truncate flex-1 text-primary",children:["Step ",r+1," — ",y.label]}),y.description&&o.jsx("span",{className:"text-[10px] text-muted-foreground truncate hidden md:block",children:y.description}),o.jsx("button",{onClick:z=>{z.stopPropagation(),h(e)},className:"transition-opacity shrink-0 p-1 rounded hover:bg-destructive/10",style:{opacity:S?1:0},children:o.jsx(I.Trash2,{className:"h-3.5 w-3.5 text-destructive"})})]}),o.jsxs("div",{ref:u,className:Ut("relative p-3 min-h-[80px] gap-2 items-start transition-all duration-150",m?"bg-blue-500/20 ring-2 ring-inset ring-blue-400/70 shadow-[inset_0_0_0_2px_theme(colors.blue.400/50%)]":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content",backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.15) 1px, transparent 1px)",backgroundSize:"16px 16px"},children:[o.jsx(Ll,{showGuides:!!C,positionDrag:C?b:null}),j.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground/50 text-center py-6 italic w-full",style:{gridColumn:"span 12"},children:"Arraste containers aqui"}),j.map(z=>qe(z)==="container"?o.jsx(Ml,{id:z,container:e},z):o.jsx(fa,{id:z,container:e},z))]})]})},qS=()=>{var e;const{containers:t,setSelected:r}=gt(),n=((e=t.root)==null?void 0:e.children)??[],a=n.filter(l=>qe(l)==="step"),{setNodeRef:s,isOver:i}=Xt.useDroppable({id:"root"});return o.jsxs("div",{ref:s,onClick:()=>r(null),className:`min-h-[500px] rounded-xl border p-4 space-y-4 transition-all duration-150 ${i?"bg-primary/10 border-primary/60 ring-2 ring-primary/30 shadow-[0_0_0_4px_theme(colors.primary/10%)]":"border-border/40"}`,style:{backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.12) 1px, transparent 1px)",backgroundSize:"20px 20px",backgroundColor:i?void 0:"hsl(var(--muted) / 0.3)"},children:[n.length===0&&o.jsx("div",{className:"flex items-center justify-center h-[400px]",children:o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx(I.Layers,{className:"h-10 w-10 text-muted-foreground/30 mx-auto"}),o.jsxs("p",{className:"text-sm text-muted-foreground/50",children:["Arraste ",o.jsx("strong",{children:"Steps"})," da paleta para cá"]})]})}),o.jsx(Kt.SortableContext,{items:a,strategy:Kt.verticalListSortingStrategy,children:n.map((l,c)=>{const d=qe(l);return d==="step"?o.jsx(Rx,{id:l,container:"root",index:c},l):d==="container"?o.jsx(Ml,{id:l,container:"root"},l):o.jsx(fa,{id:l,container:"root"},l)})})]})},GS={personal:"Pessoal",address:"Endereço",health:"Saúde",event:"Evento",payment:"Pagamento",emergency:"Emergência"},XS={texto:"Texto",selecao:"Seleção",range:"Numérico / Visual",data:"Data e Hora",contato:"Contato / Endereço",outros:"Arquivo / Outros"},ZS=()=>{const e=Ir.reduce((t,r)=>{const n=r.group??"outros";return t[n]||(t[n]=[]),t[n].push(r),t},{});return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Estrutura"}),vl.map(t=>o.jsx(nu,{component:t.component,label:t.label,icon:t.icon,color:t.color},t.component))]}),Object.entries(e).map(([t,r])=>o.jsx(Fs,{label:XS[t]??t,children:r.map(n=>o.jsx(nu,{component:n.component,label:n.label,icon:n.icon,color:"border-border"},n.component))},t)),o.jsx(Fs,{label:"Blocos pré-configurados",defaultOpen:!1,children:so.map(t=>o.jsx(KS,{block:t},t.id))}),o.jsx(Fs,{label:"Blocos de steps",defaultOpen:!1,children:ji.map(t=>o.jsx(YS,{block:t},t.id))})]})},Fs=({label:e,children:t,defaultOpen:r=!0})=>{const[n,a]=N.useState(r);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("button",{type:"button",onClick:()=>a(s=>!s),className:"flex w-full items-center justify-between text-xs font-semibold text-muted-foreground uppercase tracking-wide hover:text-foreground transition-colors",children:[e,o.jsx(I.ChevronDown,{className:`h-3.5 w-3.5 transition-transform ${n?"":"-rotate-90"}`})]}),n&&o.jsx("div",{className:"space-y-1.5",children:t})]})},nu=({component:e,label:t,icon:r,color:n})=>{const{attributes:a,listeners:s,setNodeRef:i,transform:l,isDragging:c}=Xt.useDraggable({id:`palette-${e}`,data:{isPaletteItem:!0,componentType:e}});return o.jsxs("div",{ref:i,...s,...a,className:`cursor-grab flex items-center gap-2 rounded-lg border px-3 py-2 select-none hover:bg-accent transition-colors ${n} ${c?"opacity-50":""}`,style:{transform:c?void 0:ta.CSS.Translate.toString(l)},children:[o.jsx(I.GripVertical,{className:"h-4 w-4 text-muted-foreground"}),o.jsx(r,{className:"h-4 w-4"}),o.jsx("span",{className:"text-sm font-medium",children:t})]})},KS=({block:e})=>{const{attributes:t,listeners:r,setNodeRef:n,transform:a,isDragging:s}=Xt.useDraggable({id:`preset-${e.id}`,data:{isPalettePreset:!0,presetId:e.id}}),i=e.icon?Pt[e.icon]:void 0,l=GS[e.category]??e.category;return o.jsxs("div",{ref:n,...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:ta.CSS.Translate.toString(a)},title:e.description,children:[o.jsx(I.GripVertical,{className:"h-4 w-4 text-muted-foreground shrink-0"}),i?o.jsx(i,{className:"h-4 w-4 text-primary shrink-0"}):o.jsx(Pt.Blocks,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:l})]})]})},YS=({block:e})=>{const{addPresetStepBlock:t}=gt(),r=e.icon?Pt[e.icon]:void 0;return o.jsxs("button",{type:"button",onClick:()=>t(e),className:"w-full flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 cursor-pointer select-none hover:bg-amber-500/15 transition-colors text-left",title:e.description,children:[r?o.jsx(r,{className:"h-4 w-4 text-amber-400 shrink-0"}):o.jsx(Pt.Layers,{className:"h-4 w-4 text-amber-400 shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.steps.length," steps"]})]}),o.jsxs("span",{className:"text-[10px] text-amber-400 border border-amber-500/30 rounded px-1.5 py-0.5 shrink-0",children:["+",e.steps.length," steps"]})]})},JS=[...vl,...Ir],Px=({data:e})=>{const{getConfig:t}=gt();if(!e)return null;const r=e;if(r.isPalettePreset){const n=wi(r.presetId);return o.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[o.jsx(Pt.Blocks,{className:"h-3.5 w-3.5 shrink-0"}),(n==null?void 0:n.name)??"Bloco"]})}if(r.isPaletteItem){const n=JS.find(s=>s.component===r.componentType),a=n==null?void 0:n.icon;return o.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[a&&o.jsx(a,{className:"h-3.5 w-3.5 shrink-0"}),(n==null?void 0:n.label)??r.componentType]})}if(r.isCanvasItem){const{type:n,id:a}=r,s=t(a),i={step:"border-primary/80 bg-primary text-primary-foreground",container:"border-blue-600 bg-blue-600 text-white",field:"border-primary/80 bg-primary text-primary-foreground"},l={step:"Step",container:"Container",field:"Campo"};return o.jsxs("div",{className:Ut("flex items-center gap-2 rounded-full px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none min-w-[100px] max-w-[200px]",i[n]??"border-border bg-card"),children:[o.jsx(I.GripVertical,{className:"h-3 w-3 opacity-60 shrink-0"}),o.jsxs("span",{className:"opacity-70 shrink-0",children:[l[n]??n,":"]}),o.jsx("span",{className:"truncate",children:s.label||a})]})}return null},_x=({schema:e,children:t,uploadTermsPdf:r,deleteTermsPdf:n})=>{var a;const s=N.useMemo(()=>{var i;return(i=e==null?void 0:e.steps)!=null&&i.length?Ph(e):null},[e]);return o.jsx(A1,{children:o.jsx(Fh,{initialConfigs:s==null?void 0:s.configs,initialContainers:(a=s==null?void 0:s.dndState)==null?void 0:a.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:n,children:t})})},Ix=({children:e,onError:t})=>{const{containers:r,addItem:n,addPresetBlock:a,moveCanvasItem:s,reorderInContainer:i}=gt(),l=Xt.useSensors(Xt.useSensor(Xt.PointerSensor,{activationConstraint:{distance:5}})),[c,d]=N.useState(null);return o.jsxs(Xt.DndContext,{sensors:l,onDragStart:u=>{d({data:u.active.data.current})},onDragEnd:u=>{var m,p,f,v,h;d(null);const{active:x,over:b}=u;if(!b)return;const y=x.data.current,j=String(b.id);if(y!=null&&y.isPalettePreset){const{presetId:w}=y,C=wi(w);if(!C)return;if(j.startsWith("zone-")){const S=j.slice(5);a(C,S)}else j==="root"&&(t==null||t("Arraste o bloco sobre um step existente."));return}if(y!=null&&y.isPaletteItem){const{componentType:w}=y;j==="root"?n(w,"root"):j.startsWith("zone-")&&n(w,j.slice(5));return}if(y!=null&&y.isCanvasItem){const{type:w,id:C}=y;if(w==="step"){const S=((m=r.root)==null?void 0:m.children)??[],$=S.indexOf(C),k=S.indexOf(j);$!==-1&&k!==-1&&$!==k&&i("root",Kt.arrayMove(S,$,k));return}if(w==="field"){const S=y.fromContainer;let $=S,k=null;if(j.startsWith("zone-"))$=j.slice(5);else{const E=wl(j,r);E&&($=E,k=j)}if($===S&&k){const E=((p=r[S])==null?void 0:p.children)??[],T=E.indexOf(C),O=E.indexOf(k);T!==-1&&O!==-1&&T!==O&&i(S,Kt.arrayMove(E,T,O))}else if($!==S){const E=k?(((f=r[$])==null?void 0:f.children)??[]).indexOf(k):-1;s(C,S,$,E>=0?E:((h=(v=r[$])==null?void 0:v.children)==null?void 0:h.length)??0)}}}},children:[e,o.jsx(Xt.DragOverlay,{dropAnimation:null,children:c?o.jsx(Px,{data:c.data}):null})]})},QS=({schema:e,children:t,onError:r,uploadTermsPdf:n,deleteTermsPdf:a})=>o.jsx(_x,{schema:e,uploadTermsPdf:n,deleteTermsPdf:a,children:o.jsx(Ix,{onError:r,children:t})});exports.BuilderDndContext=Ix;exports.BuilderProvider=Fh;exports.BuilderShell=QS;exports.BuilderWrapper=_x;exports.CEP_REGEX=lu;exports.CPF_REGEX=su;exports.Canvas=qS;exports.ConfigPanel=aN;exports.ContainerRenderer=Nh;exports.DFCepField=gl;exports.DFCheckbox=Mo;exports.DFCheckboxGroup=cl;exports.DFDateField=Tn;exports.DFFieldArray=xh;exports.DFFileUpload=xl;exports.DFHidden=Bo;exports.DFMaskedInput=_r;exports.DFParticipationType=gh;exports.DFPaymentMethod=yh;exports.DFRadioGroup=dl;exports.DFSelect=Lo;exports.DFTerms=wh;exports.DFTextField=Tt;exports.DFTextarea=zo;exports.DefaultStepIndicator=Th;exports.DragGhost=Px;exports.DroppedContainer=Ml;exports.DroppedField=fa;exports.DroppedStep=Rx;exports.EMAIL_REGEX=cu;exports.EVENT_VARIABLES=bl;exports.FIELD_TYPES=Ir;exports.FIELD_TYPE_ICONS=Gx;exports.FIELD_TYPE_LABELS=qx;exports.FieldType=D;exports.FormRenderer=Uk;exports.FormSchemaStatus=vi;exports.FormSpy=Hk;exports.GridOverlay=Ll;exports.LivePreview=BS;exports.MaskType=au;exports.OPCOES_POR_DIA=vh;exports.OPCOES_TODOS_OS_DIAS=bh;exports.PRESET_BLOCKS=so;exports.PRESET_STEP_BLOCKS=ji;exports.Palette=ZS;exports.RendererContext=Ga;exports.STRUCTURE_TYPES=vl;exports.StepRenderer=Sh;exports.TELEFONE_REGEX=iu;exports.TEMPLATE_REGISTRY=Zr;exports.TemplateProvider=Kn;exports.builderToFormSchema=yl;exports.evaluateFieldCondition=$e;exports.findParentContainer=wl;exports.formSchemaToBuilder=Ph;exports.generateId=ou;exports.getAllTemplates=dg;exports.getFieldMeta=Wk;exports.getFieldMetaById=Ah;exports.getItemType=qe;exports.getPresetById=wi;exports.getPresetStepBlockById=hg;exports.getPresetsByCategory=fg;exports.getTemplateConfig=oo;exports.interpolate=xt;exports.interpolateContainer=Fo;exports.interpolateField=sh;exports.interpolateStep=ih;exports.isDarkTemplate=uu;exports.isGlassmorphism=ug;exports.isValidCpfDigits=du;exports.makeStepResolver=ah;exports.makeStepWarnComputer=oh;exports.stripHiddenFields=bi;exports.useBuilder=gt;exports.useBuilderExport=Gk;exports.useField=Fk;exports.useFieldApi=zk;exports.useFormApi=Ok;exports.useFormState=$h;exports.useRendererContext=Cr;exports.useTemplate=ra;exports.v4Fallback=Nt;exports.validateBuilderIntegrity=_h;exports.validateStepData=yi;
79
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},qw="DialogDescriptionWarning",Gw=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${gf(qw).contentName}}.`;return g.useEffect(()=>{var n;const a=(n=e.current)==null?void 0:n.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Xw=rf,Zw=af,Kw=sf,vf=lf,bf=cf,yf=uf,wf=pf,Yw=hf;const sl=Xw,kf=Zw,Jw=Kw,jf=g.forwardRef(({className:e,...t},r)=>o.jsx(vf,{ref:r,className:Y("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}));jf.displayName=vf.displayName;const Ao=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Jw,{children:[o.jsx(jf,{}),o.jsxs(bf,{ref:n,className:Y("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,o.jsxs(Yw,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(O.X,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ao.displayName=bf.displayName;const Do=({className:e,...t})=>o.jsx("div",{className:Y("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Do.displayName="DialogHeader";const Ro=g.forwardRef(({className:e,...t},r)=>o.jsx(yf,{ref:r,className:Y("text-lg font-semibold leading-none tracking-tight",e),...t}));Ro.displayName=yf.displayName;const Cf=g.forwardRef(({className:e,...t},r)=>o.jsx(wf,{ref:r,className:Y("text-sm text-muted-foreground",e),...t}));Cf.displayName=wf.displayName;var Po="Popover",[Nf]=_t(Po,[_n]),da=_n(),[Qw,Vr]=Nf(Po),Sf=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:a,onOpenChange:s,modal:i=!1}=e,l=da(t),c=g.useRef(null),[d,u]=g.useState(!1),[m,p]=cr({prop:n,defaultProp:a??!1,onChange:s,caller:Po});return o.jsx(Xi,{...l,children:o.jsx(Qw,{scope:t,contentId:yr(),triggerRef:c,open:m,onOpenChange:p,onOpenToggle:g.useCallback(()=>p(f=>!f),[p]),hasCustomAnchor:d,onCustomAnchorAdd:g.useCallback(()=>u(!0),[]),onCustomAnchorRemove:g.useCallback(()=>u(!1),[]),modal:i,children:r})})};Sf.displayName=Po;var $f="PopoverAnchor",e1=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Vr($f,r),s=da(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=a;return g.useEffect(()=>(i(),()=>l()),[i,l]),o.jsx(yo,{...s,...n,ref:t})});e1.displayName=$f;var Ef="PopoverTrigger",Tf=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Vr(Ef,r),s=da(r),i=je(t,a.triggerRef),l=o.jsx(we.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":_f(a.open),...n,ref:i,onClick:xe(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?l:o.jsx(yo,{asChild:!0,...s,children:l})});Tf.displayName=Ef;var il="PopoverPortal",[t1,r1]=Nf(il,{forceMount:void 0}),Af=e=>{const{__scopePopover:t,forceMount:r,children:n,container:a}=e,s=Vr(il,t);return o.jsx(t1,{scope:t,forceMount:r,children:o.jsx(It,{present:r||s.open,children:o.jsx(wo,{asChild:!0,container:a,children:n})})})};Af.displayName=il;var Sn="PopoverContent",Df=g.forwardRef((e,t)=>{const r=r1(Sn,e.__scopePopover),{forceMount:n=r.forceMount,...a}=e,s=Vr(Sn,e.__scopePopover);return o.jsx(It,{present:n||s.open,children:s.modal?o.jsx(a1,{...a,ref:t}):o.jsx(o1,{...a,ref:t})})});Df.displayName=Sn;var n1=Cn("PopoverContent.RemoveScroll"),a1=g.forwardRef((e,t)=>{const r=Vr(Sn,e.__scopePopover),n=g.useRef(null),a=je(t,n),s=g.useRef(!1);return g.useEffect(()=>{const i=n.current;if(i)return Yi(i)},[]),o.jsx(jo,{as:n1,allowPinchZoom:!0,children:o.jsx(Rf,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xe(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),s.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:xe(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:xe(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),o1=g.forwardRef((e,t)=>{const r=Vr(Sn,e.__scopePopover),n=g.useRef(!1),a=g.useRef(!1);return o.jsx(Rf,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:s=>{var i,l;(i=e.onInteractOutside)==null||i.call(e,s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=s.target;(l=r.triggerRef.current)!=null&&l.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),Rf=g.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...m}=e,p=Vr(Sn,r),f=da(r);return zi(),o.jsx(ho,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:o.jsx(la,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),children:o.jsx(Zi,{"data-state":_f(p.open),role:"dialog",id:p.contentId,...f,...m,ref:t,style:{...m.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)"}})})})}),Pf="PopoverClose",s1=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=Vr(Pf,r);return o.jsx(we.button,{type:"button",...n,ref:t,onClick:xe(e.onClick,()=>a.onOpenChange(!1))})});s1.displayName=Pf;var i1="PopoverArrow",l1=g.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,a=da(r);return o.jsx(Ki,{...a,...n,ref:t})});l1.displayName=i1;function _f(e){return e?"open":"closed"}var c1=Sf,d1=Tf,u1=Af,If=Df;const _o=c1,Io=d1,ua=g.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},a)=>o.jsx(u1,{children:o.jsx(If,{ref:a,align:t,sideOffset:r,className:Y("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),...n})}));ua.displayName=If.displayName;var[Oo]=_t("Tooltip",[_n]),Fo=_n(),Of="TooltipProvider",m1=700,oi="tooltip.open",[p1,ll]=Oo(Of),Ff=e=>{const{__scopeTooltip:t,delayDuration:r=m1,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:s}=e,i=g.useRef(!0),l=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),o.jsx(p1,{scope:t,isOpenDelayedRef:i,delayDuration:r,onOpen:g.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,n)},[n]),isPointerInTransitRef:l,onPointerInTransitChange:g.useCallback(d=>{l.current=d},[]),disableHoverableContent:a,children:s})};Ff.displayName=Of;var ea="Tooltip",[f1,Lo]=Oo(ea),Lf=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:a,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=ll(ea,e.__scopeTooltip),d=Fo(t),[u,m]=g.useState(null),p=yr(),f=g.useRef(0),v=i??c.disableHoverableContent,h=l??c.delayDuration,x=g.useRef(!1),[y,b]=cr({prop:n,defaultProp:a??!1,onChange:A=>{A?(c.onOpen(),document.dispatchEvent(new CustomEvent(oi))):c.onClose(),s==null||s(A)},caller:ea}),k=g.useMemo(()=>y?x.current?"delayed-open":"instant-open":"closed",[y]),w=g.useCallback(()=>{window.clearTimeout(f.current),f.current=0,x.current=!1,b(!0)},[b]),N=g.useCallback(()=>{window.clearTimeout(f.current),f.current=0,b(!1)},[b]),S=g.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{x.current=!0,b(!0),f.current=0},h)},[h,b]);return g.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),o.jsx(Xi,{...d,children:o.jsx(f1,{scope:t,contentId:p,open:y,stateAttribute:k,trigger:u,onTriggerChange:m,onTriggerEnter:g.useCallback(()=>{c.isOpenDelayedRef.current?S():w()},[c.isOpenDelayedRef,S,w]),onTriggerLeave:g.useCallback(()=>{v?N():(window.clearTimeout(f.current),f.current=0)},[N,v]),onOpen:w,onClose:N,disableHoverableContent:v,children:r})})};Lf.displayName=ea;var si="TooltipTrigger",zf=g.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=Lo(si,r),s=ll(si,r),i=Fo(r),l=g.useRef(null),c=je(t,l,a.onTriggerChange),d=g.useRef(!1),u=g.useRef(!1),m=g.useCallback(()=>d.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),o.jsx(yo,{asChild:!0,...i,children:o.jsx(we.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:c,onPointerMove:xe(e.onPointerMove,p=>{p.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:xe(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:xe(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:xe(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:xe(e.onBlur,a.onClose),onClick:xe(e.onClick,a.onClose)})})});zf.displayName=si;var h1="TooltipPortal",[r$,x1]=Oo(h1,{forceMount:void 0}),$n="TooltipContent",Mf=g.forwardRef((e,t)=>{const r=x1($n,e.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...s}=e,i=Lo($n,e.__scopeTooltip);return o.jsx(It,{present:n||i.open,children:i.disableHoverableContent?o.jsx(Vf,{side:a,...s,ref:t}):o.jsx(g1,{side:a,...s,ref:t})})}),g1=g.forwardRef((e,t)=>{const r=Lo($n,e.__scopeTooltip),n=ll($n,e.__scopeTooltip),a=g.useRef(null),s=je(t,a),[i,l]=g.useState(null),{trigger:c,onClose:d}=r,u=a.current,{onPointerInTransitChange:m}=n,p=g.useCallback(()=>{l(null),m(!1)},[m]),f=g.useCallback((v,h)=>{const x=v.currentTarget,y={x:v.clientX,y:v.clientY},b=k1(y,x.getBoundingClientRect()),k=j1(y,b),w=C1(h.getBoundingClientRect()),N=S1([...k,...w]);l(N),m(!0)},[m]);return g.useEffect(()=>()=>p(),[p]),g.useEffect(()=>{if(c&&u){const v=x=>f(x,u),h=x=>f(x,c);return c.addEventListener("pointerleave",v),u.addEventListener("pointerleave",h),()=>{c.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",h)}}},[c,u,f,p]),g.useEffect(()=>{if(i){const v=h=>{const x=h.target,y={x:h.clientX,y:h.clientY},b=(c==null?void 0:c.contains(x))||(u==null?void 0:u.contains(x)),k=!N1(y,i);b?p():k&&(p(),d())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,u,i,d,p]),o.jsx(Vf,{...e,ref:s})}),[v1,b1]=Oo(ea,{isInside:!1}),y1=Pv("TooltipContent"),Vf=g.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Lo($n,r),d=Fo(r),{onClose:u}=c;return g.useEffect(()=>(document.addEventListener(oi,u),()=>document.removeEventListener(oi,u)),[u]),g.useEffect(()=>{if(c.trigger){const m=p=>{const f=p.target;f!=null&&f.contains(c.trigger)&&u()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[c.trigger,u]),o.jsx(la,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:m=>m.preventDefault(),onDismiss:u,children:o.jsxs(Zi,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(y1,{children:n}),o.jsx(v1,{scope:r,isInside:!0,children:o.jsx(Xy,{id:c.contentId,role:"tooltip",children:a||n})})]})})});Mf.displayName=$n;var Bf="TooltipArrow",w1=g.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,a=Fo(r);return b1(Bf,r).isInside?null:o.jsx(Ki,{...a,...n,ref:t})});w1.displayName=Bf;function k1(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(r,n,a,s)){case s:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function j1(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function C1(e){const{top:t,right:r,bottom:n,left:a}=e;return[{x:a,y:t},{x:r,y:t},{x:r,y:n},{x:a,y:n}]}function N1(e,t){const{x:r,y:n}=e;let a=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],d=l.x,u=l.y,m=c.x,p=c.y;u>n!=p>n&&r<(m-d)*(n-u)/(p-u)+d&&(a=!a)}return a}function S1(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),$1(t)}function $1(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const a=e[n];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(a.y-i.y)>=(s.y-i.y)*(a.x-i.x))t.pop();else break}t.push(a)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const a=e[n];for(;r.length>=2;){const s=r[r.length-1],i=r[r.length-2];if((s.x-i.x)*(a.y-i.y)>=(s.y-i.y)*(a.x-i.x))r.pop();else break}r.push(a)}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 E1=Ff,T1=Lf,A1=zf,Uf=Mf;const D1=E1,Hf=T1,Wf=A1,cl=g.forwardRef(({className:e,sideOffset:t=4,...r},n)=>o.jsx(Uf,{ref:n,sideOffset:t,className:Y("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}));cl.displayName=Uf.displayName;function R1(e,t){return g.useReducer((r,n)=>t[r][n]??r,e)}var dl="ScrollArea",[qf]=_t(dl),[P1,Ht]=qf(dl),Gf=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:s=600,...i}=e,[l,c]=g.useState(null),[d,u]=g.useState(null),[m,p]=g.useState(null),[f,v]=g.useState(null),[h,x]=g.useState(null),[y,b]=g.useState(0),[k,w]=g.useState(0),[N,S]=g.useState(!1),[A,C]=g.useState(!1),E=je(t,I=>c(I)),$=sa(a);return o.jsx(P1,{scope:r,type:n,dir:$,scrollHideDelay:s,scrollArea:l,viewport:d,onViewportChange:u,content:m,onContentChange:p,scrollbarX:f,onScrollbarXChange:v,scrollbarXEnabled:N,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:x,scrollbarYEnabled:A,onScrollbarYEnabledChange:C,onCornerWidthChange:b,onCornerHeightChange:w,children:o.jsx(we.div,{dir:$,...i,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});Gf.displayName=dl;var Xf="ScrollAreaViewport",Zf=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:a,...s}=e,i=Ht(Xf,r),l=g.useRef(null),c=je(t,l,i.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),o.jsx(we.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:o.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});Zf.displayName=Xf;var pr="ScrollAreaScrollbar",ul=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Ht(pr,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=a,l=e.orientation==="horizontal";return g.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),a.type==="hover"?o.jsx(_1,{...n,ref:t,forceMount:r}):a.type==="scroll"?o.jsx(I1,{...n,ref:t,forceMount:r}):a.type==="auto"?o.jsx(Kf,{...n,ref:t,forceMount:r}):a.type==="always"?o.jsx(ml,{...n,ref:t}):null});ul.displayName=pr;var _1=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Ht(pr,e.__scopeScrollArea),[s,i]=g.useState(!1);return g.useEffect(()=>{const l=a.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),i(!0)},u=()=>{c=window.setTimeout(()=>i(!1),a.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",u),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",u)}}},[a.scrollArea,a.scrollHideDelay]),o.jsx(It,{present:r||s,children:o.jsx(Kf,{"data-state":s?"visible":"hidden",...n,ref:t})})}),I1=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Ht(pr,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Mo(()=>c("SCROLL_END"),100),[l,c]=R1("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 g.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,a.scrollHideDelay,c]),g.useEffect(()=>{const d=a.viewport,u=s?"scrollLeft":"scrollTop";if(d){let m=d[u];const p=()=>{const f=d[u];m!==f&&(c("SCROLL"),i()),m=f};return d.addEventListener("scroll",p),()=>d.removeEventListener("scroll",p)}},[a.viewport,s,c,i]),o.jsx(It,{present:r||l!=="hidden",children:o.jsx(ml,{"data-state":l==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:xe(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:xe(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Kf=g.forwardRef((e,t)=>{const r=Ht(pr,e.__scopeScrollArea),{forceMount:n,...a}=e,[s,i]=g.useState(!1),l=e.orientation==="horizontal",c=Mo(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;i(l?d:u)}},10);return En(r.viewport,c),En(r.content,c),o.jsx(It,{present:n||s,children:o.jsx(ml,{"data-state":s?"visible":"hidden",...a,ref:t})})}),ml=g.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,a=Ht(pr,e.__scopeScrollArea),s=g.useRef(null),i=g.useRef(0),[l,c]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=th(l.viewport,l.content),u={...n,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:p=>i.current=p};function m(p,f){return V1(p,i.current,l,f)}return r==="horizontal"?o.jsx(O1,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&s.current){const p=a.viewport.scrollLeft,f=Ic(p,l,a.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:p=>{a.viewport&&(a.viewport.scrollLeft=p)},onDragScroll:p=>{a.viewport&&(a.viewport.scrollLeft=m(p,a.dir))}}):r==="vertical"?o.jsx(F1,{...u,ref:t,onThumbPositionChange:()=>{if(a.viewport&&s.current){const p=a.viewport.scrollTop,f=Ic(p,l);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:p=>{a.viewport&&(a.viewport.scrollTop=p)},onDragScroll:p=>{a.viewport&&(a.viewport.scrollTop=m(p))}}):null}),O1=g.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,s=Ht(pr,e.__scopeScrollArea),[i,l]=g.useState(),c=g.useRef(null),d=je(t,c,s.onScrollbarXChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Jf,{"data-orientation":"horizontal",...a,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":zo(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,m)=>{if(s.viewport){const p=s.viewport.scrollLeft+u.deltaX;e.onWheelScroll(p),nh(p,m)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Xa(i.paddingLeft),paddingEnd:Xa(i.paddingRight)}})}})}),F1=g.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...a}=e,s=Ht(pr,e.__scopeScrollArea),[i,l]=g.useState(),c=g.useRef(null),d=je(t,c,s.onScrollbarYChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Jf,{"data-orientation":"vertical",...a,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":zo(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,m)=>{if(s.viewport){const p=s.viewport.scrollTop+u.deltaY;e.onWheelScroll(p),nh(p,m)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Xa(i.paddingTop),paddingEnd:Xa(i.paddingBottom)}})}})}),[L1,Yf]=qf(pr),Jf=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:u,onResize:m,...p}=e,f=Ht(pr,r),[v,h]=g.useState(null),x=je(t,E=>h(E)),y=g.useRef(null),b=g.useRef(""),k=f.viewport,w=n.content-n.viewport,N=pt(u),S=pt(c),A=Mo(m,10);function C(E){if(y.current){const $=E.clientX-y.current.left,I=E.clientY-y.current.top;d({x:$,y:I})}}return g.useEffect(()=>{const E=$=>{const I=$.target;v!=null&&v.contains(I)&&N($,w)};return document.addEventListener("wheel",E,{passive:!1}),()=>document.removeEventListener("wheel",E,{passive:!1})},[k,v,w,N]),g.useEffect(S,[n,S]),En(v,A),En(f.content,A),o.jsx(L1,{scope:r,scrollbar:v,hasThumb:a,onThumbChange:pt(s),onThumbPointerUp:pt(i),onThumbPositionChange:S,onThumbPointerDown:pt(l),children:o.jsx(we.div,{...p,ref:x,style:{position:"absolute",...p.style},onPointerDown:xe(e.onPointerDown,E=>{E.button===0&&(E.target.setPointerCapture(E.pointerId),y.current=v.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),C(E))}),onPointerMove:xe(e.onPointerMove,C),onPointerUp:xe(e.onPointerUp,E=>{const $=E.target;$.hasPointerCapture(E.pointerId)&&$.releasePointerCapture(E.pointerId),document.body.style.webkitUserSelect=b.current,f.viewport&&(f.viewport.style.scrollBehavior=""),y.current=null})})})}),Ga="ScrollAreaThumb",Qf=g.forwardRef((e,t)=>{const{forceMount:r,...n}=e,a=Yf(Ga,e.__scopeScrollArea);return o.jsx(It,{present:r||a.hasThumb,children:o.jsx(z1,{ref:t,...n})})}),z1=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...a}=e,s=Ht(Ga,r),i=Yf(Ga,r),{onThumbPositionChange:l}=i,c=je(t,m=>i.onThumbChange(m)),d=g.useRef(void 0),u=Mo(()=>{d.current&&(d.current(),d.current=void 0)},100);return g.useEffect(()=>{const m=s.viewport;if(m){const p=()=>{if(u(),!d.current){const f=B1(m,l);d.current=f,l()}};return l(),m.addEventListener("scroll",p),()=>m.removeEventListener("scroll",p)}},[s.viewport,u,l]),o.jsx(we.div,{"data-state":i.hasThumb?"visible":"hidden",...a,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:xe(e.onPointerDownCapture,m=>{const p=m.target.getBoundingClientRect(),f=m.clientX-p.left,v=m.clientY-p.top;i.onThumbPointerDown({x:f,y:v})}),onPointerUp:xe(e.onPointerUp,i.onThumbPointerUp)})});Qf.displayName=Ga;var pl="ScrollAreaCorner",eh=g.forwardRef((e,t)=>{const r=Ht(pl,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?o.jsx(M1,{...e,ref:t}):null});eh.displayName=pl;var M1=g.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,a=Ht(pl,r),[s,i]=g.useState(0),[l,c]=g.useState(0),d=!!(s&&l);return En(a.scrollbarX,()=>{var u;const m=((u=a.scrollbarX)==null?void 0:u.offsetHeight)||0;a.onCornerHeightChange(m),c(m)}),En(a.scrollbarY,()=>{var u;const m=((u=a.scrollbarY)==null?void 0:u.offsetWidth)||0;a.onCornerWidthChange(m),i(m)}),d?o.jsx(we.div,{...n,ref:t,style:{width:s,height:l,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Xa(e){return e?parseInt(e,10):0}function th(e,t){const r=e/t;return isNaN(r)?0:r}function zo(e){const t=th(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function V1(e,t,r,n="ltr"){const a=zo(r),s=a/2,i=t||s,l=a-i,c=r.scrollbar.paddingStart+i,d=r.scrollbar.size-r.scrollbar.paddingEnd-l,u=r.content-r.viewport,m=n==="ltr"?[0,u]:[u*-1,0];return rh([c,d],m)(e)}function Ic(e,t,r="ltr"){const n=zo(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-a,i=t.content-t.viewport,l=s-n,c=r==="ltr"?[0,i]:[i*-1,0],d=Jn(e,c);return rh([0,i],[0,l])(d)}function rh(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function nh(e,t){return e>0&&e<t}var B1=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function a(){const s={left:e.scrollLeft,top:e.scrollTop},i=r.left!==s.left,l=r.top!==s.top;(i||l)&&t(),r=s,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function Mo(e,t){const r=pt(e),n=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(n.current),[]),g.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function En(e,t){const r=pt(t);lt(()=>{let n=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return a.observe(e),()=>{window.cancelAnimationFrame(n),a.unobserve(e)}}},[e,r])}var ah=Gf,U1=Zf,H1=eh;const Fn=g.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(ah,{ref:n,className:Y("relative overflow-hidden",e),...r,children:[o.jsx(U1,{className:"h-full w-full rounded-[inherit]",children:t}),o.jsx(oh,{}),o.jsx(H1,{})]}));Fn.displayName=ah.displayName;const oh=g.forwardRef(({className:e,orientation:t="vertical",...r},n)=>o.jsx(ul,{ref:n,orientation:t,className:Y("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:o.jsx(Qf,{className:"relative flex-1 rounded-full bg-border"})}));oh.displayName=ul.displayName;const Oc=Object.entries(O.icons).map(([e,t])=>({name:e,kebab:e.replace(/([A-Z])/g,(r,n,a)=>a===0?n.toLowerCase():`-${n.toLowerCase()}`),component:t})),sh=({value:e,onChange:t,label:r="Ícone (Lucide)",hideLabel:n=!1,className:a})=>{const[s,i]=j.useState(!1),[l,c]=j.useState(""),d=j.useMemo(()=>iv(e),[e]),u=j.useMemo(()=>{const f=l.toLowerCase();return f?Oc.filter(v=>v.name.toLowerCase().includes(f)||v.kebab.includes(f)):Oc},[l]),m=f=>{t(f),i(!1)},p=f=>{i(f),f||c("")};return o.jsxs("div",{className:`space-y-1 ${a??""}`,children:[!n&&o.jsx(le,{className:"text-xs",children:r}),o.jsx(Te,{type:"button",variant:"outline",className:"w-full h-8 justify-start text-xs font-normal gap-2",onClick:()=>i(!0),children:d?o.jsxs(o.Fragment,{children:[j.createElement(d,{className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{className:"truncate",children:e})]}):o.jsx("span",{className:"text-muted-foreground",children:"Selecionar ícone…"})}),o.jsx(sl,{open:s,onOpenChange:p,children:o.jsxs(Ao,{className:"max-w-3xl max-h-[85vh] flex flex-col gap-0 p-0",children:[o.jsxs(Do,{className:"px-4 pt-4 pb-2 border-b",children:[o.jsx(Ro,{children:"Selecionar ícone"}),o.jsx(Cf,{children:"Pesquise e clique em um ícone da biblioteca Lucide."})]}),o.jsx("div",{className:"px-4 py-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(O.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ue,{autoFocus:!0,placeholder:"Buscar ícones…",value:l,onChange:f=>c(f.target.value),className:"pl-8 h-9 text-sm"})]})}),o.jsx(Fn,{className:"flex-1 px-4 py-2",children:o.jsxs("div",{className:"grid grid-cols-5 gap-2 sm:grid-cols-7 md:grid-cols-8 pb-2",children:[o.jsxs(Te,{type:"button",variant:e?"outline":"secondary",className:"flex flex-col items-center justify-center h-20 gap-1 p-1",onClick:()=>m(void 0),children:[o.jsx("div",{className:"h-6 w-6 rounded border-2 border-dashed border-muted-foreground/30"}),o.jsx("span",{className:"text-[10px] leading-tight text-center",children:"Nenhum"})]}),u.map(({name:f,component:v})=>o.jsxs(Te,{type:"button",variant:e===f?"secondary":"outline",className:"flex flex-col items-center justify-center h-20 gap-1 p-1 overflow-hidden",onClick:()=>m(f),children:[j.createElement(v,{size:24}),o.jsx("span",{className:"text-[9px] leading-tight text-center break-all line-clamp-2",children:f})]},f))]})})]})})]})};var W1=Object.defineProperty,q1=(e,t,r)=>t in e?W1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fc=(e,t,r)=>q1(e,typeof t!="symbol"?t+"":t,r);const Za=j.createContext({}),Cr=()=>j.useContext(Za),Lc=new Set(["__proto__","constructor","prototype"]),$a=(e,t,r)=>{const n=t.split(".");let a=e;for(let i=0;i<n.length-1;i++){const l=n[i];if(Lc.has(l))return;(a[l]==null||typeof a[l]!="object")&&(a[l]={}),a=a[l]}const s=n[n.length-1];Lc.has(s)||(a[s]=r)},xn=async(e,t,r,n,a,s)=>{for(const i of e){const l=s[i.type];if(!l)continue;const c=await l(r,n,i,a);if(c)return i.message??c}},ih=(e,t={},r={})=>async n=>{var a,s,i,l,c;const d={},{errors:u}=Ci(e,n,t);for(const p of u){const f=p.campo.replace(/\[(\d+)\]/g,".$1");$a(d,f,{type:"custom",message:p.message})}const m=[...e.containers].sort((p,f)=>p.ordem-f.ordem);for(const p of m)if(!p.repeatable&&Se(p.condicional,n,t))for(const f of p.campos){if(f.tipo===P.HIDDEN||f.isDisabled||f.isReadOnly||!Se(f.condicional,n,t))continue;if(f.tipo===P.FIELD_ARRAY){const h=Array.isArray(n[f.nome])?n[f.nome]:[];for(let x=0;x<h.length;x++){const y=h[x];for(const b of f.subFields??[]){if(b.isDisabled||b.isReadOnly||!Se(b.condicional,y,t)||!((a=b.validate)!=null&&a.length)||d[`${f.nome}.${x}.${b.nome}`])continue;const k=await xn(b.validate,b.nome,y[b.nome],y,t,r);k&&$a(d,`${f.nome}.${x}.${b.nome}`,{type:"custom",message:k})}}continue}if(f.tipo===P.SUB_FORM){const h=n[f.nome]??{};for(const x of((s=f.subSchema)==null?void 0:s.fields)??[]){if(x.isDisabled||x.isReadOnly||!((i=x.validate)!=null&&i.length)||d[`${f.nome}.${x.nome}`])continue;const y=await xn(x.validate,x.nome,h[x.nome],h,t,r);y&&$a(d,`${f.nome}.${x.nome}`,{type:"custom",message:y})}continue}if(!((l=f.validate)!=null&&l.length)||d[f.nome])continue;const v=await xn(f.validate,f.nome,n[f.nome],n,t,r);v&&(d[f.nome]={type:"custom",message:v})}for(const p of m){if(!p.repeatable||!p.nome||!Se(p.condicional,n,t))continue;const f=Array.isArray(n[p.nome])?n[p.nome]:[];for(let v=0;v<f.length;v++){const h=f[v];for(const x of p.campos){if(x.tipo===P.HIDDEN||x.isDisabled||x.isReadOnly||!Se(x.condicional,h,t)||!((c=x.validate)!=null&&c.length)||d[`${p.nome}.${v}.${x.nome}`])continue;const y=await xn(x.validate,x.nome,h[x.nome],h,t,r);y&&$a(d,`${p.nome}.${v}.${x.nome}`,{type:"custom",message:y})}}}return Object.keys(d).length>0?{values:{},errors:d}:{values:n,errors:{}}},lh=(e,t={},r={})=>async n=>{var a,s;const i={},l=[...e.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l)if(!(c.condicional&&!Se(c.condicional,n,t))){if(c.repeatable&&c.nome){const d=Array.isArray(n[c.nome])?n[c.nome]:[];for(let u=0;u<d.length;u++){const m=d[u];for(const p of[...c.campos].sort((f,v)=>f.ordem-v.ordem)){if(!((a=p.warn)!=null&&a.length)||!Se(p.condicional,m,t))continue;const f=await xn(p.warn,p.nome,m[p.nome],m,t,r);f&&(i[`${c.nome}.${u}.${p.nome}`]=f)}}continue}for(const d of[...c.campos].sort((u,m)=>u.ordem-m.ordem)){if(!((s=d.warn)!=null&&s.length)||!Se(d.condicional,n,t))continue;const u=await xn(d.warn,d.nome,n[d.nome],n,t,r);u&&(i[d.nome]=u)}}return i},G1=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,ht=(e,t)=>e?e.replace(G1,(r,n)=>t[`evento.${n}`]??t[n]??r):e??"",X1=(e,t)=>({...e,label:ht(e.label,t)}),ch=(e,t)=>{var r;return{...e,label:ht(e.label,t),placeholder:ht(e.placeholder,t),hint:ht(e.hint,t),defaultValue:typeof e.defaultValue=="string"?ht(e.defaultValue,t):e.defaultValue,opcoes:(r=e.opcoes)==null?void 0:r.map(n=>X1(n,t))}},Vo=(e,t)=>({...e,titulo:ht(e.titulo,t),descricao:ht(e.descricao,t),campos:e.campos.map(r=>ch(r,t))}),dh=(e,t)=>({...e,titulo:ht(e.titulo,t),descricao:ht(e.descricao,t),containers:e.containers.map(r=>Vo(r,t))}),uh=()=>{const e=na(),t=e.layout.containerStyle,r=e.layout.roundness??"rounded-xl",n=Y("overflow-hidden",r,t==="card"?"border":"",t==="bordered"?"border":"",t==="glassmorphism"?"backdrop-blur-sm":""),a=t==="glassmorphism"?{background:"var(--t-surface)",borderColor:"var(--t-border)",borderWidth:"1px",borderStyle:"solid"}:{},s=Y("border-b px-6 py-4",t==="flat"?"border-transparent":"");return{wrapperClass:n,wrapperStyle:a,headerClass:s,headerStyle:t==="glassmorphism"?{borderColor:"var(--t-border)"}:{},tmpl:e}},Tt=({name:e,control:t,placeholder:r,type:n="text",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=$e.useController({name:e,control:t}),d=!!c.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...l,value:l.value??"",type:n,placeholder:r,disabled:a,readOnly:s,className:Y(d&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Bo=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=$e.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsx(co,{...i,value:i.value??"",placeholder:r,disabled:n,readOnly:a,rows:3,className:Y(l.error&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Uo=({name:e,control:t,placeholder:r,options:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=$e.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(Vt,{value:l.value??"",onValueChange:d=>!s&&l.onChange(d),disabled:a||s,children:[o.jsx(Dt,{className:Y(c.error&&"border-destructive focus:ring-destructive"),onBlur:l.onBlur,children:o.jsx(Bt,{placeholder:r??"Selecione..."})}),o.jsx(Rt,{children:n.map(d=>o.jsx(Xe,{value:d.valor,disabled:d.disabled,children:d.label},d.valor))})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Ho=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=$e.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(rt,{name:i.name,checked:!!i.value,onCheckedChange:c=>!a&&i.onChange(!!c),onBlur:i.onBlur,disabled:n}),r&&o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},fl=({name:e,control:t,options:r,disabled:n})=>{var a;const{field:s,fieldState:i}=$e.useController({name:e,control:t}),l=Array.isArray(s.value)?s.value:[],c=d=>{const u=l.includes(d)?l.filter(m=>m!==d):[...l,d];s.onChange(u)};return o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex flex-col gap-2",onBlur:s.onBlur,children:r.map(d=>o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(rt,{checked:l.includes(d.valor),onCheckedChange:()=>c(d.valor),disabled:n||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},hl=({name:e,control:t,options:r,visualStyle:n="default",disabled:a})=>{var s;const{field:i,fieldState:l}=$e.useController({name:e,control:t}),c=n==="card";return o.jsxs("div",{className:"space-y-1",onBlur:i.onBlur,children:[o.jsx(Oi,{value:i.value??"",onValueChange:i.onChange,className:Y(c?"grid grid-cols-2 gap-2 sm:grid-cols-3":"flex flex-col gap-2"),children:r.map(d=>o.jsxs("label",{className:Y("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",(a||d.disabled)&&"cursor-not-allowed opacity-50"),"data-selected":i.value===d.valor?"true":void 0,children:[o.jsx(Fi,{value:d.valor,disabled:a||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},mh=e=>{const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`},Z1=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),mh(t)},K1=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),mh(t)},Tn=({name:e,control:t,isDatetime:r,disabled:n,readOnly:a,validacao:s})=>{var i;const{field:l,fieldState:c}=$e.useController({name:e,control:t}),d=r?"datetime-local":"date",u=f=>r?f+"T00:00":f,m=(s==null?void 0:s.minAge)!=null?u(Z1(s.minAge)):(s==null?void 0:s.maxDate)!=null?u(s.maxDate):void 0,p=(s==null?void 0:s.maxAge)!=null?u(K1(s.maxAge)):(s==null?void 0:s.minDate)!=null?u(s.minDate):void 0;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value??"",onChange:l.onChange,onBlur:l.onBlur,type:d,min:p,max:m,disabled:n,readOnly:a,className:Y(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})};function Y1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const ph={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};for(const[e,t]of Object.entries(ph));let zc;function J1(){if(!(typeof globalThis.TextDecoder>"u"))return zc??(zc=new globalThis.TextDecoder("utf-8"))}const An=32*1024,qt=65533;function Q1(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{const r=J1();return r?r.decode(e):tk(e)}case"utf-16le":return rk(e);case"us-ascii":case"ascii":return nk(e);case"latin1":case"iso-8859-1":return ak(e);case"windows-1252":return ok(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function xl(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function Je(e,t,r){t.push(r),t.length>=An&&xl(e,t)}function ek(e,t,r){if(r<=65535){Je(e,t,r);return}r-=65536,Je(e,t,55296+(r>>10)),Je(e,t,56320+(r&1023))}function tk(e){const t=[],r=[];let n=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(n=3);n<e.length;){const a=e[n];if(a<=127){Je(t,r,a),n++;continue}if(a<194||a>244){Je(t,r,qt),n++;continue}if(a<=223){if(n+1>=e.length){Je(t,r,qt),n++;continue}const d=e[n+1];if((d&192)!==128){Je(t,r,qt),n++;continue}const u=(a&31)<<6|d&63;Je(t,r,u),n+=2;continue}if(a<=239){if(n+2>=e.length){Je(t,r,qt),n++;continue}const d=e[n+1],u=e[n+2];if(!((d&192)===128&&(u&192)===128&&!(a===224&&d<160)&&!(a===237&&d>=160))){Je(t,r,qt),n++;continue}const m=(a&15)<<12|(d&63)<<6|u&63;Je(t,r,m),n+=3;continue}if(n+3>=e.length){Je(t,r,qt),n++;continue}const s=e[n+1],i=e[n+2],l=e[n+3];if(!((s&192)===128&&(i&192)===128&&(l&192)===128&&!(a===240&&s<144)&&!(a===244&&s>143))){Je(t,r,qt),n++;continue}const c=(a&7)<<18|(s&63)<<12|(i&63)<<6|l&63;ek(t,r,c),n+=4}return xl(t,r),t.join("")}function rk(e){const t=[],r=[],n=e.length;let a=0;for(;a+1<n;){const s=e[a]|e[a+1]<<8;if(a+=2,s>=55296&&s<=56319){if(a+1<n){const i=e[a]|e[a+1]<<8;i>=56320&&i<=57343?(Je(t,r,s),Je(t,r,i),a+=2):Je(t,r,qt)}else Je(t,r,qt);continue}if(s>=56320&&s<=57343){Je(t,r,qt);continue}Je(t,r,s)}return a<n&&Je(t,r,qt),xl(t,r),t.join("")}function nk(e){const t=[];for(let r=0;r<e.length;r+=An){const n=Math.min(e.length,r+An),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s]&127;t.push(String.fromCharCode.apply(null,a))}return t.join("")}function ak(e){const t=[];for(let r=0;r<e.length;r+=An){const n=Math.min(e.length,r+An),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s];t.push(String.fromCharCode.apply(null,a))}return t.join("")}function ok(e){const t=[];let r="";for(let n=0;n<e.length;n++){const a=e[n],s=a>=128&&a<=159?ph[a]:void 0;r+=s??String.fromCharCode(a),r.length>=An&&(t.push(r),r="")}return r&&t.push(r),t.join("")}function kt(e){return new DataView(e.buffer,e.byteOffset)}const sk={len:1,get(e,t){return kt(e).getUint8(t)},put(e,t,r){return kt(e).setUint8(t,r),t+1}},We={len:2,get(e,t){return kt(e).getUint16(t,!0)},put(e,t,r){return kt(e).setUint16(t,r,!0),t+2}},mn={len:2,get(e,t){return kt(e).getUint16(t)},put(e,t,r){return kt(e).setUint16(t,r),t+2}},Ze={len:4,get(e,t){return kt(e).getUint32(t,!0)},put(e,t,r){return kt(e).setUint32(t,r,!0),t+4}},Mc={len:4,get(e,t){return kt(e).getUint32(t)},put(e,t,r){return kt(e).setUint32(t,r),t+4}},ik={len:4,get(e,t){return kt(e).getInt32(t)},put(e,t,r){return kt(e).setInt32(t,r),t+4}},lk={len:8,get(e,t){return kt(e).getBigUint64(t,!0)},put(e,t,r){return kt(e).setBigUint64(t,r,!0),t+8}};let gr=class{constructor(t,r){this.len=t,this.encoding=r}get(t,r=0){const n=t.subarray(r,r+this.len);return Q1(n,this.encoding)}};const ck="End-Of-Stream";let et=class extends Error{constructor(){super(ck),this.name="EndOfStreamError"}},dk=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}},fh=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,r=!1){const n=await this.read(t,r);return this.peekQueue.push(t.subarray(0,n)),n}async read(t,r=!1){if(t.length===0)return 0;let n=this.readFromPeekBuffer(t);if(this.endOfStream||(n+=await this.readRemainderFromStream(t.subarray(n),r)),n===0&&!r)throw new et;return n}readFromPeekBuffer(t){let r=t.length,n=0;for(;this.peekQueue.length>0&&r>0;){const a=this.peekQueue.pop();if(!a)throw new Error("peekData should be defined");const s=Math.min(a.length,r);t.set(a.subarray(0,s),n),n+=s,r-=s,s<a.length&&this.peekQueue.push(a.subarray(s))}return n}async readRemainderFromStream(t,r){let n=0;for(;n<t.length&&!this.endOfStream;){if(this.interrupted)throw new dk;const a=await this.readFromStream(t.subarray(n),r);if(a===0)break;n+=a}if(!r&&n<t.length)throw new et;return n}},uk=class extends fh{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}},mk=class extends uk{async readFromStream(t,r){if(t.length===0)return 0;const n=await this.reader.read(new Uint8Array(t.length),{min:r?void 0:t.length});return n.done&&(this.endOfStream=n.done),n.value?(t.set(n.value),n.value.length):0}},Vc=class extends fh{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,r){const n=Math.min(r.length,t.length);return t.set(r.subarray(0,n)),n<r.length?this.buffer=r.subarray(n):this.buffer=null,n}async readFromStream(t,r){if(t.length===0)return 0;let n=0;for(this.buffer&&(n+=this.writeChunk(t,this.buffer));n<t.length&&!this.endOfStream;){const a=await this.reader.read();if(a.done){this.endOfStream=!0;break}a.value&&(n+=this.writeChunk(t.subarray(n),a.value))}if(!r&&n===0&&this.endOfStream)throw new et;return n}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}};function pk(e){try{const t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new Vc(t):new mk(t)}catch(t){if(t instanceof TypeError)return new Vc(e.getReader());throw t}}class gl{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t==null?void 0:t.onClose,t!=null&&t.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.readBuffer(n,{position:r})<t.len)throw new et;return t.get(n,0)}async peekToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.peekBuffer(n,{position:r})<t.len)throw new et;return t.get(n,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new et;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new et;return t.get(this.numBuffer,0)}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");if(this.fileInfo.size!==void 0){const r=this.fileInfo.size-this.position;if(t>r)return this.position+=r,r}return this.position+=t,t}async close(){var t;await this.abort(),await((t=this.onClose)==null?void 0:t.call(this))}normalizeOptions(t,r){if(!this.supportsRandomAccess()&&r&&r.position!==void 0&&r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:t.length,position:this.position,...r}}abort(){return Promise.resolve()}}const fk=256e3;let hk=class extends gl{constructor(t,r){super(r),this.streamReader=t,this.fileInfo=(r==null?void 0:r.fileInfo)??{}}async readBuffer(t,r){const n=this.normalizeOptions(t,r),a=n.position-this.position;if(a>0)return await this.ignore(a),this.readBuffer(t,r);if(a<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;const s=await this.streamReader.read(t.subarray(0,n.length),n.mayBeLess);if(this.position+=s,(!r||!r.mayBeLess)&&s<n.length)throw new et;return s}async peekBuffer(t,r){const n=this.normalizeOptions(t,r);let a=0;if(n.position){const s=n.position-this.position;if(s>0){const i=new Uint8Array(n.length+s);return a=await this.peekBuffer(i,{mayBeLess:n.mayBeLess}),t.set(i.subarray(s)),a-s}if(s<0)throw new Error("Cannot peek from a negative offset in a stream")}if(n.length>0){try{a=await this.streamReader.peek(t.subarray(0,n.length),n.mayBeLess)}catch(s){if(r!=null&&r.mayBeLess&&s instanceof et)return 0;throw s}if(!n.mayBeLess&&a<n.length)throw new et}return a}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");const r=Math.min(fk,t),n=new Uint8Array(r);let a=0;for(;a<t;){const s=t-a,i=await this.readBuffer(n,{length:Math.min(r,s)});if(i<0)return i;a+=i}return a}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}},xk=class extends gl{constructor(t,r){super(r),this.uint8Array=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.length}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new et;return t.set(this.uint8Array.subarray(n.position,n.position+a)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}},gk=class extends gl{constructor(t,r){super(r),this.blob=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.size,mimeType:t.type}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.blob.size-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new et;const s=await this.blob.slice(n.position,n.position+a).arrayBuffer();return t.set(new Uint8Array(s)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}};function vk(e,t){const r=pk(e),n=t??{},a=n.onClose;return n.onClose=async()=>{if(await r.close(),a)return a()},new hk(r,n)}function bk(e,t){return new xk(e,t)}function yk(e,t){return new gk(e,t)}var ii={exports:{}},vs,Bc;function wk(){if(Bc)return vs;Bc=1;var e=1e3,t=e*60,r=t*60,n=r*24,a=n*7,s=n*365.25;vs=function(u,m){m=m||{};var p=typeof u;if(p==="string"&&u.length>0)return i(u);if(p==="number"&&isFinite(u))return m.long?c(u):l(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function i(u){if(u=String(u),!(u.length>100)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(m){var p=parseFloat(m[1]),f=(m[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return p*s;case"weeks":case"week":case"w":return p*a;case"days":case"day":case"d":return p*n;case"hours":case"hour":case"hrs":case"hr":case"h":return p*r;case"minutes":case"minute":case"mins":case"min":case"m":return p*t;case"seconds":case"second":case"secs":case"sec":case"s":return p*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}}}function l(u){var m=Math.abs(u);return m>=n?Math.round(u/n)+"d":m>=r?Math.round(u/r)+"h":m>=t?Math.round(u/t)+"m":m>=e?Math.round(u/e)+"s":u+"ms"}function c(u){var m=Math.abs(u);return m>=n?d(u,m,n,"day"):m>=r?d(u,m,r,"hour"):m>=t?d(u,m,t,"minute"):m>=e?d(u,m,e,"second"):u+" ms"}function d(u,m,p,f){var v=m>=p*1.5;return Math.round(u/p)+" "+f+(v?"s":"")}return vs}function kk(e){r.debug=r,r.default=r,r.coerce=c,r.disable=i,r.enable=a,r.enabled=l,r.humanize=wk(),r.destroy=d,Object.keys(e).forEach(u=>{r[u]=e[u]}),r.names=[],r.skips=[],r.formatters={};function t(u){let m=0;for(let p=0;p<u.length;p++)m=(m<<5)-m+u.charCodeAt(p),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=t;function r(u){let m,p=null,f,v;function h(...x){if(!h.enabled)return;const y=h,b=Number(new Date),k=b-(m||b);y.diff=k,y.prev=m,y.curr=b,m=b,x[0]=r.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let w=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(N,S)=>{if(N==="%%")return"%";w++;const A=r.formatters[S];if(typeof A=="function"){const C=x[w];N=A.call(y,C),x.splice(w,1),w--}return N}),r.formatArgs.call(y,x),(y.log||r.log).apply(y,x)}return h.namespace=u,h.useColors=r.useColors(),h.color=r.selectColor(u),h.extend=n,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(f!==r.namespaces&&(f=r.namespaces,v=r.enabled(u)),v),set:x=>{p=x}}),typeof r.init=="function"&&r.init(h),h}function n(u,m){const p=r(this.namespace+(typeof m>"u"?":":m)+u);return p.log=this.log,p}function a(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];const m=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const p of m)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function s(u,m){let p=0,f=0,v=-1,h=0;for(;p<u.length;)if(f<m.length&&(m[f]===u[p]||m[f]==="*"))m[f]==="*"?(v=f,h=p,f++):(p++,f++);else if(v!==-1)f=v+1,h++,p=h;else return!1;for(;f<m.length&&m[f]==="*";)f++;return f===m.length}function i(){const u=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),u}function l(u){for(const m of r.skips)if(s(u,m))return!1;for(const m of r.names)if(s(u,m))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}var jk=kk;(function(e,t){t.formatArgs=n,t.save=a,t.load=s,t.useColors=r,t.storage=i(),t.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const d="color: "+this.color;c.splice(1,0,d,"color: inherit");let u=0,m=0;c[0].replace(/%[a-zA-Z%]/g,p=>{p!=="%%"&&(u++,p==="%c"&&(m=u))}),c.splice(m,0,d)}t.log=console.debug||console.log||(()=>{});function a(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function s(){let c;try{c=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function i(){try{return localStorage}catch{}}e.exports=jk(t);const{formatters:l}=e.exports;l.j=function(c){try{return JSON.stringify(c)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}})(ii,ii.exports);var Ck=ii.exports;const Nk=Y1(Ck),gn={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Uc={get(e){return{signature:Ze.get(e,0),compressedSize:Ze.get(e,8),uncompressedSize:Ze.get(e,12)}},len:16},Sk={get(e){const t=We.get(e,6);return{signature:Ze.get(e,0),minVersion:We.get(e,4),dataDescriptor:!!(t&8),compressedMethod:We.get(e,8),compressedSize:Ze.get(e,18),uncompressedSize:Ze.get(e,22),filenameLength:We.get(e,26),extraFieldLength:We.get(e,28),filename:null}},len:30},$k={get(e){return{signature:Ze.get(e,0),nrOfThisDisk:We.get(e,4),nrOfThisDiskWithTheStart:We.get(e,6),nrOfEntriesOnThisDisk:We.get(e,8),nrOfEntriesOfSize:We.get(e,10),sizeOfCd:Ze.get(e,12),offsetOfStartOfCd:Ze.get(e,16),zipFileCommentLength:We.get(e,20)}},len:22},Ek={get(e){const t=We.get(e,8);return{signature:Ze.get(e,0),minVersion:We.get(e,6),dataDescriptor:!!(t&8),compressedMethod:We.get(e,10),compressedSize:Ze.get(e,20),uncompressedSize:Ze.get(e,24),filenameLength:We.get(e,28),extraFieldLength:We.get(e,30),fileCommentLength:We.get(e,32),relativeOffsetOfLocalHeader:Ze.get(e,42),filename:null}},len:46};function hh(e){const t=new Uint8Array(Ze.len);return Ze.put(t,0,e),t}const rr=Nk("tokenizer:inflate"),bs=256*1024,Tk=hh(gn.DataDescriptor),Ea=hh(gn.EndOfCentralDirectory);class ma{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(bs)}async isZip(){return await this.peekSignature()===gn.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Ze)}async findEndOfCentralDirectoryLocator(){const t=this.tokenizer,r=Math.min(16*1024,t.fileInfo.size),n=this.syncBuffer.subarray(0,r);await this.tokenizer.readBuffer(n,{position:t.fileInfo.size-r});for(let a=n.length-4;a>=0;a--)if(n[a]===Ea[0]&&n[a+1]===Ea[1]&&n[a+2]===Ea[2]&&n[a+3]===Ea[3])return t.fileInfo.size-r+a;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){rr("Cannot reading central-directory without random-read support");return}rr("Reading central-directory...");const t=this.tokenizer.position,r=await this.findEndOfCentralDirectoryLocator();if(r>0){rr("Central-directory 32-bit signature found");const n=await this.tokenizer.readToken($k,r),a=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let s=0;s<n.nrOfEntriesOfSize;++s){const i=await this.tokenizer.readToken(Ek);if(i.signature!==gn.CentralFileHeader)throw new Error("Expected Central-File-Header signature");i.filename=await this.tokenizer.readToken(new gr(i.filenameLength,"utf-8")),await this.tokenizer.ignore(i.extraFieldLength),await this.tokenizer.ignore(i.fileCommentLength),a.push(i),rr(`Add central-directory file-entry: n=${s+1}/${a.length}: filename=${a[s].filename}`)}return this.tokenizer.setPosition(t),a}this.tokenizer.setPosition(t)}async unzip(t){const r=await this.readCentralDirectory();if(r)return this.iterateOverCentralDirectory(r,t);let n=!1;do{const a=await this.readLocalFileHeader();if(!a)break;const s=t(a);n=!!s.stop;let i;if(await this.tokenizer.ignore(a.extraFieldLength),a.dataDescriptor&&a.compressedSize===0){const l=[];let c=bs;rr("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let d=-1;for(;d<0&&c===bs;){c=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),d=Ak(this.syncBuffer.subarray(0,c),Tk);const u=d>=0?d:c;if(s.handler){const m=new Uint8Array(u);await this.tokenizer.readBuffer(m),l.push(m)}else await this.tokenizer.ignore(u)}rr(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(a,Dk(l),s.handler)}else s.handler?(rr(`Reading compressed-file-data: ${a.compressedSize} bytes`),i=new Uint8Array(a.compressedSize),await this.tokenizer.readBuffer(i),await this.inflate(a,i,s.handler)):(rr(`Ignoring compressed-file-data: ${a.compressedSize} bytes`),await this.tokenizer.ignore(a.compressedSize));if(rr(`Reading data-descriptor at pos=${this.tokenizer.position}`),a.dataDescriptor&&(await this.tokenizer.readToken(Uc)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Uc.len}`)}while(!n)}async iterateOverCentralDirectory(t,r){for(const n of t){const a=r(n);if(a.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);const s=await this.readLocalFileHeader();if(s){await this.tokenizer.ignore(s.extraFieldLength);const i=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(i),await this.inflate(s,i,a.handler)}}if(a.stop)break}}async inflate(t,r,n){if(t.compressedMethod===0)return n(r);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);rr(`Decompress filename=${t.filename}, compressed-size=${r.length}`);const a=await ma.decompressDeflateRaw(r);return n(a)}static async decompressDeflateRaw(t){const r=new ReadableStream({start(s){s.enqueue(t),s.close()}}),n=new DecompressionStream("deflate-raw"),a=r.pipeThrough(n);try{const s=await new Response(a).arrayBuffer();return new Uint8Array(s)}catch(s){const i=s instanceof Error?`Failed to deflate ZIP entry: ${s.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(i)}}async readLocalFileHeader(){const t=await this.tokenizer.peekToken(Ze);if(t===gn.LocalFileHeader){const r=await this.tokenizer.readToken(Sk);return r.filename=await this.tokenizer.readToken(new gr(r.filenameLength,"utf-8")),r}if(t===gn.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}function Ak(e,t){const r=e.length,n=t.length;if(n>r)return-1;for(let a=0;a<=r-n;a++){let s=!0;for(let i=0;i<n;i++)if(e[a+i]!==t[i]){s=!1;break}if(s)return a}return-1}function Dk(e){const t=e.reduce((a,s)=>a+s.length,0),r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}class Rk{constructor(t){this.tokenizer=t}inflate(){const t=this.tokenizer;return new ReadableStream({async pull(r){const n=new Uint8Array(1024),a=await t.readBuffer(n,{mayBeLess:!0});if(a===0){r.close();return}r.enqueue(n.subarray(0,a))}}).pipeThrough(new DecompressionStream("gzip"))}}new globalThis.TextDecoder("utf8");new globalThis.TextEncoder;Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Hc(e){const{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}function Pk(e,t){if(t==="utf-16le"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a&255,a>>8&255)}return r}if(t==="utf-16be"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a>>8&255,a&255)}return r}return[...e].map(r=>r.charCodeAt(0))}function _k(e,t=0){const r=Number.parseInt(new gr(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let n=8*32;for(let a=t;a<t+148;a++)n+=e[a];for(let a=t+156;a<t+512;a++)n+=e[a];return r===n}const Ik={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},Ok=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],Fk=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"],Gn=4100,Lk=Gn-2,dr=1024*1024,Wc=1024,zk=2**31-1,Lt=16*1024*1024,Wo=dr,qc=dr,Mk=Lt,Vk=1,Gc=100,ys=Lt,Xc=64,Zc=Wo,Bk=256,Uk=512,Hk=Lt,Wk=512,qk=512,Kc=256,Yc=Wo,Jc=Wo,Gk=Wo,Qc=Lt,Xk=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),Zk=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],Kk=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);let Kr=class extends Error{};function Yk(e){var t;const r=e==null?void 0:e.streamReader;if(((t=r==null?void 0:r.constructor)==null?void 0:t.name)!=="WebStreamByobReader")return e;const{reader:n}=r,a=async()=>{await n.cancel(),n.releaseLock()};return r.close=a,r.abort=async()=>{r.interrupted=!0,await a()},e}function vl(e,t,r){if(!Number.isFinite(e)||e<0||e>t)throw new Kr(`${r} has invalid size ${e} (maximum ${t} bytes)`);return e}async function Dr(e,t,{maximumLength:r=Lt,reason:n="skip"}={}){const a=vl(t,r,n);await e.ignore(a)}async function ws(e,t,r,{maximumLength:n=t.length,reason:a="read"}={}){const s=t.length,i=vl(s,n,a);return e.readBuffer(t,{...r,length:i})}async function Jk(e,{maximumLength:t=dr}={}){const r=new ReadableStream({start(l){l.enqueue(e),l.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),n=[];let a=0;try{for(;;){const{done:l,value:c}=await r.read();if(l)break;if(a+=c.length,a>t)throw await r.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);n.push(c)}}finally{r.releaseLock()}const s=new Uint8Array(a);let i=0;for(const l of n)s.set(l,i),i+=l.length;return s}const xh=134695760,Ka=16,Qk=Ka-1;function ej(e,t){if(e.length<Ka)return-1;const r=e.length-Ka;for(let n=0;n<=r;n++)if(Ze.get(e,n)===xh&&Ze.get(e,n+8)===t+n)return n;return-1}function tj(e){return(e.codePointAt(0)&32)!==0}function rj(e,t){const r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}async function nj(e,{shouldBuffer:t,maximumLength:r=dr}={}){const{syncBuffer:n}=e,{length:a}=n,s=[];let i=0;for(;;){const l=await e.tokenizer.peekBuffer(n,{mayBeLess:!0}),c=ej(n.subarray(0,l),i),d=c>=0?0:l===a?Math.min(Qk,l-1):0,u=c>=0?c:l-d;if(u===0)break;if(i+=u,i>r)throw new Error(`ZIP entry compressed data exceeds ${r} bytes`);if(t){const m=new Uint8Array(u);await e.tokenizer.readBuffer(m),s.push(m)}else await e.tokenizer.ignore(u);if(c>=0)break}if(ut(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=i),!!t)return rj(s,i)}function aj(e,t){return ut(e.tokenizer)?Math.max(0,Lt-(e.tokenizer.position-t)):Math.max(0,dr-e.knownSizeDescriptorScannedBytes)}async function oj(e,t,{shouldBuffer:r,maximumDescriptorLength:n=dr}={}){if(t.dataDescriptor&&t.compressedSize===0)return nj(e,{shouldBuffer:r,maximumLength:n});if(!r){await Dr(e.tokenizer,t.compressedSize,{maximumLength:ut(e.tokenizer)?dr:e.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}const a=mj(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>a)throw new Error(`ZIP entry compressed data exceeds ${a} bytes`);const s=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(s),s}ma.prototype.inflate=async function(e,t,r){if(e.compressedMethod===0)return r(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);const n=await Jk(t,{maximumLength:dr});return r(n)};ma.prototype.unzip=async function(e){let t=!1,r=0;const n=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Xn(this.tokenizer,n,Lt))throw new Kr(`ZIP stream probing exceeds ${Lt} bytes`);const a=await this.readLocalFileHeader();if(!a)break;if(r++,r>Wc)throw new Error(`ZIP entry count exceeds ${Wc}`);const s=e(a);t=!!s.stop,await this.tokenizer.ignore(a.extraFieldLength);const i=await oj(this,a,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(dr,aj(this,n))});if(s.handler&&await this.inflate(a,i,s.handler),a.dataDescriptor){const l=new Uint8Array(Ka);if(await this.tokenizer.readBuffer(l),Ze.get(l,0)!==xh)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(Xn(this.tokenizer,n,Lt))throw new Kr(`ZIP stream probing exceeds ${Lt} bytes`)}while(!t)};function sj(e,t){const r=e.getReader();let n=0,a=!1,s=!1;const i=async l=>{a||s||(s=!0,await r.cancel(l))};return new ReadableStream({async pull(l){if(n>=t){l.close(),await i();return}const{done:c,value:d}=await r.read();if(c||!d){a=!0,l.close();return}const u=t-n;if(d.length>u){l.enqueue(d.subarray(0,u)),n+=u,l.close(),await i();return}l.enqueue(d),n+=d.length},async cancel(l){await i(l)}})}async function ij(e,t){return new bl(t).fromBlob(e)}function ed(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:e};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:e};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:e};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:e};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:e};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"}}}function nr(e,t,r){r={offset:0,...r};for(const[n,a]of t.entries())if(r.mask){if(a!==(r.mask[n]&e[n+r.offset]))return!1}else if(a!==e[n+r.offset])return!1;return!0}function lj(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):Gn}function cj(e,t,r){return r===void 0?e.read(t):(r.throwIfAborted(),new Promise((n,a)=>{const s=()=>{r.removeEventListener("abort",i)},i=()=>{const l=r.reason;s(),(async()=>{try{await e.cancel(l)}catch{}})(),a(l)};r.addEventListener("abort",i,{once:!0}),(async()=>{try{const l=await e.read(t);s(),n(l)}catch(l){s(),a(l)}})()}))}function dj(e){return Number.isFinite(e)?Math.max(0,Math.min(Lk,Math.trunc(e))):0}function uj(e){return Number.isFinite(e)?Math.max(0,e):Number.MAX_SAFE_INTEGER}function ut(e){const t=e.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Xn(e,t,r){return ut(e)&&e.position-t>r}function mj(e){const t=e.fileInfo.size,r=Number.isFinite(t)?Math.max(0,t-e.position):Number.MAX_SAFE_INTEGER;return Math.min(r,zk)}function pj(e){if(e instanceof et||e instanceof Kr)return!0;if(!(e instanceof Error))return!1;if(Xk.has(e.message)||Kk.has(e.code))return!0;for(const t of Zk)if(e.message.startsWith(t))return!0;return!1}function td(e,t=dr){const r=[e.compressedSize,e.uncompressedSize];for(const n of r)if(!Number.isFinite(n)||n<0||n>t)return!1;return!0}function fj(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function hj(e,t){t.startsWith("word/")&&(e.hasWordDirectory=!0),t.startsWith("ppt/")&&(e.hasPresentationDirectory=!0),t.startsWith("xl/")&&(e.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(e.hasThreeDimensionalModelEntry=!0)}function rd(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(e.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(e.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(e.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function xj(e){const t=e.indexOf('.main+xml"');if(t===-1){const a="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return e.includes(`ContentType="${a}"`)?a:void 0}const r=e.slice(0,t),n=r.lastIndexOf('"');return r.slice(n+1)}class bl{constructor(t){Fc(this,"detectConfident",async n=>{if(this.buffer=new Uint8Array(Gn),n.fileInfo.size===void 0&&(n.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=n,ut(n)&&(await n.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(n);if(await n.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await n.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=Kc?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(n));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(n);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await Dr(n,6,{maximumLength:6,reason:"ID3 header prefix"});const a=await n.readToken(Ik),s=ut(n);if(!Number.isFinite(a)||a<0||s&&(a>ys||n.position+a>ys))return;if(n.position+a>n.fileInfo.size)return s?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await Dr(n,a,{maximumLength:s?ys:n.fileInfo.size,reason:"ID3 payload"})}catch(i){if(i instanceof et)return;throw i}return this.detectionReentryCount>=Kc?void 0:(this.detectionReentryCount++,this.parseTokenizer(n,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let a;const s=fj();try{await new ma(n).unzip(i=>{hj(s,i.filename);const l=i.filename==="[Content_Types].xml",c=rd(s);if(!l&&c)return a=c,{stop:!0};switch(i.filename){case"META-INF/mozilla.rsa":return a={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return a={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return td(i,qc)?{async handler(d){const u=new TextDecoder("utf-8").decode(d).trim();a=ed(u)},stop:!0}:{};case"[Content_Types].xml":return s.hasContentTypesEntry=!0,td(i,qc)?(s.isParsingContentTypes=!0,{async handler(d){const u=new TextDecoder("utf-8").decode(d),m=xj(u);m&&(a=ed(m)),s.hasParsedContentTypesEntry=!0,s.isParsingContentTypes=!1},stop:!0}):(s.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(i.filename)?(a={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(i){if(!pj(i))throw i;s.isParsingContentTypes&&(s.isParsingContentTypes=!1,s.hasUnparseableContentTypes=!0)}return a??rd(s)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await n.ignore(28);const a=new Uint8Array(8);return await n.readBuffer(a),nr(a,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:nr(a,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:nr(a,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:nr(a,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:nr(a,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:nr(a,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const a=await this.readTiffHeader(!1);if(a)return a}if(this.check([77,77])){const a=await this.readTiffHeader(!0);if(a)return a}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function a(){const d=await n.peekNumber(sk);let u=128,m=0;for(;!(d&u)&&u!==0;)++m,u>>=1;const p=new Uint8Array(m+1);return await ws(n,p,void 0,{maximumLength:p.length,reason:"EBML field"}),p}async function s(){const d=await a(),u=await a();u[0]^=128>>u.length-1;const m=Math.min(6,u.length),p=new DataView(d.buffer),f=new DataView(u.buffer,u.length-m,m);return{id:Hc(p),len:Hc(f)}}async function i(d){let u=0;for(;d>0;){if(u++,u>Bk||Xn(n,c,Lt))return;const m=n.position,p=await s();if(p.id===17026){if(p.len>Xc)return;const f=vl(p.len,Xc,"EBML DocType");return(await n.readToken(new gr(f))).replaceAll(/\00.*$/g,"")}if(ut(n)&&(!Number.isFinite(p.len)||p.len<0||p.len>Zc)||(await Dr(n,p.len,{maximumLength:ut(n)?Zc:n.fileInfo.size,reason:"EBML payload"}),--d,n.position<=m))return}}const l=await s(),c=n.position;switch(await i(l.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){const a=Mc.get(this.buffer,4),s=mn.get(this.buffer,6);if(a>0&&a<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(s>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const a=new gr(4,"latin1").get(this.buffer,2);if(a.match("^d*")&&a>=1e3&&a<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await n.ignore(8),await n.readToken(new gr(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
80
+ `,"\r"," "," ","\0"].some(a=>this.checkString(a,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){const a={ext:"png",mime:"image/png"},s={ext:"apng",mime:"image/apng"};await n.ignore(8);async function i(){return{length:await n.readToken(ik),type:await n.readToken(new gr(4,"latin1"))}}const l=ut(n),c=n.position;let d=0,u=!1;do{if(d++,d>Uk||Xn(n,c,Hk))break;const m=n.position,p=await i();if(p.length<0)return;if(p.type==="IHDR"){if(p.length!==13)return;u=!0}switch(p.type){case"IDAT":return a;case"acTL":return s;default:if(!u&&p.type!=="CgBI")return;if(l&&p.length>Yc)return u&&tj(p.type)?a:void 0;try{await Dr(n,p.length+4,{maximumLength:l?Yc+4:n.fileInfo.size,reason:"PNG chunk payload"})}catch(f){if(!l&&(f instanceof Kr||f instanceof et))return a;throw f}}if(n.position<=m)break}while(n.position+8<n.fileInfo.size);return a}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&this.buffer[8]&96){const a=new gr(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(a){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return a.startsWith("3g")?a.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
81
+ `))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){let a=!1;try{async function s(){const d=new Uint8Array(16);return await ws(n,d,void 0,{maximumLength:d.length,reason:"ASF header GUID"}),{id:d,size:Number(await n.readToken(lk))}}await Dr(n,30,{maximumLength:30,reason:"ASF header prelude"});const i=ut(n),l=n.position;let c=0;for(;n.position+24<n.fileInfo.size&&(c++,!(c>Wk||Xn(n,l,Lt)));){const d=n.position,u=await s();let m=u.size-24;if(!Number.isFinite(m)||m<0){a=!0;break}if(nr(u.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const p=new Uint8Array(16);if(m-=await ws(n,p,void 0,{maximumLength:p.length,reason:"ASF stream type GUID"}),nr(p,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(nr(p,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(i&&m>Jc){a=!0;break}if(await Dr(n,m,{maximumLength:i?Jc:n.fileInfo.size,reason:"ASF header payload"}),n.position<=d){a=!0;break}}}catch(s){if(s instanceof et||s instanceof Kr)ut(n)&&(a=!0);else throw s}return a?void 0:{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await n.ignore(20),await n.readToken(new gr(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await n.peekBuffer(this.buffer,{length:Math.min(256,n.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const a=new DataView(this.buffer.buffer).getUint32(12,!0);if(a>12&&this.buffer.length>=a+16)try{const s=new TextDecoder().decode(this.buffer.subarray(16,a+16));if(JSON.parse(s).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await n.peekBuffer(this.buffer,{length:Math.min(512,n.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&_k(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){const a="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:a})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:a})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
82
+ `,{offset:2,encoding:a})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}}),Fc(this,"detectImprecise",async n=>{this.buffer=new Uint8Array(Gn);const a=uj(n.fileInfo.size);if(await n.peekBuffer(this.buffer,{length:Math.min(8,a),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await n.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,a),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let s=0;s<=this.options.mpegOffsetTolerance;++s){const i=this.scanMpeg(s);if(i)return i}});const r=dj(t==null?void 0:t.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:r},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return Yk(vk(t,this.getTokenizerOptions()))}async parseTokenizer(t,r=0){this.detectionReentryCount=r;const n=t.position;for(const a of this.detectors){let s;try{s=await a.detect(t)}catch(i){if(i instanceof et||i instanceof Kr)return;throw i}if(s)return s;if(n!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);const r=t instanceof Uint8Array?t:new Uint8Array(t);if((r==null?void 0:r.length)>1)return this.fromTokenizer(bk(r,this.getTokenizerOptions()))}async fromBlob(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=yk(t,this.getTokenizerOptions());return this.fromTokenizer(n)}async fromStream(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=this.createTokenizerFromWebStream(t);return this.fromTokenizer(n)}async toDetectionStream(t,r){const n=lj((r==null?void 0:r.sampleSize)??Gn);let a,s;const i=t.getReader({mode:"byob"});try{const{value:d,done:u}=await cj(i,new Uint8Array(n),this.options.signal);if(s=d,!u&&d)try{a=await this.fromBuffer(d.subarray(0,n))}catch(m){if(!(m instanceof et))throw m;a=void 0}s=d}finally{i.releaseLock()}const l=new TransformStream({async start(d){d.enqueue(s)},transform(d,u){u.enqueue(d)}}),c=t.pipeThrough(l);return c.fileType=a,c}async detectGzip(t){var r;if(this.gzipProbeDepth>=Vk)return{ext:"gz",mime:"application/gzip"};const n=new Rk(t),a=sj(n.inflate(),Mk),s=ut(t);let i,l,c,d;if(s){const u=new AbortController;i=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${Gc} ms`,"TimeoutError"))},Gc),l=this.options.signal===void 0?u.signal:AbortSignal.any([this.options.signal,u.signal]),c=new bl({...this.options,signal:l}),c.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{d=await(c??this).fromStream(a)}catch(u){if((u==null?void 0:u.name)==="AbortError"&&((r=l==null?void 0:l.reason)==null?void 0:r.name)!=="TimeoutError")throw u}finally{clearTimeout(i),s||this.gzipProbeDepth--}return(d==null?void 0:d.ext)==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,r){return nr(this.buffer,t,r)}checkString(t,r){return this.check(Pk(t,r==null?void 0:r.encoding),r)}async readTiffTag(t){const r=await this.tokenizer.readToken(t?mn:We);switch(await this.tokenizer.ignore(10),r){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(t){const r=await this.tokenizer.readToken(t?mn:We);if(!(r>qk)&&!(ut(this.tokenizer)&&2+r*12>Qc))for(let n=0;n<r;++n){const a=await this.readTiffTag(t);if(a)return a}}async readTiffHeader(t){const r={ext:"tif",mime:"image/tiff"},n=(t?mn:We).get(this.buffer,2),a=(t?Mc:Ze).get(this.buffer,4);if(n===42){if(a>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(a>=8){const l=(t?mn:We).get(this.buffer,8),c=(t?mn:We).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(ut(this.tokenizer)&&a>Gk)return r;const s=ut(this.tokenizer)?Qc:this.tokenizer.fileInfo.size;try{await Dr(this.tokenizer,a,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof et)return;throw l}let i;try{i=await this.readTiffIFD(t)}catch(l){if(l instanceof et)return;throw l}return i??r}if(n===43)return r}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}}new Set(Ok);new Set(Fk);const nd=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,yl=({name:e,control:t,disabled:r,campo:n,fileTypes:a,maxFileSize:s})=>{var i;const{field:l,fieldState:c}=$e.useController({name:e,control:t}),{uploadFile:d,deleteUploadedFile:u,onUploadStart:m,onUploadEnd:p}=Cr(),[f,v]=j.useState({status:"idle"}),h=j.useRef(null),[x,y]=j.useState(!1),b=j.useRef(!0),k=j.useRef(m);k.current=m;const w=j.useRef(p);w.current=p,j.useEffect(()=>()=>{b.current=!1},[]);const N=typeof l.value=="string"&&l.value?l.value:null,S=j.useCallback(async $=>{var I,L,D;if(a&&a.length>0){const z=await ij($),H=(z==null?void 0:z.ext)??"",U=(z==null?void 0:z.mime)??"",Z=((I=$.name.split(".").pop())==null?void 0:I.toLowerCase())??"",V=$.type.toLowerCase();if(!a.some(M=>{const R=M.toLowerCase();return!!(H&&(R===H||R===U)||U&&R.endsWith("/*")&&U.startsWith(R.slice(0,-1))||!H&&(R===Z||R===V||R.endsWith("/*")&&V.startsWith(R.slice(0,-1))))})){v({status:"error",message:`Tipo de arquivo não permitido. Permitidos: ${a.join(", ")}`});return}}if(s&&$.size>s){v({status:"error",message:`Arquivo muito grande. Tamanho máximo: ${nd(s)}`});return}if(!d){v({status:"error",message:"Preview: upload não disponível sem configuração."});return}v({status:"uploading",fileName:$.name,progress:0}),(L=k.current)==null||L.call(k);try{if(N&&u)try{await u(N)}catch{}const z=await d($,n??e,H=>{b.current&&v(U=>U.status==="uploading"?{...U,progress:Math.min(100,H)}:U)});if(!b.current)return;l.onChange(z),v({status:"done",uploadId:z,fileName:$.name,size:$.size})}catch{if(!b.current)return;v({status:"error",message:"Falha no upload. Tente novamente."})}finally{b.current&&((D=w.current)==null||D.call(w))}},[d,u,N,n,e,l,a,s]),A=j.useCallback($=>{var I;const L=(I=$.target.files)==null?void 0:I[0];L&&S(L),$.target.value=""},[S]),C=j.useCallback(()=>{var $;N&&u&&(($=k.current)==null||$.call(k),u(N).catch(()=>{}).finally(()=>{var I;(I=w.current)==null||I.call(w)})),l.onChange(""),v({status:"idle"}),h.current&&(h.current.value="")},[l,N,u]);if(f.status==="done"||f.status==="idle"&&N){const $=f.status==="done"?f.fileName:"Arquivo enviado",I=f.status==="done"?f.size:null;return o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-green-500 bg-green-500/5 px-4 py-3 gap-2",children:[o.jsxs("svg",{className:"shrink-0 text-green-500",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[o.jsx("rect",{width:"20",height:"20",rx:"4",fill:"currentColor",fillOpacity:"0.15"}),o.jsx("path",{d:"M5 10.5L8.5 14L15 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:$}),I!==null&&o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:nd(I)}),!r&&o.jsx("button",{type:"button",onClick:C,className:"ml-2 shrink-0 text-muted-foreground hover:text-destructive transition-colors","aria-label":"Remover arquivo",children:"✕"})]})}if(f.status==="uploading"){const{fileName:$,progress:I}=f;return o.jsxs("div",{className:"rounded-lg border border-input px-4 py-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:$}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:[I,"%"]})]}),o.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary transition-all duration-200 rounded-full",style:{width:`${I}%`}})})]})}const E=f.status==="error";return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{role:"button",tabIndex:r?-1:0,"aria-label":"Selecionar arquivo",className:Y("flex items-center justify-center rounded-lg border-2 border-dashed px-4 py-6 transition-colors cursor-pointer",x?"border-primary bg-primary/5":E||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 $;return!r&&(($=h.current)==null?void 0:$.click())},onKeyDown:$=>{var I;($.key==="Enter"||$.key===" ")&&((I=h.current)==null||I.click())},onDragOver:$=>{$.preventDefault(),r||y(!0)},onDragLeave:()=>y(!1),onDrop:r?void 0:$=>{var I;$.preventDefault(),y(!1);const L=(I=$.dataTransfer.files)==null?void 0:I[0];L&&S(L)},onBlur:l.onBlur,children:[o.jsx("input",{ref:h,type:"file",onChange:A,disabled:r,className:"sr-only"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:x?"Solte o arquivo aqui":"Clique ou arraste um arquivo"})]}),E&&o.jsxs("p",{className:"text-sm text-destructive",children:[f.message," · ",o.jsx("button",{type:"button",className:"underline hover:no-underline",onClick:()=>v({status:"idle"}),children:"Tentar novamente"})]}),!E&&((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},gj={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")},_r=({name:e,control:t,placeholder:r,maskType:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=$e.useController({name:e,control:t}),d=gj[n||""],u=j.useCallback(m=>{l.onChange(d?d(m.target.value):m.target.value)},[l,d]);return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value||"",onChange:u,onBlur:l.onBlur,placeholder:r,disabled:a,readOnly:s,className:Y(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},qo=({name:e,control:t})=>{const{field:r}=$e.useController({name:e,control:t});return o.jsx("input",{type:"hidden",...r,value:r.value??""})},gh=e=>e.replace(/\D/g,""),vj=e=>{const t=gh(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},bj=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()},wl=({name:e,control:t,placeholder:r="00000-000",disabled:n,readOnly:a,cepFillMap:s})=>{var i,l;const{field:c,fieldState:d}=$e.useController({name:e,control:t}),{setValue:u}=$e.useFormContext(),{cepLookup:m}=Cr(),[p,f]=j.useState("idle"),[v,h]=j.useState(null),x=j.useRef(null),y=j.useRef(!0);j.useEffect(()=>()=>{var w;y.current=!1,(w=x.current)==null||w.abort()},[]);const b=j.useCallback(async()=>{var w;c.onBlur();const N=gh(c.value??"");if(N.length===8){(w=x.current)==null||w.abort(),x.current=new AbortController,f("loading"),h(null);try{let S;if(m){const E=x.current;if(S=await m(N,E.signal),E.signal.aborted||!y.current)return}else{const E=await bj(N,x.current.signal);if(!y.current)return;if(E.erro){f("error"),h("CEP não encontrado");return}S={logradouro:E.logradouro,bairro:E.bairro,cidade:E.localidade,estado:E.uf}}if(!y.current)return;if(S.erro){f("error"),h("CEP não encontrado");return}const A=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",C=(E,$,I)=>{if(!I)return;const L=s!=null&&s[E]?`${A}${s[E]}`:`${A}${$}`;u(L,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),f("success")}catch(S){if(S instanceof Error&&S.name==="AbortError"||!y.current)return;f("error"),h("Erro ao buscar CEP")}}},[c,m,u,e,s]),k=j.useCallback(w=>{c.onChange(vj(w.target.value))},[c]);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{name:c.name,value:c.value||"",onChange:k,onBlur:b,placeholder:r,disabled:n,readOnly:a,className:Y("pr-9",d.error&&"border-destructive focus-visible:ring-destructive")}),o.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",children:[p==="loading"&&o.jsx(O.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"}),p==="success"&&o.jsx(O.Check,{className:"h-4 w-4 text-green-500"}),p==="error"&&o.jsx(O.AlertCircle,{className:"h-4 w-4 text-destructive"})]})]}),(((i=d.error)==null?void 0:i.message)||v)&&o.jsx("p",{className:"text-sm text-destructive",children:((l=d.error)==null?void 0:l.message)||v})]})},yj=({field:e,control:t,nameOverride:r})=>{const n={name:r,control:t,placeholder:e.placeholder};switch(e.tipo){case P.TEXTO:return o.jsx(Tt,{...n,type:"text"});case P.EMAIL:return o.jsx(Tt,{...n,type:"email"});case P.NUMBER:return o.jsx(Tt,{...n,type:"number"});case P.TEXTAREA:return o.jsx(Bo,{...n});case P.SELECT:return o.jsx(Uo,{...n,options:e.opcoes??[]});case P.RADIO:return o.jsx(hl,{...n,options:e.opcoes??[]});case P.CHECKBOX:return o.jsx(Ho,{name:r,control:t,label:e.label});case P.CHECKBOX_GROUP:return o.jsx(fl,{...n,options:e.opcoes??[]});case P.DATE:return o.jsx(Tn,{...n,validacao:e.validacao});case P.DATETIME:return o.jsx(Tn,{...n,isDatetime:!0,validacao:e.validacao});case P.FILE:return o.jsx(yl,{name:r,control:t});case P.TELEFONE:return o.jsx(_r,{...n,maskType:"telefone"});case P.CPF:return o.jsx(_r,{...n,maskType:"cpf"});case P.CEP:return o.jsx(wl,{name:r,control:t,placeholder:e.placeholder});case P.HIDDEN:return o.jsx(qo,{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.`),o.jsx(Tt,{...n,type:"text"})}},vh=({name:e,control:t,subFields:r=[],minItems:n=1,maxItems:a,itemLabel:s="Item",addLabel:i})=>{var l;const{fields:c,append:d,remove:u}=$e.useFieldArray({control:t,name:e}),{errors:m}=$e.useFormState({control:t}),p=(l=m[e])==null?void 0:l.message,f=j.useCallback(()=>{const y={};for(const b of r)b.initialValue!==void 0?y[b.nome]=b.initialValue:b.defaultValue!==void 0&&(y[b.nome]=b.defaultValue);return y},[r]);j.useEffect(()=>{if(c.length<n)for(let y=c.length;y<n;y++)d(f())},[n]);const v=[...r].sort((y,b)=>y.ordem-b.ordem),h=!a||c.length<a,x=i??`Adicionar ${s.toLowerCase()}`;return o.jsxs("div",{className:"space-y-3",children:[c.map((y,b)=>o.jsxs("div",{className:"rounded-lg border p-4",style:{borderColor:"var(--t-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary/10 text-xs font-bold text-primary shrink-0",children:b+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[s," ",b+1]})]}),c.length>n&&o.jsx(Te,{type:"button",variant:"ghost",size:"icon",onClick:()=>u(b),"aria-label":`Remover ${s.toLowerCase()} ${b+1}`,className:"text-muted-foreground hover:text-destructive",children:o.jsx(O.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:v.map(k=>{const w=`${e}.${b}.${k.nome}`,N=`span ${k.tamanho??12}`,S=o.jsx(yj,{field:k,control:t,nameOverride:w});return k.tipo===P.CHECKBOX||k.tipo===P.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:N},children:S},k.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:N},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1 text-sm text-foreground",children:[k.label,k.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),S,k.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:k.hint})]},k.id)})})]},y.id)),h&&o.jsxs(Te,{type:"button",variant:"outline",className:"w-full",onClick:()=>d(f()),children:[o.jsx(O.Plus,{className:"w-4 h-4"}),x]}),a&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",a," ",s.toLowerCase(),a>1?"s":""]}),p&&o.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[o.jsx(O.AlertCircle,{className:"w-4 h-4 shrink-0"}),p]})]})},ad=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,wj=(e,t)=>{const r=new Date(e.slice(0,10)+"T00:00:00Z"),n=new Date(t.slice(0,10)+"T00:00:00Z");return Math.round((n.getTime()-r.getTime())/864e5)+1},kj=(e,t)=>{const r=[],n=new Date(e.slice(0,10)+"T00:00:00Z"),a=new Date(t.slice(0,10)+"T00:00:00Z");let s=0;for(;n<=a&&s<60;)r.push(n.toISOString().slice(0,10)),n.setUTCDate(n.getUTCDate()+1),s++;return r},jj=e=>{const[t,r,n]=e.split("-").map(Number),a=new Date(Date.UTC(t,r-1,n)),s=String(n).padStart(2,"0"),i=String(r).padStart(2,"0"),l=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(a),c=l.charAt(0).toUpperCase()+l.slice(1);return`${s}/${i} - ${c}`},Cj=(e,t)=>{const r=n=>{const[a,s,i]=n.slice(0,10).split("-");return`${i}/${s}/${a}`};return`${r(e)} a ${r(t)}`},bh=({name:e,control:t})=>{var r;const{field:n,fieldState:a}=$e.useController({name:e,control:t}),{externalData:s={}}=Cr(),i=n.value??null,l=(r=a.error)==null?void 0:r.message,c=V=>s[`evento.${V}`]??s[V],d=c("dataInicioEvento")??"",u=c("dataFimEvento")??"",m=Number(c("valor")??0),p=Number(c("valorPorDia")??0),f=c("vagasTotal"),v=c("vagasPorDia"),h=c("vagasMasculinas"),x=c("vagasFemininas"),y=f!=null?Number(f):null,b=v!=null?Number(v):null,k=h!=null?Number(h):null,w=x!=null?Number(x):null,{dias:N,eventoMultiDia:S}=j.useMemo(()=>{if(!d||!u)return{dias:[],eventoMultiDia:!1};const V=kj(d,u),M=wj(d,u);return{dias:V,eventoMultiDia:M>1}},[d,u]),A=j.useMemo(()=>k!=null&&k>0&&w!=null&&w>0,[k,w]),C=j.useMemo(()=>k!=null&&w==null?"masculino":w!=null&&k==null?"feminino":null,[k,w]),E=(i==null?void 0:i.tipo)??null,$=(i==null?void 0:i.data)??null,I=(i==null?void 0:i.genero)??null,L=j.useRef(i);L.current=i;const D=j.useRef(n.onChange);D.current=n.onChange,j.useEffect(()=>{var V,M,R;C&&((V=L.current)==null?void 0:V.genero)!==C&&D.current({tipo:((M=L.current)==null?void 0:M.tipo)??null,data:((R=L.current)==null?void 0:R.data)??null,genero:C})},[C]);const z=j.useCallback(V=>{const M={tipo:V,data:null};(A||C)&&(M.genero=I??C??void 0),n.onChange(M)},[n,A,C,I]),H=j.useCallback(V=>{const M={tipo:"por_dia",data:V};(A||C)&&(M.genero=I??C??void 0),n.onChange(M)},[n,A,C,I]),U=j.useCallback(V=>{n.onChange({tipo:E,data:$,genero:V})},[n,E,$]),Z=j.useCallback(V=>E===V,[E]);return o.jsxs("div",{className:"space-y-3",children:[A&&o.jsxs("div",{className:"flex items-center gap-2 px-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Você é:"}),o.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(V=>o.jsx("button",{type:"button",onClick:()=>U(V),className:Y("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))})]}),o.jsxs("button",{type:"button",onClick:()=>z("todos_os_dias"),style:Z("todos_os_dias")?void 0:{borderColor:"var(--t-border)"},className:Y("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("todos_os_dias")?"border-primary bg-primary/5":"hover:border-primary/50"),children:[o.jsx("div",{className:Y("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("todos_os_dias")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(O.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar todos os dias"}),d&&u?o.jsx("p",{className:"text-xs text-muted-foreground",children:Cj(d,u)}):o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Datas do evento"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[m>0&&o.jsx("p",{className:Y("font-bold text-sm",Z("todos_os_dias")?"text-primary":"text-foreground"),children:ad(m)}),y!=null&&y>0&&o.jsxs("p",{className:"text-xs flex items-center justify-end gap-1 text-muted-foreground",children:[o.jsx(O.Users,{className:"w-3 h-3"}),y," vagas disponíveis"]})]})]}),S&&b!=null&&b!==0?o.jsxs("button",{type:"button",onClick:()=>z("por_dia"),style:Z("por_dia")?void 0:{borderColor:"var(--t-border)"},className:Y("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("por_dia")?"border-primary bg-primary/5":"hover:border-primary/50"),children:[o.jsx("div",{className:Y("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("por_dia")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(O.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado abaixo"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[p>0&&o.jsx("p",{className:Y("font-bold text-sm",Z("por_dia")?"text-primary":"text-foreground"),children:ad(p)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"por dia"})]})]}):!S&&d?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg border border-input bg-muted/30",children:[o.jsx(O.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.'})]}):null,E==="por_dia"&&o.jsxs("div",{className:"pl-2 space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-primary",children:"Selecione o dia:"}),N.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Nenhuma data configurada no evento"}):N.map(V=>o.jsxs("button",{type:"button",onClick:()=>H(V),style:$!==V?{borderColor:"var(--t-border)"}:void 0,className:Y("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",$===V?"border-primary bg-primary/5":"hover:border-primary/50"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:Y("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center transition-colors",$===V?"border-primary bg-primary":""),style:$!==V?{borderColor:"var(--t-border)"}:void 0,children:$===V&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-white"})}),o.jsx("span",{className:"text-sm",children:jj(V)})]}),b!=null&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[b," vagas"]})]},V))]}),l&&o.jsx("p",{className:"text-sm text-destructive",children:l})]})},od=.0315,sd=.124,id=7,ld=12,yh=[{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:od,taxaLabel:`Taxa: ${(od*100).toFixed(2).replace(".",",")}%`}],wh=[{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é ${id}x sem juros`,Icon:O.Smartphone,taxa:0,parcelas:id},{id:"cartao",label:"Cartão de Crédito",description:`Parcelado em até ${ld}x`,Icon:O.CreditCard,taxa:sd,parcelas:ld,taxaLabel:`Taxa: ${(sd*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:O.Banknote,taxa:0}],Ta=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,cd=(e,t)=>Math.round(e*(1+t)*100)/100,Nj=(e,t)=>Math.round(e/t*100)/100,kh=({name:e,control:t,relatedFieldName:r="tipo_participacao"})=>{var n;const{field:a,fieldState:s}=$e.useController({name:e,control:t}),{externalData:i={},paymentMethodOptions:l}=Cr(),c=a.value??null,d=(n=s.error)==null?void 0:n.message,u=$e.useWatch({control:t,name:r}),m=(u==null?void 0:u.tipo)??null,p=k=>i[`evento.${k}`]??i[k],f=Number(p("valor")??0),v=Number(p("valorPorDia")??0),h=m==="por_dia"&&v>0?v:f,x=m==="por_dia"?(l==null?void 0:l.porDia)??yh:(l==null?void 0:l.todosOsDias)??wh,y=m==="por_dia"?(()=>{if(!(u!=null&&u.data))return"Um dia";const k=u.data.split("-");if(k.length===3){const[w,N,S]=k;return`${S}/${N}/${w}`}return u.data})():"Todos os dias",b=k=>{if(k.disabled)return;const w=cd(h,k.taxa),N={metodo:k.id,valorTotal:w};k.parcelas&&(N.parcelas=k.parcelas),a.onChange(N)};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-xl border px-4 py-3",style:{borderColor:"var(--t-border)"},children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:y})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Valor base"}),o.jsx("p",{className:"text-lg font-bold text-primary",children:Ta(h)})]})]}),o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border bg-muted/30 px-3 py-2.5",style:{borderColor:"var(--t-border)"},children:[o.jsx(O.Info,{className:"h-4 w-4 mt-0.5 shrink-0 text-muted-foreground"}),o.jsxs("p",{className:"text-xs",children:[o.jsx("span",{className:"font-bold",children:"Importante:"})," Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:x.map(k=>{const{Icon:w}=k,N=(c==null?void 0:c.metodo)===k.id,S=cd(h,k.taxa),A=!!k.parcelas&&k.parcelas>1,C=A?Nj(S,k.parcelas):null;return o.jsxs("button",{type:"button",disabled:k.disabled,onClick:()=>b(k),style:N?void 0:{borderColor:"var(--t-border)"},className:Y("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":"hover:border-primary/50",k.disabled&&"opacity-50 cursor-not-allowed"),children:[o.jsx("div",{className:Y("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:o.jsx(w,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:k.label}),o.jsx("p",{className:"text-xs text-muted-foreground",children:k.description}),k.taxaLabel&&o.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["* ",k.taxaLabel]}),k.taxa>0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",Ta(S)]})]}),o.jsx("div",{className:"text-right shrink-0",children:A?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[k.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold text-primary",children:Ta(C)})]}):o.jsx("p",{className:"text-base font-bold text-primary",children:Ta(S)})})]},k.id)})}),d&&o.jsx("p",{className:"text-xs text-destructive",children:d})]})},jh=({name:e,control:t,label:r,termoTexto:n,termoPdfUrl:a,termoPdfUploadId:s})=>{var i;const{field:l,fieldState:c}=$e.useController({name:e,control:t}),{resolveTermsUploadUrl:d}=Cr(),u=!!c.error,m=(i=c.error)==null?void 0:i.message,[p,f]=j.useState(null),[v,h]=j.useState(!1),[x,y]=j.useState(!1),[b,k]=j.useState(null),[w,N]=j.useState(!1),[S,A]=j.useState(null),C=j.useRef(null);j.useEffect(()=>{if(!s||!d){f(null);return}let D=!1;return h(!0),d(s).then(z=>{D||f(z)}).catch(()=>{D||f(null)}).finally(()=>{D||h(!1)}),()=>{D=!0}},[s,d]);const E=l.value==="accepted",$=p||a||null,I=!!(n||$||s),L=!!$;return j.useEffect(()=>{if(!x||!$)return;let D=!1;return N(!0),A(null),k(null),fetch($).then(z=>{if(!z.ok)throw new Error("fetch failed");return z.blob()}).then(z=>{if(!D){C.current&&URL.revokeObjectURL(C.current);const H=URL.createObjectURL(z);C.current=H,k(H)}}).catch(()=>{D||A("Não foi possível carregar o PDF.")}).finally(()=>{D||N(!1)}),()=>{D=!0}},[x,$]),j.useEffect(()=>()=>{C.current&&URL.revokeObjectURL(C.current)},[]),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:Y("rounded-lg border p-4 space-y-4 transition-colors",u?"border-destructive bg-destructive/5":E?"border-green-500 bg-green-500/5":"border-input"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(O.ScrollText,{className:"h-4 w-4 shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:r||"Termos e condições"})]}),I?o.jsxs(sl,{open:x,onOpenChange:y,children:[o.jsx(kf,{asChild:!0,children:o.jsxs(Te,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:v,children:[v?o.jsx(O.Loader2,{className:"h-3 w-3 animate-spin"}):o.jsx(O.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]})}),o.jsxs(Ao,{className:"max-w-2xl flex flex-col max-h-[90vh]",children:[o.jsx(Do,{children:o.jsxs(Ro,{className:"flex items-center gap-2",children:[o.jsx(O.ScrollText,{className:"h-4 w-4"}),"Termos e condições"]})}),L?o.jsxs("div",{className:"flex-1 min-h-0 space-y-2",children:[w&&o.jsx("div",{className:"w-full h-[62vh] rounded border flex items-center justify-center bg-muted/20",children:o.jsx(O.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"})}),!w&&S&&o.jsxs("div",{className:"w-full h-[62vh] rounded border flex flex-col items-center justify-center gap-2 bg-muted/20",children:[o.jsx(O.AlertCircle,{className:"h-6 w-6 text-muted-foreground"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:S})]}),!w&&b&&o.jsx("iframe",{src:b,className:"w-full h-[62vh] rounded border",title:"Termos e condições"}),o.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:["Prefere abrir fora?"," ",o.jsx("a",{href:$,target:"_blank",rel:"noopener noreferrer",className:"underline text-primary",children:"Abrir em nova aba"})]})]}):o.jsx(Fn,{className:"flex-1 max-h-[62vh] rounded border p-4 bg-muted/20",children:o.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:n})})]})]}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:s&&v?"Carregando PDF...":"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx(rt,{className:"mt-0.5",checked:E,onCheckedChange:D=>l.onChange(D?"accepted":"")}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito ",r?`"${r}"`:"os termos e condições"]}),E&&o.jsx(O.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]}),u&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(O.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),m||"Você precisa aceitar os termos para continuar"]})]})},Sj=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=$e.useController({name:e,control:t}),[c,d]=j.useState(!1),u=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{...i,value:i.value??"",type:c?"text":"password",placeholder:r,disabled:n,readOnly:a,className:Y("pr-10",u&&"border-destructive focus-visible:ring-destructive")}),o.jsx("button",{type:"button",tabIndex:-1,onClick:()=>d(m=>!m),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?o.jsx(O.EyeOff,{size:16}):o.jsx(O.Eye,{size:16})})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Ch=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=$e.useController({name:e,control:t}),c=!!i.value;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[o.jsx(Li,{checked:c,onCheckedChange:d=>!a&&i.onChange(d),disabled:n||a,onBlur:i.onBlur}),o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},$j=({name:e,control:t,minValue:r=0,maxValue:n=100,step:a=1,disabled:s,readOnly:i})=>{var l;const{field:c,fieldState:d}=$e.useController({name:e,control:t}),u=c.value??r;return j.useEffect(()=>{(c.value===void 0||c.value===null)&&c.onChange(r)},[]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Eo,{min:r,max:n,step:a,value:[u],onValueChange:m=>!i&&c.onChange(m[0]),disabled:s||i,className:"flex-1"}),o.jsx("span",{className:"text-sm font-medium text-primary min-w-[3rem] text-right tabular-nums",children:u})]}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:r}),o.jsx("span",{children:n})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",children:d.error.message})]})},ks=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),Ej=({name:e,control:t,disabled:r,readOnly:n})=>{var a;const{field:s,fieldState:i}=$e.useController({name:e,control:t}),l=s.value||"#000000",[c,d]=j.useState(l);return j.useEffect(()=>{d(l)},[l]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("input",{type:"color",value:ks(l)?l:"#000000",disabled:r||n,onChange:u=>s.onChange(u.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"}),o.jsx(ue,{type:"text",value:c,readOnly:n,disabled:r,onChange:u=>{const m=u.target.value;d(m),ks(m)&&s.onChange(m.toUpperCase())},onBlur:()=>{ks(c)||d(l),s.onBlur()},className:Y("flex-1 font-mono uppercase",i.error&&"border-destructive focus-visible:ring-destructive"),maxLength:7,placeholder:"#000000"})]}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},Tj=({name:e,control:t,options:r,placeholder:n,disabled:a,readOnly:s})=>{var i,l;const{field:c,fieldState:d}=$e.useController({name:e,control:t}),[u,m]=j.useState(""),[p,f]=j.useState(!1),[v,h]=j.useState(-1),x=j.useRef(null),y=j.useRef(null),b=`autocomplete-${e}-listbox`,k=((i=r.find($=>$.valor===c.value))==null?void 0:i.label)??"",w=u.length>0?r.filter($=>$.label.toLowerCase().includes(u.toLowerCase())):r;j.useEffect(()=>{const $=I=>{x.current&&!x.current.contains(I.target)&&(f(!1),m(""),h(-1))};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);const N=()=>{f(!1),m(""),h(-1)};j.useEffect(()=>{if(v<0||!y.current)return;const $=y.current.querySelector(`[id="${b}-option-${v}"]`);$==null||$.scrollIntoView({block:"nearest"})},[v,b]);const S=$=>{$.disabled||(c.onChange($.valor),N())},A=()=>{c.onChange(""),m(""),h(-1)},C=$=>{if(!p){($.key==="ArrowDown"||$.key==="ArrowUp")&&($.preventDefault(),f(!0),h(0));return}switch($.key){case"ArrowDown":$.preventDefault(),h(I=>I<w.length-1?I+1:I);break;case"ArrowUp":$.preventDefault(),h(I=>I>0?I-1:0);break;case"Enter":$.preventDefault(),v>=0&&w[v]&&!w[v].disabled&&S(w[v]);break;case"Escape":$.preventDefault(),N();break;case"Tab":N();break}},E=p&&v>=0?`${b}-option-${v}`:void 0;return o.jsxs("div",{className:"space-y-1",ref:x,children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{type:"text",role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":b,"aria-activedescendant":E,value:p?u:k,placeholder:n??"Buscar...",disabled:a,readOnly:s,onChange:$=>{m($.target.value),h(-1),f(!0)},onFocus:()=>!s&&f(!0),onKeyDown:C,className:Y("pr-8",d.error&&"border-destructive focus-visible:ring-destructive"),autoComplete:"off"}),o.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:c.value?o.jsx("button",{type:"button",onClick:A,className:"text-[var(--t-text-muted)] hover:text-[var(--t-text)]",tabIndex:-1,"aria-label":"Limpar seleção",children:o.jsx(O.X,{size:14})}):o.jsx(O.ChevronDown,{size:16,className:"text-muted-foreground pointer-events-none","aria-hidden":"true"})}),p&&!a&&!s&&o.jsx("ul",{role:"listbox",id:b,ref:y,"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:w.length===0?o.jsx("li",{role:"option","aria-selected":!1,className:"px-3 py-2 text-sm text-muted-foreground",children:"Nenhuma opção encontrada"}):w.map(($,I)=>o.jsx("li",{id:`${b}-option-${I}`,role:"option","aria-selected":c.value===$.valor,"aria-disabled":$.disabled,onMouseDown:()=>S($),className:["flex cursor-pointer items-center px-3 py-2 text-sm",$.disabled?"cursor-not-allowed opacity-40":I===v?"bg-accent":"hover:bg-accent",c.value===$.valor?"font-medium text-primary":"text-foreground"].join(" "),children:$.label},$.valor))})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",role:"alert",children:d.error.message})]})},Nh=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=$e.useController({name:e,control:t}),c=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...i,value:i.value??"",type:"time",placeholder:r,disabled:n,readOnly:a,className:Y(c&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Aj=({name:e,control:t,startLabel:r="Data inicial",endLabel:n="Data final",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=$e.useController({name:e,control:t}),d=l.value??{},u=(p,f)=>{l.onChange({...d,[p]:f})},m=!!c.error;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{children:r}),o.jsx(ue,{type:"date",value:d.start??"",disabled:a,readOnly:s,onChange:p=>u("start",p.target.value),max:d.end??void 0,className:Y(m&&"border-destructive focus-visible:ring-destructive")})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{children:n}),o.jsx(ue,{type:"date",value:d.end??"",disabled:a,readOnly:s,onChange:p=>u("end",p.target.value),min:d.start??void 0,className:Y(m&&"border-destructive focus-visible:ring-destructive")})]})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Dj=({name:e,control:t,maxRating:r=5,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=$e.useController({name:e,control:t}),c=i.value??0,d=Array.from({length:r},(u,m)=>m+1);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[d.map(u=>o.jsx("button",{type:"button",disabled:n||a,onClick:()=>i.onChange(u===c?0:u),className:"transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":`${u} estrela${u>1?"s":""}`,children:o.jsx(O.Star,{size:24,className:"transition-colors",fill:u<=c?"var(--color-primary)":"transparent",stroke:u<=c?"var(--color-primary)":"currentColor"})},u)),c>0&&o.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[c,"/",r]})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Rj=({field:e,name:t,control:r,disabled:n,readOnly:a})=>{const s=n||e.isDisabled,i=a||e.isReadOnly;switch(e.tipo){case P.EMAIL:return o.jsx(Tt,{name:t,control:r,type:"email",placeholder:e.placeholder,disabled:s,readOnly:i});case P.NUMBER:return o.jsx(Tt,{name:t,control:r,type:"number",placeholder:e.placeholder,disabled:s,readOnly:i});case P.PASSWORD:return o.jsx(Tt,{name:t,control:r,type:"password",placeholder:e.placeholder,disabled:s,readOnly:i});case P.TELEFONE:return o.jsx(_r,{name:t,control:r,maskType:"telefone",placeholder:e.placeholder??"(00) 00000-0000",disabled:s,readOnly:i});case P.CPF:return o.jsx(_r,{name:t,control:r,maskType:"cpf",placeholder:e.placeholder??"000.000.000-00",disabled:s,readOnly:i});case P.CEP:return o.jsx(_r,{name:t,control:r,maskType:"cep",placeholder:e.placeholder??"00000-000",disabled:s,readOnly:i});case P.TEXTAREA:return o.jsx(Bo,{name:t,control:r,placeholder:e.placeholder,disabled:s,readOnly:i});case P.SELECT:return o.jsx(Uo,{name:t,control:r,options:e.opcoes??[],placeholder:e.placeholder,disabled:s,readOnly:i});case P.CHECKBOX:return o.jsx(Ho,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case P.SWITCH:return o.jsx(Ch,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case P.DATE:return o.jsx(Tn,{name:t,control:r,disabled:s,readOnly:i});case P.TIME:return o.jsx(Nh,{name:t,control:r,disabled:s,readOnly:i});case P.HIDDEN:return o.jsx(qo,{name:t,control:r});default:return o.jsx(Tt,{name:t,control:r,type:"text",placeholder:e.placeholder,disabled:s,readOnly:i})}},Pj=({name:e,control:t,subSchema:r,disabled:n,readOnly:a})=>{if(!r||r.fields.length===0)return null;const s=[...r.fields].sort((i,l)=>i.ordem-l.ordem);return o.jsxs("div",{className:"rounded-xl border border-input bg-muted/30 p-4 space-y-4",children:[r.titulo&&o.jsx("h4",{className:"text-sm font-semibold text-muted-foreground",children:r.titulo}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:s.map(i=>{const l=`${e}.${i.nome}`,c=i.tipo===P.CHECKBOX||i.tipo===P.SWITCH||i.tipo===P.HIDDEN,d=i.tamanho??6;return o.jsxs("div",{className:`col-span-${d}`,children:[!c&&o.jsxs("label",{className:"mb-1 block text-sm font-medium text-foreground",children:[i.label,i.obrigatorio&&o.jsx("span",{className:"text-destructive",children:" *"})]}),o.jsx(Rj,{field:i,name:l,control:t,disabled:n,readOnly:a})]},i.id)})})]})},Sh=({field:e,control:t,nameOverride:r})=>{var n,a;const s=r??e.nome,{componentMapper:i}=Cr(),l=i==null?void 0:i[e.tipo];if(l)return o.jsx(l,{name:s,control:t,field:e});const c={name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly};switch(e.tipo){case P.TEXTO:return o.jsx(Tt,{...c,type:"text"});case P.EMAIL:return o.jsx(Tt,{...c,type:"email"});case P.NUMBER:return o.jsx(Tt,{...c,type:"number"});case P.PASSWORD:return o.jsx(Sj,{...c});case P.TEXTAREA:return o.jsx(Bo,{...c});case P.SELECT:return o.jsx(Uo,{...c,options:e.opcoes??[]});case P.AUTOCOMPLETE:return o.jsx(Tj,{...c,options:e.opcoes??[]});case P.SWITCH:return o.jsx(Ch,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case P.SLIDER:return o.jsx($j,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case P.RATING:return o.jsx(Dj,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case P.COLOR:return o.jsx(Ej,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case P.TIME:return o.jsx(Nh,{...c});case P.DATE_RANGE:return o.jsx(Aj,{name:s,control:t,startLabel:e.dateRangeStartLabel,endLabel:e.dateRangeEndLabel,disabled:e.isDisabled,readOnly:e.isReadOnly});case P.RADIO:return o.jsx(hl,{...c,options:e.opcoes??[]});case P.CHECKBOX:return o.jsx(Ho,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case P.CHECKBOX_GROUP:return o.jsx(fl,{...c,options:e.opcoes??[]});case P.DATE:return o.jsx(Tn,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case P.DATETIME:return o.jsx(Tn,{name:s,control:t,isDatetime:!0,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case P.FILE:return o.jsx(yl,{name:s,control:t,disabled:e.isDisabled,fileTypes:(n=e.validacao)==null?void 0:n.fileTypes,maxFileSize:(a=e.validacao)==null?void 0:a.maxFileSize});case P.TELEFONE:return o.jsx(_r,{...c,maskType:"telefone"});case P.CPF:return o.jsx(_r,{...c,maskType:"cpf"});case P.CEP:return o.jsx(wl,{name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly,cepFillMap:e.cepFillMap});case P.HIDDEN:return o.jsx(qo,{name:s,control:t});case P.PARTICIPATION_TYPE:return o.jsx(bh,{name:s,control:t});case P.PAYMENT_METHOD:return o.jsx(kh,{name:s,control:t,relatedFieldName:e.relatedFieldName});case P.TERMS:return o.jsx(jh,{name:s,control:t,label:e.label,termoTexto:e.termoTexto,termoPdfUrl:e.termoPdfUrl,termoPdfUploadId:e.termoPdfUploadId});case P.FIELD_ARRAY:return o.jsx(vh,{name:s,control:t,subFields:e.subFields,minItems:e.minItems,maxItems:e.maxItems,itemLabel:e.itemLabel,addLabel:e.addLabel});case P.SUB_FORM:return o.jsx(Pj,{name:s,control:t,subSchema:e.subSchema,disabled:e.isDisabled,readOnly:e.isReadOnly});default:return o.jsx(Tt,{...c,type:"text"})}},_j=({container:e,control:t})=>{var r;const{externalData:n={},fieldResolvers:a}=Cr(),s=e.icone?Pt[e.icone]:void 0,i=n,l=j.useMemo(()=>Vo(e,i),[e,JSON.stringify(i)]),c=j.useMemo(()=>[...l.campos].sort((x,y)=>x.ordem-y.ordem),[l.campos]),d=$e.useWatch({control:t}),{wrapperClass:u,wrapperStyle:m,headerClass:p,headerStyle:f,tmpl:v}=uh(),h=x=>{if(!Se(x.condicional,d,n))return null;let y=x;if(x.resolvePropsKey&&a!=null&&a[x.resolvePropsKey]){const S=a[x.resolvePropsKey](x,d,n);y={...x,...S}}if(y.opcoesFromVar){const S=n[y.opcoesFromVar];Array.isArray(S)&&(y={...y,opcoes:S.map(A=>typeof A=="string"?{valor:A,label:A}:A&&typeof A=="object"&&"valor"in A&&"label"in A?A:{valor:String(A),label:String(A)})})}const b=y.tamanho??12,k=y.inicioColuna,w=k?`${k} / span ${b}`:`span ${b}`,N=o.jsx(Sh,{field:y,control:t});return y.tipo===P.CHECKBOX||y.tipo===P.HIDDEN||y.tipo===P.SWITCH?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:w},children:N},y.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:w},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[y.label,y.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),N,y.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:y.hint})]},y.id)};return o.jsxs("div",{className:u,style:m,children:[(l.titulo||s)&&o.jsx("div",{className:p,style:f,children:o.jsxs("div",{className:"flex items-center gap-3",children:[s&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(s,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=v.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:l.titulo}),l.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:l.descricao})]})]})}),o.jsx("div",{className:"p-6 grid grid-cols-12 gap-4",children:c.map(h)})]})},Ij=({container:e,control:t})=>{var r;const{externalData:n={}}=Cr(),a=e.nome??"__invalid__",s=e.minItems??1,i=e.maxItems,l=e.itemLabel??"Item",c=e.icone?Pt[e.icone]:void 0,d=n,u=j.useMemo(()=>Vo(e,d),[e,JSON.stringify(d)]),m=j.useMemo(()=>[...u.campos].sort((C,E)=>C.ordem-E.ordem),[u.campos]),p=j.useCallback(()=>{const C={};for(const E of m)E.initialValue!==void 0?C[E.nome]=typeof E.initialValue=="string"?ht(E.initialValue,d):E.initialValue:E.defaultValue!==void 0&&(C[E.nome]=E.defaultValue);return C},[m,d]),{fields:f,append:v,remove:h}=$e.useFieldArray({control:t,name:a});j.useEffect(()=>{if(e.nome&&f.length<s)for(let C=f.length;C<s;C++)v(p())},[s]);const x=$e.useWatch({control:t}),y=j.useMemo(()=>{const C=x[a];return Array.isArray(C)?C:[]},[x,a]),{wrapperClass:b,wrapperStyle:k,headerClass:w,headerStyle:N,tmpl:S}=uh();if(!e.nome)return console.error("[RepeatableContainerRenderer] container.nome é obrigatório para containers repetíveis. Container id:",e.id),null;const A=(C,E)=>{const $=y[E]??{};if(!Se(C.condicional,$,n))return null;const I=`${a}.${E}.${C.nome}`,L=C.tamanho??12,D=C.inicioColuna,z=D?`${D} / span ${L}`:`span ${L}`,H=o.jsx(Sh,{field:C,control:t,nameOverride:I});return C.tipo===P.CHECKBOX||C.tipo===P.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:z},children:H},`${C.id}-${E}`):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:z},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[C.label,C.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),H,C.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:C.hint})]},`${C.id}-${E}`)};return o.jsxs("div",{className:b,style:k,children:[(u.titulo||c)&&o.jsx("div",{className:w,style:N,children:o.jsxs("div",{className:"flex items-center gap-3",children:[c&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(c,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=S.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:u.titulo}),u.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:u.descricao})]})]})}),o.jsxs("div",{className:"p-6 space-y-4",children:[f.map((C,E)=>o.jsxs("div",{className:"border border-input rounded-lg p-4 bg-muted/30",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 bg-primary text-primary-foreground",children:E+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[l," ",E+1]})]}),f.length>s&&o.jsx("button",{type:"button",onClick:()=>h(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:o.jsx(O.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:m.map($=>A($,E))})]},C.id)),(!i||f.length<i)&&o.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:()=>v(p()),children:[o.jsx(O.Plus,{className:"w-4 h-4"}),"Adicionar ",l.toLowerCase()]}),i&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",i," ",l.toLowerCase(),i>1?"s":""]})]})]})},$h=e=>e.container.repeatable&&e.container.nome?o.jsx(Ij,{...e}):o.jsx(_j,{...e}),Eh=({step:e,control:t,externalData:r={}})=>{const n=j.useMemo(()=>[...e.containers].sort((s,i)=>s.ordem-i.ordem),[e.containers]),a=$e.useWatch({control:t});return o.jsx("div",{className:"grid grid-cols-12 gap-4",children:n.map(s=>{if(s.condicional&&!Se(s.condicional,a,r))return null;const i=s.tamanho??12,l=s.inicioColuna,c=l?`${l} / span ${i}`:`span ${i}`;return o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:c},children:o.jsx($h,{container:s,control:t})},s.id)})})},pa=j.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),Oj=pa.Provider,Fj=()=>{const e=Ah("useFormApi"),t=j.useContext(pa);return{change:(r,n)=>e.setValue(r,n,{shouldValidate:!0,shouldDirty:!0}),reset:r=>e.reset(r),submit:t.requestSubmit,getState:()=>{const{errors:r,isDirty:n,isValid:a}=e.formState;return{values:e.getValues(),errors:Object.fromEntries(Object.entries(r).map(([s,i])=>[s,i==null?void 0:i.message])),warnings:t.warnings,dirty:n,valid:a,submitting:t.submitting}}}},Th=()=>{const e=Ah("useFormState"),t=j.useContext(pa),r=$e.useWatch({control:e.control}),{errors:n,isDirty:a,isValid:s}=e.formState;return{values:r,errors:Object.fromEntries(Object.entries(n).map(([i,l])=>[i,l==null?void 0:l.message])),warnings:t.warnings,dirty:a,valid:s,submitting:t.submitting}},Lj=e=>{var t;const r=$e.useFormContext(),{warnings:n}=j.useContext(pa),a=$e.useWatch({control:r.control,name:e}),s=r.getFieldState(e,r.formState);return{value:a,error:(t=s.error)==null?void 0:t.message,warning:n[e],dirty:s.isDirty,touched:s.isTouched,valid:!s.error}},zj=e=>{var t;const{control:r}=$e.useFormContext(),{warnings:n}=j.useContext(pa),{field:a,fieldState:s}=$e.useController({name:e,control:r});return{input:{name:a.name,value:a.value,onChange:a.onChange,onBlur:a.onBlur,ref:a.ref},meta:{error:(t=s.error)==null?void 0:t.message,warning:n[e],touched:s.isTouched,dirty:s.isDirty,valid:!s.error}}},Ah=e=>{const t=$e.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},dd=({stepIndex:e,totalSteps:t,step:r,defaultValues:n,externalData:a,fieldErrors:s,isSubmitting:i,isUploading:l=!1,submitError:c,validatorMapper:d={},onWarningsChange:u,onValuesChange:m,onSubmit:p,onBack:f})=>{const v=e===t-1,h=j.useMemo(()=>JSON.stringify(a),[a]),x=j.useMemo(()=>ih(r,a,d),[r.id,h]),y=j.useMemo(()=>lh(r,a,d),[r.id,h]),[b,k]=j.useState({}),w=j.useRef(u);w.current=u;const N=a,S=j.useMemo(()=>dh(r,N),[r,h]),A=$e.useForm({resolver:x,defaultValues:n,mode:"onTouched"}),{control:C,handleSubmit:E,setError:$,clearErrors:I,setValue:L}=A;j.useEffect(()=>{I();for(const[q,G]of Object.entries(s))$(q,{type:"server",message:G})},[s,$,I]);const D=j.useMemo(()=>r.containers.filter(q=>!q.repeatable).flatMap(q=>q.campos).filter(q=>!!q.condicional),[r.containers]),z=j.useMemo(()=>r.containers.filter(q=>!!q.condicional),[r.containers]),H=j.useMemo(()=>r.containers.filter(q=>!q.repeatable).flatMap(q=>q.campos).filter(q=>{var G;return q.condicional&&((G=q.setValues)==null?void 0:G.length)}),[r.containers]),U=j.useMemo(()=>r.containers.filter(q=>q.repeatable&&!!q.nome).map(q=>({container:q,fields:q.campos.filter(G=>!!G.condicional)})).filter(q=>q.fields.length>0),[r.containers]),Z=j.useRef({}),V=j.useRef(!0),M=$e.useWatch({control:C}),R=j.useRef(m);R.current=m,j.useEffect(()=>{var q;(q=R.current)==null||q.call(R,M)},[M]),j.useEffect(()=>{let q=!1;return y(M).then(G=>{var ne;q||(k(G),(ne=w.current)==null||ne.call(w,G))}).catch(G=>{q||console.error("[StepForm] warnComputer error:",G)}),()=>{q=!0}},[M,y]),j.useEffect(()=>{var q;if(!D.length&&!H.length&&!z.length&&!U.length)return;const G=M;for(const W of D)if(!Se(W.condicional,G,a)){if(I(W.nome),W.tipo===P.FIELD_ARRAY){const X=G[W.nome];Array.isArray(X)&&X.forEach((re,K)=>{(W.subFields??[]).forEach(J=>I(`${W.nome}.${K}.${J.nome}`))})}if(W.clearedValue!==void 0){const X=W.clearedValue??"";G[W.nome]!==X&&L(W.nome,X,{shouldValidate:!1})}}for(const W of z)if(!Se(W.condicional,G,a))if(W.repeatable&&W.nome)(Array.isArray(G[W.nome])?G[W.nome]:[]).forEach((X,re)=>{for(const K of W.campos)I(`${W.nome}.${re}.${K.nome}`)});else for(const X of W.campos){I(X.nome);const re=X.clearedValue!==void 0?X.clearedValue:void 0;re!==void 0&&G[X.nome]!==re&&L(X.nome,re,{shouldValidate:!1})}for(const{container:W,fields:X}of U){const re=W.nome,K=Array.isArray(G[re])?G[re]:[];for(let J=0;J<K.length;J++){const ce=K[J];for(const se of X)if(!Se(se.condicional,ce,a)&&(I(`${re}.${J}.${se.nome}`),se.clearedValue!==void 0)){const ye=se.clearedValue??"";ce[se.nome]!==ye&&L(`${re}.${J}.${se.nome}`,ye,{shouldValidate:!1})}}}const ne=V.current;for(const W of H){const X=Se(W.condicional,G,a),re=ne?X:Z.current[W.nome]??!1;if(X&&!re&&(q=W.setValues)!=null&&q.length)for(const K of W.setValues){const J=typeof K.valor=="string"?ht(K.valor,N):K.valor;L(K.campo,J,{shouldValidate:!1})}Z.current[W.nome]=X}V.current=!1},[M,D,H,z,U,a,L,I]);const oe=S.icone?Pt[S.icone]:void 0,ge=j.useMemo(()=>()=>{A.handleSubmit(p)()},[p]);return o.jsx($e.FormProvider,{...A,children:o.jsx(Oj,{value:{submitting:i,warnings:b,requestSubmit:ge},children:o.jsx("form",{onSubmit:E(p),noValidate:!0,onKeyDown:q=>{q.key==="Enter"&&q.target.tagName==="INPUT"&&q.preventDefault()},children:o.jsxs("div",{className:"space-y-6",children:[S.showLabel!==!1&&o.jsxs("div",{className:"text-center space-y-2",children:[oe&&o.jsx("div",{className:"w-12 h-12 mx-auto rounded-xl flex items-center justify-center",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(oe,{className:"w-6 h-6",style:{color:"var(--t-primary)"}})}),o.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:S.titulo}),S.descricao&&o.jsx("p",{className:"text-sm text-muted-foreground",children:S.descricao})]}),o.jsx(Eh,{step:S,control:C,externalData:a}),o.jsxs("div",{className:"flex items-center justify-between gap-4 pt-6 pb-2",children:[o.jsxs(Te,{type:"button",variant:"outline",onClick:f,disabled:e===0||l,className:Y(e>0&&!l&&"border-primary/40 text-primary hover:bg-primary/5"),children:[o.jsx(O.ChevronLeft,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),o.jsxs("span",{className:"text-xs font-semibold tabular-nums sm:hidden text-muted-foreground",children:[e+1,"/",t]}),o.jsxs(Te,{type:"submit",disabled:i||l,children:[i?o.jsx(O.Loader2,{className:"w-4 h-4 animate-spin"}):l?o.jsx(O.Loader2,{className:"w-4 h-4 animate-spin"}):v?o.jsx(O.Check,{className:"w-4 h-4"}):o.jsx(O.ChevronRight,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:v?"Finalizar":"Próximo"})]})]}),c&&o.jsx("p",{className:"text-sm text-destructive mt-2 text-center",children:c})]})})})})},Ya=e=>{if(e)return Pt[e]},Mj=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:s=>s.key==="Enter"&&(r==null?void 0:r(a)),className:Y("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:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(O.Check,{className:"w-4 h-4"}):a+1},n.id))}),Vj=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>{const s=Ya(n.icone)??O.CircleDot;return o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:i=>i.key==="Enter"&&(r==null?void 0:r(a)),className:Y("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(O.Check,{className:"w-4 h-4"}):o.jsx(s,{className:"w-4 h-4"})},n.id)})}),Bj=({steps:e,currentStep:t,position:r,orientation:n="horizontal",onStepClick:a})=>n==="vertical"?o.jsx("div",{className:"flex flex-col gap-0",children:e.map((s,i)=>{const l=Ya(s.icone)??O.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:Y("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#fff",boxShadow:"0 0 10px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#fff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(O.Check,{className:"w-3.5 h-3.5"}):o.jsx(l,{className:"w-3.5 h-3.5"})}),!u&&o.jsx("div",{className:"w-[2px] my-1",style:{height:"24px",background:d?"#22c55e":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]}),o.jsx("span",{className:"text-sm font-medium leading-tight mt-1.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]},s.id)})}):o.jsx("div",{className:"w-full flex items-start",children:e.map((s,i)=>{const l=Ya(s.icone)??O.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:Y("flex items-start",!u&&"flex-1"),children:[o.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:Y("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 12px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#ffffff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(O.Check,{className:"w-4 h-4"}):o.jsx(l,{className:"w-4 h-4"})}),o.jsx("span",{className:"text-[10px] font-medium text-center leading-tight line-clamp-2 px-0.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]}),!u&&o.jsx("div",{className:"flex-1 h-[1.5px] mt-5 mx-1",style:{background:d?"linear-gradient(90deg, var(--t-primary), color-mix(in srgb, var(--t-primary) 40%, transparent))":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]},s.id)})}),Dh=({steps:e,currentStep:t,onStepClick:r,className:n,forceShow:a})=>{const s=na(),{layout:i}=s;if(!i.showStepIndicators||e.length<=1&&!a)return null;const l=i.stepIndicatorVariant??"numbers",c=i.stepIndicatorPosition??"top-center",d=i.stepIndicatorOrientation??"horizontal",u=(t+1)/e.length*100,m=e[t],p=Ya(m==null?void 0:m.icone)??O.CircleDot,f=o.jsx("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"color-mix(in srgb, var(--t-primary) 15%, transparent)"},children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${u}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),v=o.jsxs("div",{className:"block sm:hidden space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:o.jsx(p,{className:"w-5 h-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:(m==null?void 0:m.label)??(m==null?void 0:m.id)}),o.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),f]}),h=o.jsxs("div",{className:"hidden sm:block",children:[l==="numbers"&&o.jsx(Mj,{steps:e,currentStep:t,onStepClick:r}),l==="icons"&&o.jsx(Vj,{steps:e,currentStep:t,onStepClick:r}),l==="icons-labeled"&&o.jsx(Bj,{steps:e,currentStep:t,position:c,orientation:d,onStepClick:r})]}),x=i.showProgressBar?o.jsx("div",{className:"hidden sm:block",children:f}):null;return d==="vertical"?o.jsxs("div",{className:Y("flex gap-6 items-start",n),children:[v,o.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[h,x&&o.jsx("div",{className:"flex-1 pt-4",children:x})]})]}):o.jsxs("div",{className:Y("space-y-3",n),children:[v,o.jsxs("div",{className:"hidden sm:block space-y-3",children:[h,x]})]})},Uj=(e,t,r)=>{var n;const a={...t},s=r;for(const i of e.containers){for(const l of i.campos)if(a[l.nome]===void 0&&(l.initialValue!==void 0?a[l.nome]=typeof l.initialValue=="string"?ht(l.initialValue,s):l.initialValue:l.defaultValue!==void 0&&(a[l.nome]=l.defaultValue)),l.tipo===P.FIELD_ARRAY&&(n=l.subFields)!=null&&n.length){const c=a[l.nome];Array.isArray(c)&&c.length>0&&(a[l.nome]=c.map(d=>{const u={...d};for(const m of l.subFields)u[m.nome]===void 0&&(m.initialValue!==void 0?u[m.nome]=typeof m.initialValue=="string"?ht(m.initialValue,s):m.initialValue:m.defaultValue!==void 0&&(u[m.nome]=m.defaultValue));return u}))}if(i.repeatable&&i.nome){const l=a[i.nome];Array.isArray(l)&&l.length>0&&(a[i.nome]=l.map(c=>{const d={...c};for(const u of i.campos)d[u.nome]===void 0&&(u.initialValue!==void 0?d[u.nome]=typeof u.initialValue=="string"?ht(u.initialValue,s):u.initialValue:u.defaultValue!==void 0&&(d[u.nome]=u.defaultValue));return d}))}}return a},Hj=({schema:e,initialValues:t={},initialStep:r=0,onSubmitStep:n,onComplete:a,template:s,formTitle:i,externalData:l={},fieldErrors:c={},uploadFile:d,deleteUploadedFile:u,cepLookup:m,resolveTermsUploadUrl:p,fieldResolvers:f,validatorMapper:v,componentMapper:h,paymentMethodOptions:x,onValuesChange:y,className:b,StepIndicator:k=Dh})=>{const[w,N]=j.useState(()=>r),[S,A]=j.useState({...t}),[C,E]=j.useState(()=>r),[$,I]=j.useState(!1),[L,D]=j.useState(null),[z,H]=j.useState({}),[U,Z]=j.useState(!1),V=j.useRef(0),M=j.useCallback(()=>{V.current+=1,V.current===1&&j.startTransition(()=>Z(!0))},[]),R=j.useCallback(()=>{V.current=Math.max(0,V.current-1),V.current===0&&j.startTransition(()=>Z(!1))},[]),oe=j.useRef(p);oe.current=p;const ge=j.useCallback(T=>oe.current(T),[]),q=!!p,G=j.useRef(u);G.current=u;const ne=j.useCallback(T=>G.current(T),[]),W=!!u,X=j.useMemo(()=>JSON.stringify(l),[l]),re=j.useMemo(()=>JSON.stringify(e.stepConfig),[e.stepConfig]),K=j.useMemo(()=>{const T=io(s);return e.stepConfig?{...T,layout:{...T.layout,...e.stepConfig}}:T},[s,re]),J=j.useMemo(()=>[...e.steps].sort((T,F)=>T.ordem-F.ordem),[e.steps]),ce=J.length,se=ce>0?J[Math.min(w,ce-1)]:null,ye=j.useMemo(()=>se?Uj(se,S,l):{},[se,S,X]),be=j.useMemo(()=>({uploadFile:d,deleteUploadedFile:W?ne:void 0,cepLookup:m,resolveTermsUploadUrl:q?ge:void 0,externalData:l,fieldResolvers:f,validatorMapper:v,fieldWarnings:z,componentMapper:h,paymentMethodOptions:x,onUploadStart:M,onUploadEnd:R}),[d,W,ne,m,ge,q,f,v,z,h,x,M,R,X]),Fe=j.useCallback(async T=>{if(!$){I(!0),D(null);try{const{cleaned:F,fileIdsToDelete:B}=ji(se,T,l);B.length&&u&&await Promise.allSettled(B.map(te=>u(te)));const ie={...S,...F};if(A(ie),n&&await n(w,F),w===ce-1)a&&await a(ie);else{const te=w+1;N(te),E(Q=>Math.max(Q,te))}}catch(F){console.error("[FormRenderer] Submit error:",F);const B=F instanceof Error?F.message:"Ocorreu um erro. Tente novamente.";D(B)}finally{I(!1)}}},[w,S,$,ce,n,a,se,l,u]),Le=j.useCallback(()=>{w>0&&N(T=>T-1)},[w]);if(!se)return o.jsx(Za.Provider,{value:be,children:o.jsx(Yn,{config:K,className:`min-h-dvh ${K.wrapperClass??""} ${b??""}`,renderWrapper:!0,children:o.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 Ve=K.layout.eventTitleStyle??"bar",Ct=(K.layout.stepIndicatorOrientation??"horizontal")==="vertical",Me=ce>=1?o.jsx(k,{steps:J.map(T=>({id:T.id,label:T.titulo,icone:T.icone})),currentStep:w,onStepClick:T=>{!U&&T!==w&&T<=C&&N(T)}}):null;return o.jsx(Za.Provider,{value:be,children:o.jsx(Yn,{config:K,className:`min-h-dvh ${K.wrapperClass??""} ${b??""}`,renderWrapper:!0,children:o.jsxs("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6",children:[i&&Ve==="bar"&&o.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:i}),i&&Ve==="inline"&&o.jsxs("div",{className:"text-center mb-6",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest mb-1",style:{color:"var(--t-text-muted)"},children:"Inscrição"}),o.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:i}),o.jsx("div",{className:"h-0.5 w-12 mx-auto mt-3 rounded-full",style:{background:"var(--t-primary)"}})]}),Ct?o.jsxs("div",{className:"flex gap-6 items-start",children:[o.jsx("div",{className:"hidden sm:block shrink-0 w-44 pt-1",children:Me}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"sm:hidden mb-6",children:Me}),o.jsx(dd,{stepIndex:w,totalSteps:ce,step:se,defaultValues:ye,externalData:l,fieldErrors:c,isSubmitting:$,isUploading:U,submitError:L,validatorMapper:v,onWarningsChange:H,onValuesChange:y,onSubmit:Fe,onBack:Le},w)]})]}):o.jsxs(o.Fragment,{children:[Me&&o.jsx("div",{className:"mb-8",children:Me}),o.jsx(dd,{stepIndex:w,totalSteps:ce,step:se,defaultValues:ye,externalData:l,fieldErrors:c,isSubmitting:$,isUploading:U,submitError:L,validatorMapper:v,onWarningsChange:H,onValuesChange:y,onSubmit:Fe,onBack:Le},w)]})]})})})},Wj=({children:e,render:t,onChange:r})=>{const n=Th(),a=j.useRef(r);return a.current=r,j.useEffect(()=>{var s;(s=a.current)==null||s.call(a,n)},[n.values,n.dirty,n.valid,n.submitting,n.errors,n.warnings]),t?o.jsx(o.Fragment,{children:t(n)}):typeof e=="function"?o.jsx(o.Fragment,{children:e(n)}):e!==void 0?o.jsx(o.Fragment,{children:e}):null},Ir=[{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"}],kl=[{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"}],jl=[{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"}],qe=e=>e.startsWith("step-")||e==="step"?"step":e.startsWith("container-")||e==="container"?"container":"field",qj=e=>Ir.find(t=>t.component===e),Rh=e=>{const t=Ir.map(n=>n.component).filter(n=>n.includes("_"));for(const n of t)if(e.startsWith(n))return Ir.find(a=>a.component===n);const r=e.split("-")[0];return Ir.find(n=>n.component===r)},js=e=>({when:e.campoId,operator:e.operador,value:e.valor,source:e.source}),Ph=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 n=e.extraConditions.map(s=>({campoId:s.when,operador:s.operator,valor:s.value,source:s.source})),a=[r,...n];return e.logicOperator==="or"?{or:a}:{and:a}}return r},_h=e=>{if("campoId"in e)return js(e);const t=("and"in e?e.and:e.or)??[];if(t.length===0)return;const r="and"in e?"and":"or",[n,...a]=t;if(!("campoId"in n)){console.warn("[formSchemaToBuilder] Condicional com grupo aninhado detectada — não suportado no editor visual. A condicional será removida.",e);return}const s=js(n);return a.length===0?s:{...s,logicOperator:r,extraConditions:a.filter(i=>"campoId"in i).map(js)}},Ja=(e,t)=>{var r;if("campoId"in e){const n=(r=t[e.campoId])==null?void 0:r.name;return n?{...e,campoId:n}:e}return"and"in e&&Array.isArray(e.and)?{and:e.and.map(n=>Ja(n,t))}:"or"in e&&Array.isArray(e.or)?{or:e.or.map(n=>Ja(n,t))}:e},Cl=(e,t,r)=>{var n,a;const s=l=>t[l]||{label:l,name:l},i=(((a=(n=e==null?void 0:e.containers)==null?void 0:n.root)==null?void 0:a.children)||[]).filter(l=>qe(l)==="step").map((l,c)=>{var d,u;const m=s(l),p=(((u=(d=e==null?void 0:e.containers)==null?void 0:d[l])==null?void 0:u.children)||[]).filter(f=>qe(f)==="container").map((f,v)=>{var h,x;const y=s(f),b=(((x=(h=e==null?void 0:e.containers)==null?void 0:h[f])==null?void 0:x.children)||[]).filter(w=>qe(w)==="field").map((w,N)=>{var S,A;const C=s(w),E=li(C,w,N);if(E.condicional&&(E.condicional=Ja(E.condicional,t)),E.tipo===P.FIELD_ARRAY){const $=((A=(S=e==null?void 0:e.containers)==null?void 0:S[w])==null?void 0:A.children)??[];E.subFields=$.filter(I=>qe(I)==="field").map((I,L)=>li(s(I),I,L))}return E}),k={id:f,titulo:y.label||"Container",descricao:y.description,icone:y.icone,ordem:v,colunas:y.columns||2,tamanho:y.tamanho||12,inicioColuna:y.inicioColuna,showLabel:y.showLabel,showAsCard:y.showAsCard,campos:b};return y.condition&&(k.condicional=Ja(Ph(y.condition),t)),k});return{id:l,titulo:m.label||"Step",descricao:m.description,icone:m.icone,ordem:c,showLabel:m.showLabel,containers:p}});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:i}},li=(e,t,r)=>{var n,a,s,i;const l={id:t,nome:e.name||t,label:e.label||"",tipo:e.fieldType||"texto",obrigatorio:e.required||!1,tamanho:e.tamanho||6,inicioColuna:e.inicioColuna,ordem:r,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!==void 0?e.clearedValue:void 0,initialValue:e.initialValue!==void 0?e.initialValue:void 0,resolvePropsKey:e.resolvePropsKey||void 0};if((n=e.validate)!=null&&n.length&&(l.validate=e.validate),(a=e.warn)!=null&&a.length&&(l.warn=e.warn),(s=e.options)!=null&&s.length&&(l.opcoes=e.options.map(c=>({valor:c.value,label:c.label,disabled:c.disabled}))),e.validation){const c=e.validation;l.validacao={},c.minLength!==void 0&&(l.validacao.minLength=c.minLength),c.maxLength!==void 0&&(l.validacao.maxLength=c.maxLength),c.min!==void 0&&(l.validacao.min=c.min),c.max!==void 0&&(l.validacao.max=c.max),c.regex&&(l.validacao.regex=c.regex),c.regexMessage&&(l.validacao.regexMessage=c.regexMessage),c.minDate&&(l.validacao.minDate=c.minDate),c.maxDate&&(l.validacao.maxDate=c.maxDate),c.minAge!==void 0&&(l.validacao.minAge=c.minAge),c.maxAge!==void 0&&(l.validacao.maxAge=c.maxAge),(i=c.fileTypes)!=null&&i.length&&(l.validacao.fileTypes=c.fileTypes),c.maxFileSize!==void 0&&(l.validacao.maxFileSize=c.maxFileSize)}if(l.tipo===P.FIELD_ARRAY&&(e.itemLabel&&(l.itemLabel=e.itemLabel),e.minItems!==void 0&&(l.minItems=e.minItems),e.maxItems!==void 0&&(l.maxItems=e.maxItems),e.addLabel&&(l.addLabel=e.addLabel)),l.tipo===P.TERMS&&(e.termoTexto&&(l.termoTexto=e.termoTexto),e.termoPdfUrl&&(l.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(l.termoPdfUploadId=e.termoPdfUploadId)),l.tipo===P.SLIDER&&(e.step!==void 0&&(l.step=e.step),e.minValue!==void 0&&(l.minValue=e.minValue),e.maxValue!==void 0&&(l.maxValue=e.maxValue)),l.tipo===P.RATING&&e.maxRating!==void 0&&(l.maxRating=e.maxRating),l.tipo===P.DATE_RANGE&&(e.dateRangeStartLabel&&(l.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(l.dateRangeEndLabel=e.dateRangeEndLabel)),l.tipo===P.SUB_FORM){const c=e.subSchemaFields??[];(c.length>0||e.subSchemaTitle)&&(l.subSchema={titulo:e.subSchemaTitle,fields:c.map((d,u)=>li(d,d.name??`subfield-${u}`,u))})}return e.condition&&(l.condicional=Ph(e.condition)),l},Ih=e=>{const t={},r={root:{children:[]}},n=[...e.steps].sort((a,s)=>a.ordem-s.ordem);for(const a of n){const s=a.id||`step-${Nt()}`;r.root.children.push(s),t[s]={label:a.titulo,name:s,fieldType:"step",description:a.descricao,icone:a.icone,showLabel:a.showLabel};const i=[],l=[...a.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l){const d=c.id||`container-${Nt()}`;i.push(d);const u=c.condicional?_h(c.condicional):void 0;t[d]={label:c.titulo,name:d,fieldType:"container",description:c.descricao,icone:c.icone,columns:c.colunas,tamanho:c.tamanho||12,inicioColuna:c.inicioColuna,showLabel:c.showLabel,showAsCard:c.showAsCard,...u?{condition:u}:{}};const m=[],p=[...c.campos].sort((f,v)=>f.ordem-v.ordem);for(const f of p){const v=f.id||`${f.tipo}-${Nt()}`;if(m.push(v),t[v]=ci(f),f.tipo===P.FIELD_ARRAY){const h=[];for(const x of f.subFields??[]){const y=x.id||`${x.tipo}-${Nt()}`;h.push(y),t[y]=ci(x)}r[v]={children:h}}}r[d]={children:m}}r[s]={children:i}}return{dndState:{containers:r},configs:t,templateId:e.template??null,stepConfig:e.stepConfig}},ci=(e,t)=>{var r,n,a,s;const i={label:e.label,name:e.nome,fieldType:e.tipo,required:e.obrigatorio,tamanho:e.tamanho,inicioColuna:e.inicioColuna,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!==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:(n=e.warn)!=null&&n.length?e.warn:void 0};if((a=e.opcoes)!=null&&a.length&&(i.options=e.opcoes.map(l=>({value:l.valor,label:l.label,disabled:l.disabled}))),e.validacao){const l=e.validacao;i.validation={},l.minLength!==void 0&&(i.validation.minLength=l.minLength),l.maxLength!==void 0&&(i.validation.maxLength=l.maxLength),l.min!==void 0&&(i.validation.min=l.min),l.max!==void 0&&(i.validation.max=l.max),l.regex&&(i.validation.regex=l.regex),l.regexMessage&&(i.validation.regexMessage=l.regexMessage),l.minDate&&(i.validation.minDate=l.minDate),l.maxDate&&(i.validation.maxDate=l.maxDate),l.minAge!==void 0&&(i.validation.minAge=l.minAge),l.maxAge!==void 0&&(i.validation.maxAge=l.maxAge),(s=l.fileTypes)!=null&&s.length&&(i.validation.fileTypes=l.fileTypes),l.maxFileSize!==void 0&&(i.validation.maxFileSize=l.maxFileSize)}if(e.tipo===P.FIELD_ARRAY&&(e.itemLabel&&(i.itemLabel=e.itemLabel),e.minItems!==void 0&&(i.minItems=e.minItems),e.maxItems!==void 0&&(i.maxItems=e.maxItems),e.addLabel&&(i.addLabel=e.addLabel)),e.tipo===P.TERMS&&(e.termoTexto&&(i.termoTexto=e.termoTexto),e.termoPdfUrl&&(i.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(i.termoPdfUploadId=e.termoPdfUploadId)),e.tipo===P.SLIDER&&(e.step!==void 0&&(i.step=e.step),e.minValue!==void 0&&(i.minValue=e.minValue),e.maxValue!==void 0&&(i.maxValue=e.maxValue)),e.tipo===P.RATING&&e.maxRating!==void 0&&(i.maxRating=e.maxRating),e.tipo===P.DATE_RANGE&&(e.dateRangeStartLabel&&(i.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(i.dateRangeEndLabel=e.dateRangeEndLabel)),e.tipo===P.SUB_FORM&&e.subSchema&&(i.subSchemaTitle=e.subSchema.titulo,i.subSchemaFields=e.subSchema.fields.map(l=>ci(l,l.id))),e.condicional){const l=_h(e.condicional);l&&(i.condition=l)}return i},Oh=(e,t)=>{var r,n,a,s,i,l,c,d,u,m,p;const f=[],v=[],h=b=>t[b]||{label:b,name:b},x=((n=(r=e==null?void 0:e.containers)==null?void 0:r.root)==null?void 0:n.children)||[],y=new Set;for(const b of x){if(qe(b)!=="step")continue;const k=h(b).label||b,w=((s=(a=e==null?void 0:e.containers)==null?void 0:a[b])==null?void 0:s.children)||[];if(w.length===0){v.push(`Step "${k}" está vazio (sem containers).`);continue}for(const N of w){if(qe(N)!=="container")continue;const S=h(N).label||N,A=((l=(i=e==null?void 0:e.containers)==null?void 0:i[N])==null?void 0:l.children)||[],C=new Map;for(const E of A){if(qe(E)!=="field")continue;y.add(E);const $=h(E).name;(!$||!$.trim())&&f.push(`Campo "${h(E).label||E}" (${E}) no container "${S}" não tem nome definido.`);const I=$||E;C.has(I)||C.set(I,[]),C.get(I).push(E)}for(const[E,$]of C.entries())$.length>1&&f.push(`Nome duplicado "${E}" no container "${S}" (IDs: ${$.join(", ")}).`)}}for(const[b,k]of Object.entries(t)){if(!((c=k.condition)!=null&&c.when))continue;const w=k.condition.when;if(!y.has(w)){const N=k.label||b;v.push(`Campo "${N}" referencia campo inexistente na condição (when: "${w}").`)}}for(const b of x){if(qe(b)!=="step")continue;const k=h(b).label||b,w=((u=(d=e==null?void 0:e.containers)==null?void 0:d[b])==null?void 0:u.children)||[],N=new Map;for(const S of w){if(qe(S)!=="container")continue;const A=((p=(m=e==null?void 0:e.containers)==null?void 0:m[S])==null?void 0:p.children)||[];for(const C of A){if(qe(C)!=="field")continue;const E=h(C).name||C;N.has(E)||N.set(E,new Set),N.get(E).add(S)}}for(const[S,A]of N.entries())A.size>1&&f.push(`Nome duplicado "${S}" no step "${k}" em containers diferentes (containers: ${[...A].join(", ")}). Isso causa colisão no formulário.`)}return{errors:f,warnings:v}},Fh=j.createContext(null),Gj=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]},Cs=(e,t)=>{const r=t||Gj(e),n=r==="step",a=r==="container",s=r==="field_array";return{label:n?"Novo Step":a?"Novo Container":s?"Lista de itens":r||e,name:e,fieldType:r||"texto",required:!1,columns:2,tamanho:a||s?12:n?void 0:6,showLabel:a?!0:void 0,itemLabel:s?"Item":void 0}},Ns=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))},Lh=(e,t)=>{const r=[e],n=t[e];if(n!=null&&n.children)for(const a of n.children)r.push(...Lh(a,t));return r},Nl=(e,t)=>{for(const[r,n]of Object.entries(t))if(n.children.includes(e))return r;return null},zh=({children:e,initialConfigs:t,initialContainers:r,initialTemplateId:n,initialStepConfig:a,schemaId:s,uploadTermsPdf:i,deleteTermsPdf:l})=>{const[c,d]=j.useState({selectedId:null,configs:t||{},showPreview:!1,containers:r??{root:{children:[]}},previewTemplateId:n||"moderno",stepConfig:a??{}}),[u,m]=j.useState(null),[p,f]=j.useState(null),v=j.useRef([]),h=j.useRef([]),x=M=>{v.current=[...v.current.slice(-49),Ns(M)],h.current=[]},y=j.useCallback(()=>{d(M=>(x(M),{...M}))},[]),b=j.useCallback(()=>{v.current.length!==0&&d(M=>{h.current=[...h.current,Ns(M)];const R=v.current.pop();return{...M,containers:R.containers,configs:R.configs}})},[]),k=j.useCallback(()=>{h.current.length!==0&&d(M=>{v.current=[...v.current,Ns(M)];const R=h.current.pop();return{...M,containers:R.containers,configs:R.configs}})},[]);j.useEffect(()=>{const M=R=>{const oe=R.metaKey||R.ctrlKey;oe&&R.key==="z"&&!R.shiftKey&&(R.preventDefault(),b()),oe&&R.key==="z"&&R.shiftKey&&(R.preventDefault(),k()),oe&&R.key==="y"&&(R.preventDefault(),k())};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[b,k]);const w=j.useCallback(M=>c.configs[M]??Cs(M),[c.configs]),N=j.useCallback(()=>{const M=[],R=oe=>{var ge;const q=((ge=c.containers[oe])==null?void 0:ge.children)??[];for(const G of q)qe(G)==="field"?M.push(G):c.containers[G]&&R(G)};return R("root"),M},[c.containers]),S=j.useCallback(M=>{d(R=>({...R,selectedId:M}))},[]),A=j.useCallback(M=>{d(R=>({...R,showPreview:M}))},[]),C=j.useCallback(M=>{d(R=>({...R,previewTemplateId:M}))},[]),E=j.useCallback(M=>{d(R=>({...R,stepConfig:{...R.stepConfig,...M}}))},[]),$=j.useCallback((M,R)=>{d(oe=>({...oe,configs:{...oe.configs,[M]:{...oe.configs[M]??Cs(M),...R}}}))},[]),I=j.useCallback((M,R,oe)=>{const ge=`${M}-${Nt()}`,q=qe(ge);return d(G=>{var ne;x(G);const W={...G.containers};(q==="step"||q==="container"||M==="field_array")&&(W[ge]={children:[]});const X=[...((ne=W[R])==null?void 0:ne.children)??[]];return oe!==void 0&&oe>=0?X.splice(oe,0,ge):X.push(ge),W[R]={children:X},{...G,containers:W,configs:{...G.configs,[ge]:Cs(ge,M)},selectedId:ge}}),ge},[]),L=j.useCallback((M,R)=>{const oe=`container-${Nt()}`;return d(ge=>{var q,G,ne;x(ge);const W={...ge.containers},X={...ge.configs},re=[];for(const J of M.containerTemplate.campos){const ce=J.locked&&J.id?J.id:`${String(J.tipo).toLowerCase()}-${Nt()}`;if(re.push(ce),X[ce]={label:J.label,name:J.locked?J.id:J.nome,fieldType:J.tipo,required:J.obrigatorio||!1,placeholder:J.placeholder,hint:J.hint,tamanho:J.tamanho||6,inicioColuna:J.inicioColuna,defaultValue:J.defaultValue!=null?String(J.defaultValue):void 0,locked:J.locked||!1,options:(q=J.opcoes)==null?void 0:q.map(se=>({value:se.valor,label:se.label})),...J.tipo==="field_array"&&{itemLabel:J.itemLabel,minItems:J.minItems,maxItems:J.maxItems,addLabel:J.addLabel}},J.tipo==="field_array"){const se=[];for(const ye of J.subFields??[]){const be=`${String(ye.tipo).toLowerCase()}-${Nt()}`;se.push(be),X[be]={label:ye.label,name:ye.nome,fieldType:ye.tipo,required:ye.obrigatorio||!1,placeholder:ye.placeholder,hint:ye.hint,tamanho:ye.tamanho||6,inicioColuna:ye.inicioColuna,options:(G=ye.opcoes)==null?void 0:G.map(Fe=>({value:Fe.valor,label:Fe.label}))}}W[ce]={children:se}}}W[oe]={children:re},X[oe]={label:M.containerTemplate.titulo||M.name,description:M.containerTemplate.descricao,icone:M.containerTemplate.icone,tamanho:M.containerTemplate.tamanho||12,inicioColuna:M.containerTemplate.inicioColuna,showLabel:!0};const K=[...((ne=W[R])==null?void 0:ne.children)??[]];return K.push(oe),W[R]={children:K},{...ge,containers:W,configs:X,selectedId:oe}}),oe},[]),D=j.useCallback(M=>{const R=[];return d(oe=>{var ge,q,G;x(oe);const ne={...oe.containers},W={...oe.configs};for(const X of M.steps){const re=`step-${Nt()}`;R.push(re);const K=[];for(const ce of X.containers){const se=`container-${Nt()}`;K.push(se);const ye=[];for(const be of ce.campos){const Fe=be.locked&&be.id?be.id:`${String(be.tipo).toLowerCase()}-${Nt()}`;if(ye.push(Fe),W[Fe]={label:be.label,name:be.locked?be.id:be.nome,fieldType:be.tipo,required:be.obrigatorio||!1,placeholder:be.placeholder,hint:be.hint,tamanho:be.tamanho||12,inicioColuna:be.inicioColuna,defaultValue:be.defaultValue!=null?String(be.defaultValue):void 0,locked:be.locked||!1,options:(ge=be.opcoes)==null?void 0:ge.map(Le=>({value:Le.valor,label:Le.label})),...be.tipo==="field_array"&&{itemLabel:be.itemLabel,minItems:be.minItems,maxItems:be.maxItems,addLabel:be.addLabel}},be.tipo==="field_array"){const Le=[];for(const Ve of be.subFields??[]){const Ct=`${String(Ve.tipo).toLowerCase()}-${Nt()}`;Le.push(Ct),W[Ct]={label:Ve.label,name:Ve.nome,fieldType:Ve.tipo,required:Ve.obrigatorio||!1,placeholder:Ve.placeholder,hint:Ve.hint,tamanho:Ve.tamanho||6,inicioColuna:Ve.inicioColuna,options:(q=Ve.opcoes)==null?void 0:q.map(Me=>({value:Me.valor,label:Me.label}))}}ne[Fe]={children:Le}}}ne[se]={children:ye},W[se]={label:ce.titulo,description:ce.descricao,icone:ce.icone,tamanho:ce.tamanho||12,showLabel:!0}}ne[re]={children:K},W[re]={label:X.titulo,description:X.descricao,icone:X.icone};const J=[...((G=ne.root)==null?void 0:G.children)??[],re];ne.root={children:J}}return{...oe,containers:ne,configs:W,selectedId:R[0]??oe.selectedId}}),R},[]),z=j.useCallback((M,R,oe,ge)=>{d(q=>{var G,ne;x(q);const W={...q.containers},X=(((G=W[R])==null?void 0:G.children)??[]).filter(J=>J!==M);W[R]={children:X};const re=[...(((ne=W[oe])==null?void 0:ne.children)??[]).filter(J=>J!==M)],K=Math.max(0,Math.min(ge,re.length));return re.splice(K,0,M),W[oe]={children:re},{...q,containers:W}})},[]),H=j.useCallback((M,R)=>{d(oe=>(x(oe),{...oe,containers:{...oe.containers,[M]:{children:R}}}))},[]),U=j.useCallback(M=>{d(R=>{x(R);const oe=Lh(M,R.containers),ge={};for(const[G,ne]of Object.entries(R.containers))oe.includes(G)||(ge[G]={children:ne.children.filter(W=>!oe.includes(W))});const q={...R.configs};for(const G of oe)delete q[G];return{...R,containers:ge,configs:q,selectedId:oe.includes(R.selectedId??"")?null:R.selectedId}})},[]),Z=j.useCallback((M,R)=>{d(oe=>{const ge=Nl(M,oe.containers);if(!ge)return oe;const q=[...oe.containers[ge].children],G=q.indexOf(M),ne=R==="up"?G-1:G+1;return ne<0||ne>=q.length?oe:([q[G],q[ne]]=[q[ne],q[G]],{...oe,containers:{...oe.containers,[ge]:{children:q}}})})},[]),V=j.useCallback((M,R)=>{y(),Z(M,R)},[Z,y]);return o.jsx(Fh.Provider,{value:{selectedId:c.selectedId,configs:c.configs,showPreview:c.showPreview,containers:c.containers,positionDrag:u,reorderDrag:p,canUndo:v.current.length>0,canRedo:h.current.length>0,schemaId:s,uploadTermsPdf:i,deleteTermsPdf:l,previewTemplateId:c.previewTemplateId,setPreviewTemplateId:C,stepConfig:c.stepConfig,updateStepConfig:E,getConfig:w,getAllFieldIds:N,setSelected:S,updateConfig:$,setShowPreview:A,addItem:I,addPresetBlock:L,addPresetStepBlock:D,moveCanvasItem:z,reorderInContainer:H,removeItem:U,moveItem:V,moveItemNoSnapshot:Z,setPositionDrag:m,setReorderDrag:f,undo:b,redo:k,pushSnapshot:y},children:e})},xt=()=>{const e=j.useContext(Fh);if(!e)throw new Error("useBuilder must be inside BuilderProvider");return e},Xj=()=>{const{containers:e,configs:t,stepConfig:r}=xt(),n=j.useCallback(s=>Cl({containers:e},t,{...s,stepConfig:r}),[e,t,r]),a=j.useCallback(()=>Oh({containers:e},t),[e,t]);return{buildSchema:n,validate:a}};function Mh(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=Mh(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Zj(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=Mh(e))&&(n&&(n+=" "),n+=t);return n}const Kj=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},Yj=(e,t)=>({classGroupId:e,validator:t}),Vh=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Qa="-",ud=[],Jj="arbitrary..",Qj=e=>{const t=tC(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return eC(a);const s=a.split(Qa),i=s[0]===""&&s.length>1?1:0;return Bh(s,i,t)},getConflictingClassGroupIds:(a,s)=>{if(s){const i=n[a],l=r[a];return i?l?Kj(l,i):i:l||ud}return r[a]||ud}}},Bh=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const c=Bh(e,t+1,a);if(c)return c}const s=r.validators;if(s===null)return;const i=t===0?e.join(Qa):e.slice(t).join(Qa),l=s.length;for(let c=0;c<l;c++){const d=s[c];if(d.validator(i))return d.classGroupId}},eC=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?Jj+n:void 0})(),tC=e=>{const{theme:t,classGroups:r}=e;return rC(r,t)},rC=(e,t)=>{const r=Vh();for(const n in e){const a=e[n];Sl(a,r,n,t)}return r},Sl=(e,t,r,n)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];nC(i,t,r,n)}},nC=(e,t,r,n)=>{if(typeof e=="string"){aC(e,t,r);return}if(typeof e=="function"){oC(e,t,r,n);return}sC(e,t,r,n)},aC=(e,t,r)=>{const n=e===""?t:Uh(t,e);n.classGroupId=r},oC=(e,t,r,n)=>{if(iC(e)){Sl(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(Yj(r,e))},sC=(e,t,r,n)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[l,c]=a[i];Sl(c,Uh(t,l),r,n)}},Uh=(e,t)=>{let r=e;const n=t.split(Qa),a=n.length;for(let s=0;s<a;s++){const i=n[s];let l=r.nextPart.get(i);l||(l=Vh(),r.nextPart.set(i,l)),r=l}return r},iC=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,lC=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const a=(s,i)=>{r[s]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let i=r[s];if(i!==void 0)return i;if((i=n[s])!==void 0)return a(s,i),i},set(s,i){s in r?r[s]=i:a(s,i)}}},di="!",md=":",cC=[],pd=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),dC=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=a=>{const s=[];let i=0,l=0,c=0,d;const u=a.length;for(let h=0;h<u;h++){const x=a[h];if(i===0&&l===0){if(x===md){s.push(a.slice(c,h)),c=h+1;continue}if(x==="/"){d=h;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const m=s.length===0?a:a.slice(c);let p=m,f=!1;m.endsWith(di)?(p=m.slice(0,-1),f=!0):m.startsWith(di)&&(p=m.slice(1),f=!0);const v=d&&d>c?d-c:void 0;return pd(s,f,p,v)};if(t){const a=t+md,s=n;n=i=>i.startsWith(a)?s(i.slice(a.length)):pd(cC,!1,i,void 0,!0)}if(r){const a=n;n=s=>r({className:s,parseClassName:a})}return n},uC=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let a=[];for(let s=0;s<r.length;s++){const i=r[s],l=i[0]==="[",c=t.has(i);l||c?(a.length>0&&(a.sort(),n.push(...a),a=[]),n.push(i)):a.push(i)}return a.length>0&&(a.sort(),n.push(...a)),n}},mC=e=>({cache:lC(e.cacheSize),parseClassName:dC(e),sortModifiers:uC(e),...Qj(e)}),pC=/\s+/,fC=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],l=e.trim().split(pC);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:m,modifiers:p,hasImportantModifier:f,baseClassName:v,maybePostfixModifierPosition:h}=r(u);if(m){c=u+(c.length>0?" "+c:c);continue}let x=!!h,y=n(x?v.substring(0,h):v);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=n(v),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}const b=p.length===0?"":p.length===1?p[0]:s(p).join(":"),k=f?b+di:b,w=k+y;if(i.indexOf(w)>-1)continue;i.push(w);const N=a(y,x);for(let S=0;S<N.length;++S){const A=N[S];i.push(k+A)}c=u+(c.length>0?" "+c:c)}return c},hC=(...e)=>{let t=0,r,n,a="";for(;t<e.length;)(r=e[t++])&&(n=Hh(r))&&(a&&(a+=" "),a+=n);return a},Hh=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Hh(e[n]))&&(r&&(r+=" "),r+=t);return r},xC=(e,...t)=>{let r,n,a,s;const i=c=>{const d=t.reduce((u,m)=>m(u),e());return r=mC(d),n=r.cache.get,a=r.cache.set,s=l,l(c)},l=c=>{const d=n(c);if(d)return d;const u=fC(c,r);return a(c,u),u};return s=i,(...c)=>s(hC(...c))},gC=[],ot=e=>{const t=r=>r[e]||gC;return t.isThemeGetter=!0,t},Wh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,qh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,vC=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,bC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,yC=/\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$/,wC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,kC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$r=e=>vC.test(e),Ne=e=>!!e&&!Number.isNaN(Number(e)),Er=e=>!!e&&Number.isInteger(Number(e)),Ss=e=>e.endsWith("%")&&Ne(e.slice(0,-1)),hr=e=>bC.test(e),Gh=()=>!0,CC=e=>yC.test(e)&&!wC.test(e),$l=()=>!1,NC=e=>kC.test(e),SC=e=>jC.test(e),$C=e=>!pe(e)&&!he(e),EC=e=>Br(e,Kh,$l),pe=e=>Wh.test(e),Gr=e=>Br(e,Yh,CC),fd=e=>Br(e,OC,Ne),TC=e=>Br(e,Qh,Gh),AC=e=>Br(e,Jh,$l),hd=e=>Br(e,Xh,$l),DC=e=>Br(e,Zh,SC),Aa=e=>Br(e,ex,NC),he=e=>qh.test(e),Hn=e=>an(e,Yh),RC=e=>an(e,Jh),xd=e=>an(e,Xh),PC=e=>an(e,Kh),_C=e=>an(e,Zh),Da=e=>an(e,ex,!0),IC=e=>an(e,Qh,!0),Br=(e,t,r)=>{const n=Wh.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},an=(e,t,r=!1)=>{const n=qh.exec(e);return n?n[1]?t(n[1]):r:!1},Xh=e=>e==="position"||e==="percentage",Zh=e=>e==="image"||e==="url",Kh=e=>e==="length"||e==="size"||e==="bg-size",Yh=e=>e==="length",OC=e=>e==="number",Jh=e=>e==="family-name",Qh=e=>e==="number"||e==="weight",ex=e=>e==="shadow",FC=()=>{const e=ot("color"),t=ot("font"),r=ot("text"),n=ot("font-weight"),a=ot("tracking"),s=ot("leading"),i=ot("breakpoint"),l=ot("container"),c=ot("spacing"),d=ot("radius"),u=ot("shadow"),m=ot("inset-shadow"),p=ot("text-shadow"),f=ot("drop-shadow"),v=ot("blur"),h=ot("perspective"),x=ot("aspect"),y=ot("ease"),b=ot("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...w(),he,pe],S=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],C=()=>[he,pe,c],E=()=>[$r,"full","auto",...C()],$=()=>[Er,"none","subgrid",he,pe],I=()=>["auto",{span:["full",Er,he,pe]},Er,he,pe],L=()=>[Er,"auto",he,pe],D=()=>["auto","min","max","fr",he,pe],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...C()],Z=()=>[$r,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],V=()=>[$r,"screen","full","dvw","lvw","svw","min","max","fit",...C()],M=()=>[$r,"screen","full","lh","dvh","lvh","svh","min","max","fit",...C()],R=()=>[e,he,pe],oe=()=>[...w(),xd,hd,{position:[he,pe]}],ge=()=>["no-repeat",{repeat:["","x","y","space","round"]}],q=()=>["auto","cover","contain",PC,EC,{size:[he,pe]}],G=()=>[Ss,Hn,Gr],ne=()=>["","none","full",d,he,pe],W=()=>["",Ne,Hn,Gr],X=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[Ne,Ss,xd,hd],J=()=>["","none",v,he,pe],ce=()=>["none",Ne,he,pe],se=()=>["none",Ne,he,pe],ye=()=>[Ne,he,pe],be=()=>[$r,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[hr],breakpoint:[hr],color:[Gh],container:[hr],"drop-shadow":[hr],ease:["in","out","in-out"],font:[$C],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[hr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[hr],shadow:[hr],spacing:["px",Ne],text:[hr],"text-shadow":[hr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$r,pe,he,x]}],container:["container"],columns:[{columns:[Ne,pe,he,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],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:[Er,"auto",he,pe]}],basis:[{basis:[$r,"full","auto",l,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,$r,"auto","initial","none",pe]}],grow:[{grow:["",Ne,he,pe]}],shrink:[{shrink:["",Ne,he,pe]}],order:[{order:[Er,"first","last","none",he,pe]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],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:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...M()]}],"min-block-size":[{"min-block":["auto",...M()]}],"max-block-size":[{"max-block":["none",...M()]}],w:[{w:[l,"screen",...Z()]}],"min-w":[{"min-w":[l,"screen","none",...Z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",r,Hn,Gr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,IC,TC]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ss,pe]}],"font-family":[{font:[RC,AC,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:[a,he,pe]}],"line-clamp":[{"line-clamp":[Ne,"none",he,fd]}],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:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",he,Gr]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[Ne,"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:oe()}],"bg-repeat":[{bg:ge()}],"bg-size":[{bg:q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Er,he,pe],radial:["",he,pe],conic:[Er,he,pe]},_C,DC]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-bs":[{"border-bs":W()}],"border-w-be":[{"border-be":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-bs":[{"border-bs":R()}],"border-color-be":[{"border-be":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,he,pe]}],"outline-w":[{outline:["",Ne,Hn,Gr]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",u,Da,Aa]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",m,Da,Aa]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[Ne,Gr]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",p,Da,Aa]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[Ne,he,pe]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"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":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[he,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"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":w()}],"mask-image-conic-pos":[{"mask-conic":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:ge()}],"mask-size":[{mask:q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",he,pe]}],filter:[{filter:["","none",he,pe]}],blur:[{blur:J()}],brightness:[{brightness:[Ne,he,pe]}],contrast:[{contrast:[Ne,he,pe]}],"drop-shadow":[{"drop-shadow":["","none",f,Da,Aa]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",Ne,he,pe]}],"hue-rotate":[{"hue-rotate":[Ne,he,pe]}],invert:[{invert:["",Ne,he,pe]}],saturate:[{saturate:[Ne,he,pe]}],sepia:[{sepia:["",Ne,he,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",he,pe]}],"backdrop-blur":[{"backdrop-blur":J()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,he,pe]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,he,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,he,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,he,pe]}],"backdrop-invert":[{"backdrop-invert":["",Ne,he,pe]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,he,pe]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,he,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,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:[Ne,"initial",he,pe]}],ease:[{ease:["linear","initial",y,he,pe]}],delay:[{delay:[Ne,he,pe]}],animate:[{animate:["none",b,he,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,he,pe]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:se()}],"scale-x":[{"scale-x":se()}],"scale-y":[{"scale-y":se()}],"scale-z":[{"scale-z":se()}],"scale-3d":["scale-3d"],skew:[{skew:ye()}],"skew-x":[{"skew-x":ye()}],"skew-y":[{"skew-y":ye()}],transform:[{transform:[he,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"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",...R()]}],"stroke-w":[{stroke:[Ne,Hn,Gr,fd]}],stroke:[{stroke:["none",...R()]}],"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"]}},LC=xC(FC);function Ut(...e){return LC(Zj(e))}const br=({onInsert:e})=>{const[t,r]=j.useState(null),n=async a=>{const s=`{{${a}}}`;try{await navigator.clipboard.writeText(s)}catch{const i=document.createElement("textarea");i.value=s,i.style.position="fixed",i.style.opacity="0",document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i)}e&&e(s),r(a),setTimeout(()=>r(null),1500)};return o.jsxs(_o,{children:[o.jsx(Io,{asChild:!0,children:o.jsx(Te,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 text-muted-foreground hover:text-primary",title:"Inserir variável do evento",children:o.jsx(O.Braces,{className:"h-3.5 w-3.5"})})}),o.jsxs(ua,{className:"w-80 p-0",align:"end",side:"left",sideOffset:6,children:[o.jsxs("div",{className:"px-3 py-2 border-b border-border",children:[o.jsx("p",{className:"text-xs font-semibold text-foreground",children:"Variáveis do evento"}),o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Clique para copiar. Use"," ",o.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"{{evento.xxx}}"})," ","em labels, placeholders e hints."]})]}),o.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:jl.map(a=>{const s=t===a.key;return o.jsxs("button",{type:"button",onClick:()=>n(a.key),className:Ut("w-full flex items-center justify-between px-3 py-1.5 text-left hover:bg-accent transition-colors",s&&"bg-primary/10"),children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xs font-medium truncate",children:a.label}),o.jsx("code",{className:"text-[10px] text-muted-foreground font-mono",children:`{{${a.key}}}`})]}),o.jsx("div",{className:"ml-2 shrink-0",children:s?o.jsx(O.Check,{className:"h-3.5 w-3.5 text-primary"}):o.jsx(O.Braces,{className:"h-3 w-3 text-muted-foreground/50"})})]},a.key)})})]})]})},zC=({config:e,onUpdate:t})=>o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(le,{className:"text-xs",children:"Label"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(le,{className:"text-xs",children:"Descrição"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do step"})]}),o.jsx(sh,{value:e.icone,onChange:r=>t({icone:r})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"step-show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(le,{htmlFor:"step-show-label",className:"text-xs cursor-pointer",children:"Exibir título no formulário"})]})]}),MC=({inicioColuna:e,tamanho:t,onSelect:r})=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(le,{className:"text-xs",children:"Posição no grid"}),o.jsx("div",{className:"flex gap-0.5",children:Array.from({length:12},(n,a)=>{const s=a+1,i=s>=e&&s<e+t;return o.jsx("button",{onClick:()=>r(s),className:Ut("flex-1 h-6 rounded-sm text-[8px] font-mono transition-all border",i?"bg-primary text-primary-foreground border-primary":"bg-muted/50 text-muted-foreground/50 border-border/50 hover:bg-muted hover:border-border"),children:s},s)})}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Início: col ",e," · Span: ",t]})]}),tx=({tamanho:e,inicioColuna:t,defaultTamanho:r=6,onTamanhoChange:n,onPositionChange:a})=>{const s=13-t;return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(le,{className:"text-xs",children:["Tamanho (",e,"/12 colunas)"]}),o.jsx(Eo,{value:[e],onValueChange:([i])=>{const l=Math.min(i,s);n(l)},min:1,max:s,step:1,className:"py-1"}),o.jsxs("div",{className:"flex justify-between text-[9px] text-muted-foreground",children:[o.jsx("span",{children:"1"}),o.jsx("span",{children:"3"}),o.jsx("span",{children:"6"}),o.jsx("span",{children:"9"}),o.jsx("span",{children:"12"})]})]}),o.jsx(MC,{inicioColuna:t,tamanho:e,onSelect:i=>{const l=13-i,c=Math.min(e,l);a(i),c!==e&&n(c)}})]})},VC=({config:e,onUpdate:t})=>o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(le,{className:"text-xs",children:"Label"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(le,{className:"text-xs",children:"Descrição"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do container"})]}),o.jsx(sh,{value:e.icone,onChange:r=>t({icone:r})}),o.jsx(tx,{tamanho:e.tamanho||12,inicioColuna:e.inicioColuna||1,defaultTamanho:12,onTamanhoChange:r=>t({tamanho:r}),onPositionChange:r=>t({inicioColuna:r})}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Colunas internas"}),o.jsxs(Vt,{value:String(e.columns||2),onValueChange:r=>t({columns:Number(r)}),children:[o.jsx(Dt,{className:"h-8 text-sm",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"1",children:"1 coluna"}),o.jsx(Xe,{value:"2",children:"2 colunas"}),o.jsx(Xe,{value:"3",children:"3 colunas"}),o.jsx(Xe,{value:"4",children:"4 colunas"})]})]}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Grid interno simplificado para campos"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(le,{htmlFor:"show-label",className:"text-xs cursor-pointer",children:"Exibir label no formulário"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"show-as-card",checked:e.showAsCard||!1,onCheckedChange:r=>t({showAsCard:r===!0})}),o.jsx(le,{htmlFor:"show-as-card",className:"text-xs cursor-pointer",children:"Exibir como card"})]})]}),ui=[{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."}]}],BC=ui.flatMap(e=>e.presets),UC=({value:e,message:t,onChange:r})=>{const[n,a]=j.useState(!1),[s,i]=j.useState(""),l=j.useMemo(()=>{if(!s.trim())return ui;const u=s.toLowerCase();return ui.map(m=>({...m,presets:m.presets.filter(p=>p.label.toLowerCase().includes(u)||p.description.toLowerCase().includes(u)||p.pattern.toLowerCase().includes(u))})).filter(m=>m.presets.length>0)},[s]),c=j.useMemo(()=>e?BC.find(u=>u.pattern===e):void 0,[e]),d=u=>{r(u.pattern,`${u.label}: formato inválido`),a(!1),i("")};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(le,{className:"text-[10px]",children:"Regex"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(ue,{value:e??"",onChange:u=>r(u.target.value||void 0,t),className:"h-7 text-xs font-mono flex-1",placeholder:"Clique no botão ou digite..."}),e&&o.jsx(Te,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>{r(void 0,void 0)},children:o.jsx(O.X,{className:"h-3 w-3"})}),o.jsxs(_o,{open:n,onOpenChange:a,children:[o.jsx(Io,{asChild:!0,children:o.jsx(Te,{variant:"outline",size:"icon",className:"h-7 w-7 shrink-0",children:o.jsx(O.Regex,{className:"h-3.5 w-3.5"})})}),o.jsxs(ua,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(O.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(ue,{value:s,onChange:u=>i(u.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar regex (ex: CPF, e-mail, senha)...",autoFocus:!0})]})}),o.jsx(Fn,{className:"h-[360px]",children:o.jsxs("div",{className:"p-1",children:[l.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum regex encontrado"}),l.map(u=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:u.category}),u.presets.map(m=>o.jsxs(Hf,{children:[o.jsx(Wf,{asChild:!0,children:o.jsxs("button",{onClick:()=>d(m),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors group",children:[o.jsx(O.ChevronRight,{className:"h-3 w-3 text-muted-foreground/50 group-hover:text-primary shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium block truncate",children:m.label}),o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono block truncate",children:m.pattern})]})]})}),o.jsxs(cl,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:m.label}),o.jsx("p",{children:m.description})]})]},m.pattern+m.label))]},u.category))]})})]})]})]}),c&&o.jsxs(Di,{variant:"secondary",className:"text-[10px] font-normal gap-1",children:[o.jsx(O.Regex,{className:"h-2.5 w-2.5"}),c.label]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Mensagem do regex"}),o.jsx(ue,{value:t??"",onChange:u=>r(e,u.target.value||void 0),className:"h-7 text-xs",placeholder:"Formato inválido"})]})]})},mi=[{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"]}]}],HC=mi.flatMap(e=>e.presets),WC=({value:e,onChange:t})=>{const[r,n]=j.useState(!1),[a,s]=j.useState(""),[i,l]=j.useState(""),c=j.useMemo(()=>new Set(e??[]),[e]),d=j.useMemo(()=>{if(!a.trim())return mi;const v=a.toLowerCase();return mi.map(h=>({...h,presets:h.presets.filter(x=>x.label.toLowerCase().includes(v)||x.description.toLowerCase().includes(v)||x.value.toLowerCase().includes(v))})).filter(h=>h.presets.length>0)},[a]),u=v=>{const h=new Set(e??[]);v.group?v.group.every(x=>h.has(x))?v.group.forEach(x=>h.delete(x)):v.group.forEach(x=>h.add(x)):h.has(v.value)?h.delete(v.value):h.add(v.value),t(h.size>0?Array.from(h):void 0)},m=()=>{const v=i.trim();if(!v)return;const h=new Set(e??[]);h.add(v),t(Array.from(h)),l("")},p=v=>{const h=new Set(e??[]);h.delete(v),t(h.size>0?Array.from(h):void 0)},f=v=>{const h=HC.find(x=>x.value===v);return(h==null?void 0:h.label)??v};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(le,{className:"text-[10px]",children:"Tipos de arquivo aceitos"}),((e==null?void 0:e.length)??0)>0&&o.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(v=>o.jsxs(Di,{variant:"secondary",className:"text-[10px] gap-1 pr-1",children:[f(v),o.jsx("button",{onClick:()=>p(v),className:"hover:text-destructive",children:o.jsx(O.X,{className:"h-2.5 w-2.5"})})]},v))}),o.jsxs(_o,{open:r,onOpenChange:n,children:[o.jsx(Io,{asChild:!0,children:o.jsxs(Te,{variant:"outline",className:"w-full h-8 text-xs justify-start gap-2",children:[o.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..."]})}),o.jsxs(ua,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(O.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(ue,{value:a,onChange:v=>s(v.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar tipos (ex: PDF, imagem, vídeo)...",autoFocus:!0})]})}),o.jsxs("div",{className:"px-2 py-1.5 border-b flex gap-1",children:[o.jsx(ue,{value:i,onChange:v=>l(v.target.value),className:"h-7 text-xs font-mono flex-1",placeholder:"Tipo customizado (ex: .dwg)",onKeyDown:v=>v.key==="Enter"&&m()}),o.jsx(Te,{variant:"secondary",size:"sm",className:"h-7 text-xs shrink-0",onClick:m,disabled:!i.trim(),children:"Adicionar"})]}),o.jsx(Fn,{className:"h-[320px]",children:o.jsxs("div",{className:"p-1",children:[d.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum tipo encontrado"}),d.map(v=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:v.category}),v.presets.map(h=>{const x=h.group?h.group.every(b=>c.has(b)):c.has(h.value),y=h.group?h.group.some(b=>c.has(b))&&!x:!1;return o.jsxs(Hf,{children:[o.jsx(Wf,{asChild:!0,children:o.jsxs("button",{onClick:()=>u(h),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors",children:[o.jsx(rt,{checked:y?"indeterminate":x,className:"h-3.5 w-3.5",tabIndex:-1}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium",children:h.label}),!h.group&&o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono ml-2",children:h.value}),h.group&&o.jsxs("span",{className:"text-[10px] text-muted-foreground ml-2",children:[h.group.length," tipos"]})]}),o.jsx(O.Info,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"})]})}),o.jsxs(cl,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:h.label}),o.jsx("p",{children:h.description}),h.group&&o.jsx("ul",{className:"mt-1 space-y-0.5",children:h.group.map(b=>o.jsx("li",{className:"font-mono text-[10px] opacity-80",children:b},b))})]})]},h.value)})]},v.category))]})})]})]})]})},rx=1048576,eo=1073741824;function gd(e){return e>=eo&&e%eo===0?"GB":"MB"}function vd(e,t){return t==="GB"?e/eo:e/rx}function bd(e,t){return Math.round(e*(t==="GB"?eo:rx))}const qC=({value:e,onChange:t})=>{const r=j.useMemo(()=>e?gd(e):"MB",[]),[n,a]=j.useState(r),[s,i]=j.useState(e?String(vd(e,r)):"");j.useEffect(()=>{if(e===void 0){i("");return}const d=gd(e);a(d),i(String(vd(e,d)))},[e]);const l=d=>{i(d);const u=parseFloat(d);d.trim()===""||isNaN(u)||u<=0?t(void 0):t(bd(u,n))},c=d=>{a(d);const u=parseFloat(s);!isNaN(u)&&u>0&&t(bd(u,d))};return o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(le,{className:"text-[10px]",children:"Tamanho máximo do arquivo"}),o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx(ue,{type:"number",min:0,step:"any",value:s,onChange:d=>l(d.target.value),placeholder:"Ex: 10",className:"h-8 text-xs flex-1"}),o.jsxs(Vt,{value:n,onValueChange:d=>c(d),children:[o.jsx(Dt,{className:"w-[72px] h-8 text-xs",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"MB",children:"MB"}),o.jsx(Xe,{value:"GB",children:"GB"})]})]})]}),e!==void 0&&o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["= ",e.toLocaleString("pt-BR")," bytes"]})]})},GC=new Set(["texto","textarea","email","password","url","phone","tel","cpf","cnpj","cep","rg"]),XC=({fieldType:e,validation:t,onChange:r})=>{const n=(i,l)=>{const c=["minLength","maxLength","min","max","maxFileSize","minAge","maxAge"].includes(i)?l?Number(l):void 0:l||void 0;r({...t,[i]:c})},a=e==="file",s=GC.has(e);return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Validação"}),s&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Min caracteres"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.minLength)??"",onChange:i=>n("minLength",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Max caracteres"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.maxLength)??"",onChange:i=>n("maxLength",i.target.value),className:"h-7 text-xs"})]})]}),e==="number"&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Valor mínimo"}),o.jsx(ue,{type:"number",value:(t==null?void 0:t.min)??"",onChange:i=>n("min",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Valor máximo"}),o.jsx(ue,{type:"number",value:(t==null?void 0:t.max)??"",onChange:i=>n("max",i.target.value),className:"h-7 text-xs"})]})]}),(e==="date"||e==="datetime")&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Data mínima"}),o.jsx(ue,{type:"date",value:(t==null?void 0:t.minDate)??"",onChange:i=>n("minDate",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Data máxima"}),o.jsx(ue,{type:"date",value:(t==null?void 0:t.maxDate)??"",onChange:i=>n("maxDate",i.target.value),className:"h-7 text-xs"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Idade mínima (anos)"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.minAge)??"",onChange:i=>n("minAge",i.target.value),className:"h-7 text-xs",placeholder:"ex: 18"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Idade máxima (anos)"}),o.jsx(ue,{type:"number",min:0,value:(t==null?void 0:t.maxAge)??"",onChange:i=>n("maxAge",i.target.value),className:"h-7 text-xs",placeholder:"ex: 60"})]})]})]}),a&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(WC,{value:t==null?void 0:t.fileTypes,onChange:i=>r({...t,fileTypes:i})}),o.jsx(qC,{value:t==null?void 0:t.maxFileSize,onChange:i=>r({...t,maxFileSize:i})})]}),!a&&o.jsx(UC,{value:(t==null?void 0:t.regex)??"",message:(t==null?void 0:t.regexMessage)??"",onChange:(i,l)=>r({...t,regex:i,regexMessage:l})})]})},nx=({options:e,onChange:t})=>{const r=j.useRef([]);if(r.current.length<e.length)for(let i=r.current.length;i<e.length;i++)r.current.push(`opt-${Math.random().toString(36).slice(2)}`);const n=j.useCallback((i,l,c)=>{const d=[...e];d[i]={...d[i],[l]:c},t(d)},[e,t]),a=j.useCallback(i=>{r.current.splice(i,1),t(e.filter((l,c)=>c!==i))},[e,t]),s=j.useCallback(()=>{t([...e,{value:"",label:""}])},[e,t]);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Opções"}),e.map((i,l)=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(O.GripVertical,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}),o.jsx(ue,{value:i.value,onChange:c=>n(l,"value",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Valor"}),o.jsxs("div",{className:"flex items-center gap-0.5 flex-1",children:[o.jsx(ue,{value:i.label,onChange:c=>n(l,"label",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Label"}),o.jsx(br,{})]}),o.jsx(Te,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>a(l),children:o.jsx(O.Trash2,{className:"h-3 w-3"})})]},r.current[l])),o.jsxs(Te,{variant:"outline",size:"sm",className:"w-full h-7 text-xs",onClick:s,children:[o.jsx(O.Plus,{className:"h-3 w-3 mr-1"})," Adicionar opção"]})]})},ZC=[{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"}],KC=["vazio","naoVazio"],yd=({cond:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:a})=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Fonte"}),o.jsxs(Vt,{value:e.source||"campo",onValueChange:s=>a({source:s,when:""}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"campo",children:"Campo do formulário"}),o.jsx(Xe,{value:"evento",children:"Variável do evento"})]})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:e.source==="evento"?"Variável do evento":"Quando o campo"}),o.jsxs(Vt,{value:e.when||"",onValueChange:s=>a({when:s}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{placeholder:e.source==="evento"?"Selecione uma variável...":"Selecione um campo..."})}),o.jsx(Rt,{children:e.source==="evento"?jl.map(s=>o.jsx(Xe,{value:s.key,children:s.label},s.key)):r.filter(s=>s!==t).map(s=>o.jsxs(Xe,{value:s,children:[n(s),o.jsxs("span",{className:"text-muted-foreground/50 ml-1 text-[9px] font-mono",children:["(",s,")"]})]},s))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Operador"}),o.jsxs(Vt,{value:e.operator,onValueChange:s=>a({operator:s}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{})}),o.jsx(Rt,{children:ZC.map(s=>o.jsx(Xe,{value:s.value,children:s.label},s.value))})]})]}),!KC.includes(e.operator)&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Valor"}),o.jsx(ue,{value:e.value||"",onChange:s=>a({value:s.target.value}),className:"h-7 text-xs",placeholder:"Valor esperado"})]})]}),YC=({condition:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onChange:a})=>{var s;const i=m=>{e&&a({...e,...m})},l=()=>{if(!e)return;const m=e.extraConditions??[];a({...e,logicOperator:e.logicOperator??"and",extraConditions:[...m,{when:"",operator:"igual",value:"",source:"campo"}]})},c=m=>{if(!e)return;const p=(e.extraConditions??[]).filter((f,v)=>v!==m);a({...e,extraConditions:p,logicOperator:p.length?e.logicOperator:void 0})},d=(m,p)=>{if(!e)return;const f=(e.extraConditions??[]).map((v,h)=>h===m?{...v,...p}:v);a({...e,extraConditions:f})},u=(((s=e==null?void 0:e.extraConditions)==null?void 0:s.length)??0)>0;return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Condicional"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"has-condition",checked:!!e,onCheckedChange:m=>{a(m?{when:"",operator:"igual",value:"",source:"campo"}:void 0)}}),o.jsx(le,{htmlFor:"has-condition",className:"text-xs cursor-pointer",children:"Exibir condicionalmente"})]}),e&&o.jsxs("div",{className:"space-y-2 pl-2 border-l-2 border-amber-500/30",children:[o.jsx(yd,{cond:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:i}),u&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Lógica"}),o.jsxs(Vt,{value:e.logicOperator??"and",onValueChange:m=>i({logicOperator:m}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"and",children:"E (AND) — todas devem ser verdadeiras"}),o.jsx(Xe,{value:"or",children:"OU (OR) — pelo menos uma deve ser verdadeira"})]})]})]}),(e.extraConditions??[]).map((m,p)=>o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/40",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-[10px] text-muted-foreground font-medium uppercase",children:[e.logicOperator==="or"?"OU":"E"," — condição"," ",p+2]}),o.jsx(Te,{variant:"ghost",size:"sm",className:"h-5 px-1 text-[10px] text-destructive hover:text-destructive",onClick:()=>c(p),children:"Remover"})]}),o.jsx(yd,{cond:m,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:f=>d(p,f)})]},p)),o.jsx(Te,{variant:"outline",size:"sm",className:"h-6 text-[10px] w-full mt-1",onClick:l,children:"+ Adicionar condição"})]})]})},wd=[{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"}],JC=({subFields:e,onChange:t})=>{const[r,n]=j.useState(null),a=(i,l)=>{const c=e.map((d,u)=>u===i?{...d,...l}:d);t(c)},s=i=>{t(e.filter((l,c)=>c!==i)),n(null)};return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(le,{className:"text-xs font-semibold",children:"Sub-campos"}),o.jsxs(Te,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs gap-1",onClick:()=>{const i={label:"Novo campo",name:`campo_${e.length+1}`,fieldType:"texto",required:!1};t([...e,i]),n(e.length)},children:[o.jsx(O.Plus,{className:"w-3 h-3"}),"Adicionar"]})]}),e.length===0&&o.jsx("p",{className:"text-[11px] text-muted-foreground italic py-1",children:"Nenhum sub-campo adicionado."}),e.map((i,l)=>{var c;return o.jsxs("div",{className:"border rounded-md text-xs overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 cursor-pointer hover:bg-muted/40 select-none",onClick:()=>n(r===l?null:l),children:[o.jsx(Di,{variant:"secondary",className:"h-4 text-[9px] px-1 shrink-0",children:l+1}),o.jsx("span",{className:"flex-1 truncate font-medium",children:i.label||i.name||"Campo sem nome"}),o.jsx("span",{className:"text-muted-foreground text-[10px] shrink-0",children:((c=wd.find(d=>d.value===i.fieldType))==null?void 0:c.label)??i.fieldType}),o.jsx(Te,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 text-destructive hover:text-destructive shrink-0",onClick:d=>{d.stopPropagation(),s(l)},children:o.jsx(O.Trash2,{className:"w-3 h-3"})}),r===l?o.jsx(O.ChevronUp,{className:"w-3 h-3 text-muted-foreground shrink-0"}):o.jsx(O.ChevronDown,{className:"w-3 h-3 text-muted-foreground shrink-0"})]}),r===l&&o.jsxs("div",{className:"px-2 pb-2 space-y-2 border-t bg-muted/20",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Label"}),o.jsx(ue,{value:i.label,onChange:d=>a(l,{label:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: Nome"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Nome (campo)"}),o.jsx(ue,{value:i.name||"",onChange:d=>a(l,{name:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: nome"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Tipo de campo"}),o.jsxs(Vt,{value:i.fieldType,onValueChange:d=>a(l,{fieldType:d}),children:[o.jsx(Dt,{className:"h-7 text-xs",children:o.jsx(Bt,{})}),o.jsx(Rt,{children:wd.map(d=>o.jsx(Xe,{value:d.value,className:"text-xs",children:d.label},d.value))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Colunas (1-12)"}),o.jsx(ue,{type:"number",min:1,max:12,value:i.tamanho??"",onChange:d=>a(l,{tamanho:d.target.value?Number(d.target.value):void 0}),className:"h-7 text-xs",placeholder:"12"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-[10px]",children:"Placeholder"}),o.jsx(ue,{value:i.placeholder||"",onChange:d=>a(l,{placeholder:d.target.value}),className:"h-7 text-xs",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:`sf-req-${l}`,checked:i.required||!1,onCheckedChange:d=>a(l,{required:d===!0})}),o.jsx(le,{htmlFor:`sf-req-${l}`,className:"text-[10px] cursor-pointer",children:"Obrigatório"})]}),["select","radio","checkbox_group"].includes(i.fieldType)&&o.jsx("div",{className:"pt-1",children:o.jsx(nx,{options:i.options||[],onChange:d=>a(l,{options:d})})})]})]},l)}),e.length>0&&o.jsx(it,{className:"mt-1"})]})},QC=({config:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:a})=>{const s=e.fieldType||"texto",i=["select","radio","checkbox_group","autocomplete"].includes(s),l=s==="field_array",c=e.locked===!0,d=s==="participation_type",u=s==="payment_method",m=s==="terms",p=s==="file",f=s==="slider",v=!!(e.isDisabled||e.isReadOnly),h=s==="rating",x=s==="date_range",y=s==="sub_form",{schemaId:b,uploadTermsPdf:k,deleteTermsPdf:w}=xt(),[N,S]=j.useState(e.termoPdfUploadId?"upload":"link"),[A,C]=j.useState({status:"idle"}),E=j.useRef(null),$=j.useRef(!0);j.useEffect(()=>()=>{$.current=!1},[]);const I=j.useCallback(async D=>{if(a({termoPdfUploadId:void 0}),w&&b)try{await w(D,b)}catch{}},[w,b,a]),L=j.useCallback(async D=>{if(D.type!=="application/pdf"){C({status:"error",message:"Apenas arquivos PDF são permitidos."});return}if(!b){C({status:"error",message:"Salve o schema primeiro para habilitar o upload de PDF."});return}if(!k){C({status:"error",message:"Upload de PDF não configurado. Forneça a prop uploadTermsPdf ao BuilderProvider."});return}const z=e.termoPdfUploadId;C({status:"uploading",fileName:D.name,progress:0});try{const H=await k(D,b,U=>C(Z=>Z.status==="uploading"?{...Z,progress:U}:Z));if(!$.current)return;if(z&&w)try{await w(z,b)}catch{}if(!$.current)return;a({termoPdfUploadId:H,termoPdfUrl:void 0}),C({status:"idle"})}catch(H){if(!$.current)return;C({status:"error",message:H instanceof Error?H.message:"Falha no upload do PDF."})}},[b,k,w,e.termoPdfUploadId,a]);return o.jsxs("div",{className:"space-y-4",children:[c&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-500/10 border border-amber-500/30 px-3 py-2",children:[o.jsx(O.Lock,{className:"h-4 w-4 text-amber-500 shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-amber-600 dark:text-amber-400",children:"Campo bloqueado"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tipo, nome e ID são fixos (integração automática)"})]})]}),d&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(O.Lock,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Tipo de Participação"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Datas, preços e vagas são carregados automaticamente do evento"})]})]}),m&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(O.ScrollText,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Termos e Condições"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Configure o texto ou URL do PDF abaixo"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(le,{className:"text-xs",children:"Label"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.label,onChange:D=>a({label:D.target.value}),className:"h-8 text-sm"})]}),d||u?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ue,{value:e.hint||"",onChange:D=>a({hint:D.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"req",checked:e.required||!1,onCheckedChange:D=>a({required:D===!0})}),o.jsx(le,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]})]}):m?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ue,{value:e.hint||"",onChange:D=>a({hint:D.target.value}),className:"h-8 text-sm",placeholder:"Ex: Leia os termos antes de continuar"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"req",checked:e.required||!1,onCheckedChange:D=>a({required:D===!0})}),o.jsx(le,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Conteúdo dos termos"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Texto dos termos"}),o.jsx(co,{value:e.termoTexto||"",onChange:D=>a({termoTexto:D.target.value||void 0}),className:"text-sm min-h-[120px] resize-y",placeholder:"Escreva aqui os termos e condições que o usuário deverá ler e aceitar..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(le,{className:"text-xs",children:"PDF dos termos (opcional)"}),o.jsxs("div",{className:"flex gap-1 p-0.5 bg-muted rounded-md",children:[o.jsx("button",{type:"button",onClick:()=>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"}),o.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"?o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{value:e.termoPdfUrl||"",onChange:D=>a({termoPdfUrl:D.target.value||void 0}),className:"h-8 text-sm",placeholder:"https://exemplo.com/termos.pdf"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"URL pública de um PDF. Tem prioridade sobre o texto acima."})]}):o.jsxs("div",{className:"space-y-2",children:[e.termoPdfUploadId&&A.status==="idle"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-green-500/40 bg-green-500/10 px-2 py-1.5",children:[o.jsx(O.CheckCircle2,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),o.jsx("span",{className:"text-[11px] text-green-700 dark:text-green-400 flex-1",children:"PDF enviado ✓"}),o.jsx(Te,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>I(e.termoPdfUploadId),children:o.jsx(O.X,{className:"h-3 w-3"})})]}):null,A.status==="uploading"?o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[o.jsx(O.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),o.jsx("span",{className:"truncate",children:A.fileName}),o.jsxs("span",{className:"ml-auto",children:[A.progress,"%"]})]}),o.jsx(rl,{value:A.progress,className:"h-1"})]}):null,A.status==="error"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-destructive/40 bg-destructive/10 px-2 py-1.5",children:[o.jsx(O.AlertCircle,{className:"h-3.5 w-3.5 text-destructive shrink-0"}),o.jsx("span",{className:"text-[11px] text-destructive",children:A.message}),o.jsx(Te,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 ml-auto",onClick:()=>C({status:"idle"}),children:o.jsx(O.X,{className:"h-3 w-3"})})]}):null,A.status!=="uploading"?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:E,type:"file",accept:"application/pdf",className:"hidden",onChange:D=>{var z;const H=(z=D.target.files)==null?void 0:z[0];H&&L(H),D.target.value=""}}),o.jsxs(Te,{type:"button",variant:"outline",size:"sm",className:"w-full h-8 text-xs gap-1.5",disabled:!b,onClick:()=>{var D;return(D=E.current)==null?void 0:D.click()},children:[o.jsx(O.Upload,{className:"h-3.5 w-3.5"}),e.termoPdfUploadId?"Substituir PDF":"Selecionar PDF"]}),!b&&o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Salve o schema uma vez para habilitar o upload."})]}):null]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Nome (chave)"}),o.jsx(ue,{value:e.name||t.replace(/^field_/,""),onChange:D=>!c&&a({name:D.target.value}),className:"h-8 text-xs font-mono",placeholder:"nome_do_campo",disabled:c}),c?o.jsx("p",{className:"text-[9px] text-amber-500",children:"ID fixo — necessário para auto-preenchimento"}):o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Usado como chave no JSON do formulário"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Tipo do campo"}),o.jsxs(Vt,{value:s,onValueChange:D=>!c&&a({fieldType:D}),disabled:c,children:[o.jsx(Dt,{className:"h-8 text-sm",children:o.jsx(Bt,{})}),o.jsx(Rt,{children:Ir.map(D=>o.jsx(Xe,{value:D.component,children:D.label},D.component))})]})]}),o.jsx(tx,{tamanho:e.tamanho||6,inicioColuna:e.inicioColuna||1,defaultTamanho:6,onTamanhoChange:D=>a({tamanho:D}),onPositionChange:D=>a({inicioColuna:D})}),s!=="file"&&!l&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(le,{className:"text-xs",children:"Placeholder"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.placeholder||"",onChange:D=>a({placeholder:D.target.value}),className:"h-8 text-sm",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(le,{className:"text-xs",children:"Dica (hint)"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.hint||"",onChange:D=>a({hint:D.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),s!=="file"&&!l&&!y&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Valor padrão"}),o.jsx(ue,{value:e.defaultValue||"",onChange:D=>a({defaultValue:D.target.value}),className:"h-8 text-sm",placeholder:"Valor inicial do campo"})]}),s!=="file"&&!l&&!y&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(le,{className:"text-xs",children:"Valor inicial (runtime)"}),o.jsx(br,{})]}),o.jsx(ue,{value:e.initialValue||"",onChange:D=>a({initialValue:D.target.value||void 0}),className:"h-8 text-sm",placeholder:"{{evento.nome}} ou valor fixo"}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:['Sobrepõe "Valor padrão" — suporta variáveis'," ",o.jsx("code",{children:"{{evento.x}}"})]})]}),!l&&!y&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"req",checked:e.required||!1,onCheckedChange:D=>a({required:D===!0})}),o.jsx(le,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),!l&&!y&&!c&&!p&&o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"readonly",checked:e.isReadOnly||!1,onCheckedChange:D=>a({isReadOnly:D===!0||void 0})}),o.jsx(le,{htmlFor:"readonly",className:"text-xs cursor-pointer",children:"Somente leitura"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"disabled",checked:e.isDisabled||!1,onCheckedChange:D=>a({isDisabled:D===!0||void 0})}),o.jsx(le,{htmlFor:"disabled",className:"text-xs cursor-pointer",children:"Desabilitado"})]})]}),f&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Slider"}),o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Mínimo"}),o.jsx(ue,{type:"number",value:e.minValue??0,onChange:D=>a({minValue:Number(D.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Máximo"}),o.jsx(ue,{type:"number",value:e.maxValue??100,onChange:D=>a({maxValue:Number(D.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Passo"}),o.jsx(ue,{type:"number",min:1,value:e.step??1,onChange:D=>a({step:Number(D.target.value)}),className:"h-8 text-sm"})]})]})]})]}),h&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Avaliação"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Número de estrelas"}),o.jsxs(Vt,{value:String(e.maxRating??5),onValueChange:D=>a({maxRating:Number(D)}),children:[o.jsx(Dt,{className:"h-8 text-sm",children:o.jsx(Bt,{})}),o.jsx(Rt,{children:[3,4,5,6,7,10].map(D=>o.jsxs(Xe,{value:String(D),children:[D," estrelas"]},D))})]})]})]})]}),x&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Período"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Label da data inicial"}),o.jsx(ue,{value:e.dateRangeStartLabel??"Data inicial",onChange:D=>a({dateRangeStartLabel:D.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Label da data final"}),o.jsx(ue,{value:e.dateRangeEndLabel??"Data final",onChange:D=>a({dateRangeEndLabel:D.target.value}),className:"h-8 text-sm"})]})]})]}),!l&&o.jsx(it,{}),!l&&!m&&!v&&o.jsx(XC,{fieldType:s,validation:e.validation,onChange:D=>a({validation:D})}),i&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),s==="radio"&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Estilo visual"}),o.jsxs(Vt,{value:e.visualStyle||"card",onValueChange:D=>a({visualStyle:D}),children:[o.jsx(Dt,{className:"h-8 text-sm",children:o.jsx(Bt,{})}),o.jsxs(Rt,{children:[o.jsx(Xe,{value:"card",children:"Card (padrão)"}),o.jsx(Xe,{value:"default",children:"Radio simples"})]})]})]}),o.jsx(nx,{options:e.options||[],onChange:D=>a({options:D})})]}),l&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Lista de itens"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Mín. itens"}),o.jsx(ue,{type:"number",min:0,value:e.minItems??"",onChange:D=>a({minItems:D.target.value?Number(D.target.value):void 0}),className:"h-8 text-sm",placeholder:"0"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Máx. itens"}),o.jsx(ue,{type:"number",min:0,value:e.maxItems??"",onChange:D=>a({maxItems:D.target.value?Number(D.target.value):void 0}),className:"h-8 text-sm",placeholder:"Sem limite"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Label do item"}),o.jsx(ue,{value:e.itemLabel||"",onChange:D=>a({itemLabel:D.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Contato"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:'Prefixo exibido em cada item (ex: "Contato 1", "Contato 2")'})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Label do botão adicionar"}),o.jsx(ue,{value:e.addLabel||"",onChange:D=>a({addLabel:D.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Adicionar contato"})]}),o.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2",children:o.jsx("p",{className:"text-[11px] text-amber-700 dark:text-amber-400",children:"Os sub-campos são configurados visualmente no canvas: arraste campos da paleta para dentro da caixa laranja."})})]})]}),y&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Sub-formulário"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Título do grupo (opcional)"}),o.jsx(ue,{value:e.subSchemaTitle||"",onChange:D=>a({subSchemaTitle:D.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Endereço, Responsável..."})]}),o.jsx(JC,{subFields:e.subSchemaFields||[],onChange:D=>a({subSchemaFields:D})})]})]}),!v&&!m&&o.jsxs(o.Fragment,{children:[o.jsx(it,{}),o.jsx(YC,{condition:e.condition,selectedId:t,allFieldIds:r,getFieldLabel:n,onChange:D=>a({condition:D})})]}),!v&&!m&&e.condition&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs",children:"Valor ao ocultar (clearedValue)"}),o.jsx(ue,{value:e.clearedValue??"",onChange:D=>a({clearedValue:D.target.value||void 0}),className:"h-8 text-sm",placeholder:"Deixar vazio = não limpar"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Valor aplicado automaticamente quando o campo fica oculto."})]}),!l&&!y&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{className:"text-xs text-muted-foreground",children:"Resolver de props (avançado)"}),o.jsx(ue,{value:e.resolvePropsKey||"",onChange:D=>a({resolvePropsKey:D.target.value||void 0}),className:"h-8 text-xs font-mono",placeholder:"chaveDoResolver"}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Registre este key em"," ",o.jsx("code",{children:"RendererContext.fieldResolvers"})," para opções dinâmicas."]})]})]})]})},eN={glassmorphism:"Glass",card:"Card",flat:"Flat",bordered:"Bordered"},ax=()=>{const{previewTemplateId:e,setPreviewTemplateId:t}=xt(),[r,n]=j.useState(!1),a=Object.values(Zr),s=Zr[e];return o.jsxs(_o,{open:r,onOpenChange:n,children:[o.jsx(Io,{asChild:!0,children:o.jsxs(Te,{variant:"outline",size:"sm",className:"gap-1.5",title:"Selecionar template visual",children:[o.jsx("span",{className:"w-3.5 h-3.5 rounded-full shrink-0 border border-white/20",style:{background:(s==null?void 0:s.colors.primary)??"#3b82f6"}}),o.jsx(O.Palette,{className:"w-3.5 h-3.5"}),o.jsx("span",{className:"hidden sm:inline",children:(s==null?void 0:s.displayName)??"Template"})]})}),o.jsxs(ua,{side:"bottom",align:"end",className:"w-80 p-3",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase tracking-wider",children:"Template de Preview"}),o.jsx("div",{className:"grid grid-cols-3 gap-1.5 max-h-72 overflow-y-auto pr-0.5",children:a.map(i=>{const l=i.id===e,c=hu(i),d=eN[i.layout.containerStyle]??"";return o.jsxs("button",{onClick:()=>{t(i.id),n(!1)},className:Ut("relative flex flex-col items-center gap-1.5 rounded-lg p-2 border text-center transition-all hover:scale-[1.02]",l?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[o.jsxs("div",{className:"w-full h-8 rounded-md flex items-center justify-center gap-0.5",style:{background:i.colors.background.startsWith("#")||i.colors.background.startsWith("rgba")?i.colors.background:void 0},"data-muted":!i.colors.background.startsWith("#")&&!i.colors.background.startsWith("rgba")?"true":void 0,children:[o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i.colors.primary}}),o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i.colors.accent}})]}),o.jsx("span",{className:"text-[10px] font-medium leading-tight line-clamp-2",children:i.displayName}),o.jsxs("div",{className:"flex items-center gap-0.5 flex-wrap justify-center",children:[c&&o.jsx("span",{className:"text-[9px] px-1 rounded bg-zinc-800 text-zinc-300",children:"dark"}),d&&o.jsx("span",{className:"text-[9px] px-1 rounded bg-muted text-muted-foreground",children:d})]}),l&&o.jsx("div",{className:"absolute top-1 right-1",children:o.jsx(O.Check,{className:"w-3 h-3 text-primary"})})]},i.id)})})]})]})},tN=[{value:"numbers",label:"Números"},{value:"icons",label:"Ícones"},{value:"icons-labeled",label:"Ícones + rótulo"}],rN=[{value:"top-center",label:"Centralizado"},{value:"top-left",label:"Esquerda"}],nN=[{value:"horizontal",label:"Horizontal"},{value:"vertical",label:"Vertical (sidebar)"}],aN=()=>{const{stepConfig:e,updateStepConfig:t}=xt();return o.jsxs("div",{className:"space-y-5",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Template visual"}),o.jsx(ax,{})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Indicador de steps"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"sc-show-indicators",checked:e.showStepIndicators!==!1,onCheckedChange:r=>t({showStepIndicators:r===!0})}),o.jsx(le,{htmlFor:"sc-show-indicators",className:"text-xs cursor-pointer",children:"Exibir indicador de steps"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rt,{id:"sc-show-progress",checked:e.showProgressBar===!0,onCheckedChange:r=>t({showProgressBar:r===!0})}),o.jsx(le,{htmlFor:"sc-show-progress",className:"text-xs cursor-pointer",children:"Exibir barra de progresso"})]})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(le,{className:"text-xs",children:"Variante visual"}),o.jsx("div",{className:"flex flex-col gap-1.5",children:tN.map(r=>o.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&&o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(le,{className:"text-xs",children:"Orientação"}),o.jsx("div",{className:"flex gap-2",children:nN.map(r=>o.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&&o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]}),o.jsx(it,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(le,{className:"text-xs",children:"Posição (desktop)"}),o.jsx("div",{className:"flex gap-2",children:rN.map(r=>o.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&&o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]})]})},oN=()=>{const{selectedId:e,getConfig:t,updateConfig:r,getAllFieldIds:n}=xt();if(!e)return o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-4 max-h-[calc(100vh-160px)] overflow-y-auto",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Formulário"})}),o.jsx(it,{}),o.jsx(aN,{})]});const a=t(e),s=qe(e),i=c=>r(e,c),l=n().filter(c=>c!==e);return o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-4 max-h-[calc(100vh-160px)] overflow-y-auto",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"text-sm font-bold text-foreground",children:s==="step"?"Step":s==="container"?"Container":"Campo"}),o.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:e})]}),o.jsx(it,{}),s==="step"&&o.jsx(zC,{config:a,onUpdate:i}),s==="container"&&o.jsx(VC,{config:a,onUpdate:i}),s==="field"&&o.jsx(QC,{config:a,selectedId:e,allFieldIds:l,getFieldLabel:c=>t(c).label||c,onUpdate:i})]})};var fa=e=>e.type==="checkbox",Xr=e=>e instanceof Date,vt=e=>e==null;const ox=e=>typeof e=="object";var nt=e=>!vt(e)&&!Array.isArray(e)&&ox(e)&&!Xr(e),sx=e=>nt(e)&&e.target?fa(e.target)?e.target.checked:e.target.value:e,sN=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,ix=(e,t)=>e.has(sN(t)),iN=e=>{const t=e.constructor&&e.constructor.prototype;return nt(t)&&t.hasOwnProperty("isPrototypeOf")},El=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ze(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(El&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(nt(e)&&iN(e)))return e;const n=r?[]:Object.create(Object.getPrototypeOf(e));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=ze(e[a]));return n}var Go=e=>/^\w*$/.test(e),Ie=e=>e===void 0,Xo=e=>Array.isArray(e)?e.filter(Boolean):[],Tl=e=>Xo(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ae=(e,t,r)=>{if(!t||!nt(e))return r;const n=(Go(t)?[t]:Tl(t)).reduce((a,s)=>vt(a)?a:a[s],e);return Ie(n)||n===e?Ie(e[t])?r:e[t]:n},St=e=>typeof e=="boolean",ft=e=>typeof e=="function",_e=(e,t,r)=>{let n=-1;const a=Go(t)?[t]:Tl(t),s=a.length,i=s-1;for(;++n<s;){const l=a[n];let c=r;if(n!==i){const d=e[l];c=nt(d)||Array.isArray(d)?d:isNaN(+a[n+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=c,e=e[l]}};const to={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ft={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},xr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Al=j.createContext(null);Al.displayName="HookFormControlContext";const Zo=()=>j.useContext(Al);var lx=(e,t,r,n=!0)=>{const a={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(a,s,{get:()=>{const i=s;return t._proxyFormState[i]!==Ft.all&&(t._proxyFormState[i]=!n||Ft.all),r&&(r[i]=!0),e[i]}});return a};const Ko=typeof window<"u"?j.useLayoutEffect:j.useEffect;function cx(e){const t=Zo(),{control:r=t,disabled:n,name:a,exact:s}=e||{},[i,l]=j.useState(r._formState),c=j.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ko(()=>r._subscribe({name:a,formState:c.current,exact:s,callback:d=>{!n&&l({...r._formState,...d})}}),[a,n,s]),j.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),j.useMemo(()=>lx(i,r,c.current,!1),[i,r])}var Et=e=>typeof e=="string",pi=(e,t,r,n,a)=>Et(e)?(n&&t.watch.add(e),ae(r,e,a)):Array.isArray(e)?e.map(s=>(n&&t.watch.add(s),ae(r,s))):(n&&(t.watchAll=!0),r),fi=e=>vt(e)||!ox(e);function Zt(e,t,r=new WeakSet){if(fi(e)||fi(t))return Object.is(e,t);if(Xr(e)&&Xr(t))return Object.is(e.getTime(),t.getTime());const n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of n){const i=e[s];if(!a.includes(s))return!1;if(s!=="ref"){const l=t[s];if(Xr(i)&&Xr(l)||nt(i)&&nt(l)||Array.isArray(i)&&Array.isArray(l)?!Zt(i,l,r):!Object.is(i,l))return!1}}return!0}function Ln(e){const t=Zo(),{control:r=t,name:n,defaultValue:a,disabled:s,exact:i,compute:l}=e||{},c=j.useRef(a),d=j.useRef(l),u=j.useRef(void 0),m=j.useRef(r),p=j.useRef(n);d.current=l;const[f,v]=j.useState(()=>{const w=r._getWatch(n,c.current);return d.current?d.current(w):w}),h=j.useCallback(w=>{const N=pi(n,r._names,w||r._formValues,!1,c.current);return d.current?d.current(N):N},[r._formValues,r._names,n]),x=j.useCallback(w=>{if(!s){const N=pi(n,r._names,w||r._formValues,!1,c.current);if(d.current){const S=d.current(N);Zt(S,u.current)||(v(S),u.current=S)}else v(N)}},[r._formValues,r._names,s,n]);Ko(()=>((m.current!==r||!Zt(p.current,n))&&(m.current=r,p.current=n,x()),r._subscribe({name:n,formState:{values:!0},exact:i,callback:w=>{x(w.values)}})),[r,i,n,x]),j.useEffect(()=>r._removeUnmounted());const y=m.current!==r,b=p.current,k=j.useMemo(()=>{if(s)return null;const w=!y&&!Zt(b,n);return y||w?h():null},[s,y,n,b,h]);return k!==null?k:f}function Be(e){const t=Zo(),{name:r,disabled:n,control:a=t,shouldUnregister:s,defaultValue:i,exact:l=!0}=e,c=ix(a._names.array,r),d=j.useMemo(()=>ae(a._formValues,r,ae(a._defaultValues,r,i)),[a,r,i]),u=Ln({control:a,name:r,defaultValue:d,exact:l}),m=cx({control:a,name:r,exact:l}),p=j.useRef(e),f=j.useRef(void 0),v=j.useRef(a.register(r,{...e.rules,value:u,...St(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const h=j.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ae(m.errors,r)},isDirty:{enumerable:!0,get:()=>!!ae(m.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ae(m.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ae(m.validatingFields,r)},error:{enumerable:!0,get:()=>ae(m.errors,r)}}),[m,r]),x=j.useCallback(w=>v.current.onChange({target:{value:sx(w),name:r},type:to.CHANGE}),[r]),y=j.useCallback(()=>v.current.onBlur({target:{value:ae(a._formValues,r),name:r},type:to.BLUR}),[r,a._formValues]),b=j.useCallback(w=>{const N=ae(a._fields,r);N&&N._f&&w&&(N._f.ref={focus:()=>ft(w.focus)&&w.focus(),select:()=>ft(w.select)&&w.select(),setCustomValidity:S=>ft(w.setCustomValidity)&&w.setCustomValidity(S),reportValidity:()=>ft(w.reportValidity)&&w.reportValidity()})},[a._fields,r]),k=j.useMemo(()=>({name:r,value:u,...St(n)||m.disabled?{disabled:m.disabled||n}:{},onChange:x,onBlur:y,ref:b}),[r,n,m.disabled,x,y,b,u]);return j.useEffect(()=>{const w=a._options.shouldUnregister||s,N=f.current;N&&N!==r&&!c&&a.unregister(N),a.register(r,{...p.current.rules,...St(p.current.disabled)?{disabled:p.current.disabled}:{}});const S=(A,C)=>{const E=ae(a._fields,A);E&&E._f&&(E._f.mount=C)};if(S(r,!0),w){const A=ze(ae(a._options.defaultValues,r,p.current.defaultValue));_e(a._defaultValues,r,A),Ie(ae(a._formValues,r))&&_e(a._formValues,r,A)}return!c&&a.register(r),f.current=r,()=>{(c?w&&!a._state.action:w)?a.unregister(r):S(r,!1)}},[r,a,c,s]),j.useEffect(()=>{a._setDisabledField({disabled:n,name:r})},[n,r,a]),j.useMemo(()=>({field:k,formState:m,fieldState:h}),[k,m,h])}const Dl=j.createContext(null);Dl.displayName="HookFormContext";const lN=()=>j.useContext(Dl),cN=e=>{const{children:t,watch:r,getValues:n,getFieldState:a,setError:s,clearErrors:i,setValue:l,trigger:c,formState:d,resetField:u,reset:m,handleSubmit:p,unregister:f,control:v,register:h,setFocus:x,subscribe:y}=e;return j.createElement(Dl.Provider,{value:j.useMemo(()=>({watch:r,getValues:n,getFieldState:a,setError:s,clearErrors:i,setValue:l,trigger:c,formState:d,resetField:u,reset:m,handleSubmit:p,unregister:f,control:v,register:h,setFocus:x,subscribe:y}),[i,v,d,a,n,p,h,m,u,s,x,l,y,c,f,r])},j.createElement(Al.Provider,{value:v},t))};var dN=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},bt=e=>Array.isArray(e)?e:[e],kd=()=>{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 dx(e,t){const r={};for(const n in e)if(e.hasOwnProperty(n)){const a=e[n],s=t[n];if(a&&nt(a)&&s){const i=dx(a,s);nt(i)&&(r[n]=i)}else e[n]&&(r[n]=s)}return r}var ct=e=>nt(e)&&!Object.keys(e).length,Rl=e=>e.type==="file",ro=e=>{if(!El)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ux=e=>e.type==="select-multiple",Pl=e=>e.type==="radio",uN=e=>Pl(e)||fa(e),$s=e=>ro(e)&&e.isConnected;function mN(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Ie(e)?n++:e[t[n++]];return e}function pN(e){for(const t in e)if(e.hasOwnProperty(t)&&!Ie(e[t]))return!1;return!0}function He(e,t){const r=Array.isArray(t)?t:Go(t)?[t]:Tl(t),n=r.length===1?e:mN(e,r),a=r.length-1,s=r[a];return n&&delete n[s],a!==0&&(nt(n)&&ct(n)||Array.isArray(n)&&pN(n))&&He(e,r.slice(0,-1)),e}var fN=e=>{for(const t in e)if(ft(e[t]))return!0;return!1};function mx(e){return Array.isArray(e)||nt(e)&&!fN(e)}function hi(e,t={}){for(const r in e){const n=e[r];mx(n)?(t[r]=Array.isArray(n)?[]:{},hi(n,t[r])):Ie(n)||(t[r]=!0)}return t}function hn(e,t,r){r||(r=hi(t));for(const n in e){const a=e[n];if(mx(a))Ie(t)||fi(r[n])?r[n]=hi(a,Array.isArray(a)?[]:{}):hn(a,vt(t)?{}:t[n],r[n]);else{const s=t[n];r[n]=!Zt(a,s)}}return r}const jd={value:!1,isValid:!1},Cd={value:!0,isValid:!0};var px=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&&!Ie(e[0].attributes.value)?Ie(e[0].value)||e[0].value===""?Cd:{value:e[0].value,isValid:!0}:Cd:jd}return jd},fx=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Ie(e)?e:t?e===""?NaN:e&&+e:r&&Et(e)?new Date(e):n?n(e):e;const Nd={isValid:!1,value:null};var hx=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Nd):Nd;function Sd(e){const t=e.ref;return Rl(t)?t.files:Pl(t)?hx(e.refs).value:ux(t)?[...t.selectedOptions].map(({value:r})=>r):fa(t)?px(e.refs).value:fx(Ie(t.value)?e.ref.value:t.value,e)}var hN=(e,t,r,n)=>{const a={};for(const s of e){const i=ae(t,s);i&&_e(a,s,i._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}},no=e=>e instanceof RegExp,Wn=e=>Ie(e)?e:no(e)?e.source:nt(e)?no(e.value)?e.value.source:e.value:e,vn=e=>({isOnSubmit:!e||e===Ft.onSubmit,isOnBlur:e===Ft.onBlur,isOnChange:e===Ft.onChange,isOnAll:e===Ft.all,isOnTouch:e===Ft.onTouched});const $d="AsyncFunction";var xN=e=>!!e&&!!e.validate&&!!(ft(e.validate)&&e.validate.constructor.name===$d||nt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===$d)),gN=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),xi=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const jn=(e,t,r,n)=>{for(const a of r||Object.keys(e)){const s=ae(e,a);if(s){const{_f:i,...l}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],a)&&!n||i.ref&&t(i.ref,i.name)&&!n)return!0;if(jn(l,t))break}else if(nt(l)&&jn(l,t))break}}};function Ed(e,t,r){const n=ae(e,r);if(n||Go(r))return{error:n,name:r};const a=r.split(".");for(;a.length;){const s=a.join("."),i=ae(t,s),l=ae(e,s);if(i&&!Array.isArray(i)&&r!==s)return{name:r};if(l&&l.type)return{name:s,error:l};if(l&&l.root&&l.root.type)return{name:`${s}.root`,error:l.root};a.pop()}return{name:r}}var vN=(e,t,r,n)=>{r(e);const{name:a,...s}=e;return ct(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===(!n||Ft.all))},bN=(e,t,r)=>!e||!t||e===t||bt(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),yN=(e,t,r,n,a)=>a.isOnAll?!1:!r&&a.isOnTouch?!(t||e):(r?n.isOnBlur:a.isOnBlur)?!e:(r?n.isOnChange:a.isOnChange)?e:!0,wN=(e,t)=>!Xo(ae(e,t)).length&&He(e,t),xx=(e,t,r)=>{const n=bt(ae(e,r));return _e(n,"root",t[r]),_e(e,r,n),e};function Td(e,t,r="validate"){if(Et(e)||Array.isArray(e)&&e.every(Et)||St(e)&&!e)return{type:r,message:Et(e)?e:"",ref:t}}var pn=e=>nt(e)&&!no(e)?e:{value:e,message:""},gi=async(e,t,r,n,a,s)=>{const{ref:i,refs:l,required:c,maxLength:d,minLength:u,min:m,max:p,pattern:f,validate:v,name:h,valueAsNumber:x,mount:y}=e._f,b=ae(r,h);if(!y||t.has(h))return{};const k=l?l[0]:i,w=L=>{a&&k.reportValidity&&(k.setCustomValidity(St(L)?"":L||""),k.reportValidity())},N={},S=Pl(i),A=fa(i),C=S||A,E=(x||Rl(i))&&Ie(i.value)&&Ie(b)||ro(i)&&i.value===""||b===""||Array.isArray(b)&&!b.length,$=dN.bind(null,h,n,N),I=(L,D,z,H=xr.maxLength,U=xr.minLength)=>{const Z=L?D:z;N[h]={type:L?H:U,message:Z,ref:i,...$(L?H:U,Z)}};if(s?!Array.isArray(b)||!b.length:c&&(!C&&(E||vt(b))||St(b)&&!b||A&&!px(l).isValid||S&&!hx(l).isValid)){const{value:L,message:D}=Et(c)?{value:!!c,message:c}:pn(c);if(L&&(N[h]={type:xr.required,message:D,ref:k,...$(xr.required,D)},!n))return w(D),N}if(!E&&(!vt(m)||!vt(p))){let L,D;const z=pn(p),H=pn(m);if(!vt(b)&&!isNaN(b)){const U=i.valueAsNumber||b&&+b;vt(z.value)||(L=U>z.value),vt(H.value)||(D=U<H.value)}else{const U=i.valueAsDate||new Date(b),Z=R=>new Date(new Date().toDateString()+" "+R),V=i.type=="time",M=i.type=="week";Et(z.value)&&b&&(L=V?Z(b)>Z(z.value):M?b>z.value:U>new Date(z.value)),Et(H.value)&&b&&(D=V?Z(b)<Z(H.value):M?b<H.value:U<new Date(H.value))}if((L||D)&&(I(!!L,z.message,H.message,xr.max,xr.min),!n))return w(N[h].message),N}if((d||u)&&!E&&(Et(b)||s&&Array.isArray(b))){const L=pn(d),D=pn(u),z=!vt(L.value)&&b.length>+L.value,H=!vt(D.value)&&b.length<+D.value;if((z||H)&&(I(z,L.message,D.message),!n))return w(N[h].message),N}if(f&&!E&&Et(b)){const{value:L,message:D}=pn(f);if(no(L)&&!b.match(L)&&(N[h]={type:xr.pattern,message:D,ref:i,...$(xr.pattern,D)},!n))return w(D),N}if(v){if(ft(v)){const L=await v(b,r),D=Td(L,k);if(D&&(N[h]={...D,...$(xr.validate,D.message)},!n))return w(D.message),N}else if(nt(v)){let L={};for(const D in v){if(!ct(L)&&!n)break;const z=Td(await v[D](b,r),k,D);z&&(L={...z,...$(D,z.message)},w(z.message),n&&(N[h]=L))}if(!ct(L)&&(N[h]={ref:k,...L},!n))return N}}return w(!0),N};const kN={mode:Ft.onSubmit,reValidateMode:Ft.onChange,shouldFocusError:!0};function jN(e={}){let t={...kN,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:ft(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},a=nt(t.defaultValues)||nt(t.values)?ze(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:ze(a),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...u};let p={...m};const f={array:kd(),state:kd()},v=t.criteriaMode===Ft.all,h=T=>F=>{clearTimeout(d),d=setTimeout(T,F)},x=async T=>{if(!i.keepIsValid&&!t.disabled&&(m.isValid||p.isValid||T)){let F;t.resolver?(F=ct((await C()).errors),y()):F=await $(n,!0),F!==r.isValid&&f.state.next({isValid:F})}},y=(T,F)=>{!t.disabled&&(m.isValidating||m.validatingFields||p.isValidating||p.validatingFields)&&((T||Array.from(l.mount)).forEach(B=>{B&&(F?_e(r.validatingFields,B,F):He(r.validatingFields,B))}),f.state.next({validatingFields:r.validatingFields,isValidating:!ct(r.validatingFields)}))},b=(T,F=[],B,ie,te=!0,Q=!0)=>{if(ie&&B&&!t.disabled){if(i.action=!0,Q&&Array.isArray(ae(n,T))){const ve=B(ae(n,T),ie.argA,ie.argB);te&&_e(n,T,ve)}if(Q&&Array.isArray(ae(r.errors,T))){const ve=B(ae(r.errors,T),ie.argA,ie.argB);te&&_e(r.errors,T,ve),wN(r.errors,T)}if((m.touchedFields||p.touchedFields)&&Q&&Array.isArray(ae(r.touchedFields,T))){const ve=B(ae(r.touchedFields,T),ie.argA,ie.argB);te&&_e(r.touchedFields,T,ve)}(m.dirtyFields||p.dirtyFields)&&(r.dirtyFields=hn(a,s)),f.state.next({name:T,isDirty:L(T,F),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else _e(s,T,F)},k=(T,F)=>{_e(r.errors,T,F),f.state.next({errors:r.errors})},w=T=>{r.errors=T,f.state.next({errors:r.errors,isValid:!1})},N=(T,F,B,ie)=>{const te=ae(n,T);if(te){const Q=ae(s,T,Ie(B)?ae(a,T):B);Ie(Q)||ie&&ie.defaultChecked||F?_e(s,T,F?Q:Sd(te._f)):H(T,Q),i.mount&&!i.action&&x()}},S=(T,F,B,ie,te)=>{let Q=!1,ve=!1;const De={name:T};if(!t.disabled){if(!B||ie){(m.isDirty||p.isDirty)&&(ve=r.isDirty,r.isDirty=De.isDirty=L(),Q=ve!==De.isDirty);const Re=Zt(ae(a,T),F);ve=!!ae(r.dirtyFields,T),Re?He(r.dirtyFields,T):_e(r.dirtyFields,T,!0),De.dirtyFields=r.dirtyFields,Q=Q||(m.dirtyFields||p.dirtyFields)&&ve!==!Re}if(B){const Re=ae(r.touchedFields,T);Re||(_e(r.touchedFields,T,B),De.touchedFields=r.touchedFields,Q=Q||(m.touchedFields||p.touchedFields)&&Re!==B)}Q&&te&&f.state.next(De)}return Q?De:{}},A=(T,F,B,ie)=>{const te=ae(r.errors,T),Q=(m.isValid||p.isValid)&&St(F)&&r.isValid!==F;if(t.delayError&&B?(c=h(()=>k(T,B)),c(t.delayError)):(clearTimeout(d),c=null,B?_e(r.errors,T,B):He(r.errors,T)),(B?!Zt(te,B):te)||!ct(ie)||Q){const ve={...ie,...Q&&St(F)?{isValid:F}:{},errors:r.errors,name:T};r={...r,...ve},f.state.next(ve)}},C=async T=>(y(T,!0),await t.resolver(s,t.context,hN(T||l.mount,n,t.criteriaMode,t.shouldUseNativeValidation))),E=async T=>{const{errors:F}=await C(T);if(y(T),T)for(const B of T){const ie=ae(F,B);ie?_e(r.errors,B,ie):He(r.errors,B)}else r.errors=F;return F},$=async(T,F,B={valid:!0})=>{for(const ie in T){const te=T[ie];if(te){const{_f:Q,...ve}=te;if(Q){const De=l.array.has(Q.name),Re=te._f&&xN(te._f);Re&&m.validatingFields&&y([Q.name],!0);const st=await gi(te,l.disabled,s,v,t.shouldUseNativeValidation&&!F,De);if(Re&&m.validatingFields&&y([Q.name]),st[Q.name]&&(B.valid=!1,F||e.shouldUseNativeValidation))break;!F&&(ae(st,Q.name)?De?xx(r.errors,st,Q.name):_e(r.errors,Q.name,st[Q.name]):He(r.errors,Q.name))}!ct(ve)&&await $(ve,F,B)}}return B.valid},I=()=>{for(const T of l.unMount){const F=ae(n,T);F&&(F._f.refs?F._f.refs.every(B=>!$s(B)):!$s(F._f.ref))&&re(T)}l.unMount=new Set},L=(T,F)=>!t.disabled&&(T&&F&&_e(s,T,F),!Zt(oe(),a)),D=(T,F,B)=>pi(T,l,{...i.mount?s:Ie(F)?a:Et(T)?{[T]:F}:F},B,F),z=T=>Xo(ae(i.mount?s:a,T,t.shouldUnregister?ae(a,T,[]):[])),H=(T,F,B={})=>{const ie=ae(n,T);let te=F;if(ie){const Q=ie._f;Q&&(!Q.disabled&&_e(s,T,fx(F,Q)),te=ro(Q.ref)&&vt(F)?"":F,ux(Q.ref)?[...Q.ref.options].forEach(ve=>ve.selected=te.includes(ve.value)):Q.refs?fa(Q.ref)?Q.refs.forEach(ve=>{(!ve.defaultChecked||!ve.disabled)&&(Array.isArray(te)?ve.checked=!!te.find(De=>De===ve.value):ve.checked=te===ve.value||!!te)}):Q.refs.forEach(ve=>ve.checked=ve.value===te):Rl(Q.ref)?Q.ref.value="":(Q.ref.value=te,Q.ref.type||f.state.next({name:T,values:ze(s)})))}(B.shouldDirty||B.shouldTouch)&&S(T,te,B.shouldTouch,B.shouldDirty,!0),B.shouldValidate&&R(T)},U=(T,F,B)=>{for(const ie in F){if(!F.hasOwnProperty(ie))return;const te=F[ie],Q=T+"."+ie,ve=ae(n,Q);(l.array.has(T)||nt(te)||ve&&!ve._f)&&!Xr(te)?U(Q,te,B):H(Q,te,B)}},Z=(T,F,B={})=>{const ie=ae(n,T),te=l.array.has(T),Q=ze(F);_e(s,T,Q),te?(f.array.next({name:T,values:ze(s)}),(m.isDirty||m.dirtyFields||p.isDirty||p.dirtyFields)&&B.shouldDirty&&f.state.next({name:T,dirtyFields:hn(a,s),isDirty:L(T,Q)})):ie&&!ie._f&&!vt(Q)?U(T,Q,B):H(T,Q,B),xi(T,l)?f.state.next({...r,name:T,values:ze(s)}):f.state.next({name:i.mount?T:void 0,values:ze(s)})},V=async T=>{i.mount=!0;const F=T.target;let B=F.name,ie=!0;const te=ae(n,B),Q=Re=>{ie=Number.isNaN(Re)||Xr(Re)&&isNaN(Re.getTime())||Zt(Re,ae(s,B,Re))},ve=vn(t.mode),De=vn(t.reValidateMode);if(te){let Re,st;const er=F.type?Sd(te._f):sx(T),tr=T.type===to.BLUR||T.type===to.FOCUS_OUT,Jo=!gN(te._f)&&!t.resolver&&!ae(r.errors,B)&&!te._f.deps||yN(tr,ae(r.touchedFields,B),r.isSubmitted,De,ve),zn=xi(B,l,tr);_e(s,B,er),tr?(!F||!F.readOnly)&&(te._f.onBlur&&te._f.onBlur(T),c&&c(0)):te._f.onChange&&te._f.onChange(T);const Mn=S(B,er,tr),Qo=!ct(Mn)||zn;if(!tr&&f.state.next({name:B,type:T.type,values:ze(s)}),Jo)return(m.isValid||p.isValid)&&(t.mode==="onBlur"?tr&&x():tr||x()),Qo&&f.state.next({name:B,...zn?{}:Mn});if(!tr&&zn&&f.state.next({...r}),t.resolver){const{errors:ga}=await C([B]);if(y([B]),Q(er),ie){const es=Ed(r.errors,n,B),on=Ed(ga,n,es.name||B);Re=on.error,B=on.name,st=ct(ga)}}else y([B],!0),Re=(await gi(te,l.disabled,s,v,t.shouldUseNativeValidation))[B],y([B]),Q(er),ie&&(Re?st=!1:(m.isValid||p.isValid)&&(st=await $(n,!0)));ie&&(te._f.deps&&(!Array.isArray(te._f.deps)||te._f.deps.length>0)&&R(te._f.deps),A(B,st,Re,Mn))}},M=(T,F)=>{if(ae(r.errors,F)&&T.focus)return T.focus(),1},R=async(T,F={})=>{let B,ie;const te=bt(T);if(t.resolver){const Q=await E(Ie(T)?T:te);B=ct(Q),ie=T?!te.some(ve=>ae(Q,ve)):B}else T?(ie=(await Promise.all(te.map(async Q=>{const ve=ae(n,Q);return await $(ve&&ve._f?{[Q]:ve}:ve)}))).every(Boolean),!(!ie&&!r.isValid)&&x()):ie=B=await $(n);return f.state.next({...!Et(T)||(m.isValid||p.isValid)&&B!==r.isValid?{}:{name:T},...t.resolver||!T?{isValid:B}:{},errors:r.errors}),F.shouldFocus&&!ie&&jn(n,M,T?te:l.mount),ie},oe=(T,F)=>{let B={...i.mount?s:a};return F&&(B=dx(F.dirtyFields?r.dirtyFields:r.touchedFields,B)),Ie(T)?B:Et(T)?ae(B,T):T.map(ie=>ae(B,ie))},ge=(T,F)=>({invalid:!!ae((F||r).errors,T),isDirty:!!ae((F||r).dirtyFields,T),error:ae((F||r).errors,T),isValidating:!!ae(r.validatingFields,T),isTouched:!!ae((F||r).touchedFields,T)}),q=T=>{const F=T?bt(T):void 0;F==null||F.forEach(B=>He(r.errors,B)),F?F.forEach(B=>{f.state.next({name:B,errors:r.errors})}):f.state.next({errors:{}})},G=(T,F,B)=>{const ie=(ae(n,T,{_f:{}})._f||{}).ref,te=ae(r.errors,T)||{},{ref:Q,message:ve,type:De,...Re}=te;_e(r.errors,T,{...Re,...F,ref:ie}),f.state.next({name:T,errors:r.errors,isValid:!1}),B&&B.shouldFocus&&ie&&ie.focus&&ie.focus()},ne=(T,F)=>ft(T)?f.state.subscribe({next:B=>"values"in B&&T(D(void 0,F),B)}):D(T,F,!0),W=T=>f.state.subscribe({next:F=>{bN(T.name,F.name,T.exact)&&vN(F,T.formState||m,Ct,T.reRenderRoot)&&T.callback({values:{...s},...r,...F,defaultValues:a})}}).unsubscribe,X=T=>(i.mount=!0,p={...p,...T.formState},W({...T,formState:{...u,...T.formState}})),re=(T,F={})=>{for(const B of T?bt(T):l.mount)l.mount.delete(B),l.array.delete(B),F.keepValue||(He(n,B),He(s,B)),!F.keepError&&He(r.errors,B),!F.keepDirty&&He(r.dirtyFields,B),!F.keepTouched&&He(r.touchedFields,B),!F.keepIsValidating&&He(r.validatingFields,B),!t.shouldUnregister&&!F.keepDefaultValue&&He(a,B);f.state.next({values:ze(s)}),f.state.next({...r,...F.keepDirty?{isDirty:L()}:{}}),!F.keepIsValid&&x()},K=({disabled:T,name:F})=>{if(St(T)&&i.mount||T||l.disabled.has(F)){const B=l.disabled.has(F)!==!!T;T?l.disabled.add(F):l.disabled.delete(F),B&&i.mount&&!i.action&&x()}},J=(T,F={})=>{let B=ae(n,T);const ie=St(F.disabled)||St(t.disabled);return _e(n,T,{...B||{},_f:{...B&&B._f?B._f:{ref:{name:T}},name:T,mount:!0,...F}}),l.mount.add(T),B?K({disabled:St(F.disabled)?F.disabled:t.disabled,name:T}):N(T,!0,F.value),{...ie?{disabled:F.disabled||t.disabled}:{},...t.progressive?{required:!!F.required,min:Wn(F.min),max:Wn(F.max),minLength:Wn(F.minLength),maxLength:Wn(F.maxLength),pattern:Wn(F.pattern)}:{},name:T,onChange:V,onBlur:V,ref:te=>{if(te){J(T,F),B=ae(n,T);const Q=Ie(te.value)&&te.querySelectorAll&&te.querySelectorAll("input,select,textarea")[0]||te,ve=uN(Q),De=B._f.refs||[];if(ve?De.find(Re=>Re===Q):Q===B._f.ref)return;_e(n,T,{_f:{...B._f,...ve?{refs:[...De.filter($s),Q,...Array.isArray(ae(a,T))?[{}]:[]],ref:{type:Q.type,name:T}}:{ref:Q}}}),N(T,!1,void 0,Q)}else B=ae(n,T,{}),B._f&&(B._f.mount=!1),(t.shouldUnregister||F.shouldUnregister)&&!(ix(l.array,T)&&i.action)&&l.unMount.add(T)}}},ce=()=>t.shouldFocusError&&jn(n,M,l.mount),se=T=>{St(T)&&(f.state.next({disabled:T}),jn(n,(F,B)=>{const ie=ae(n,B);ie&&(F.disabled=ie._f.disabled||T,Array.isArray(ie._f.refs)&&ie._f.refs.forEach(te=>{te.disabled=ie._f.disabled||T}))},0,!1))},ye=(T,F)=>async B=>{let ie;B&&(B.preventDefault&&B.preventDefault(),B.persist&&B.persist());let te=ze(s);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:Q,values:ve}=await C();y(),r.errors=Q,te=ze(ve)}else await $(n);if(l.disabled.size)for(const Q of l.disabled)He(te,Q);if(He(r.errors,"root"),ct(r.errors)){f.state.next({errors:{}});try{await T(te,B)}catch(Q){ie=Q}}else F&&await F({...r.errors},B),ce(),setTimeout(ce);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ct(r.errors)&&!ie,submitCount:r.submitCount+1,errors:r.errors}),ie)throw ie},be=(T,F={})=>{ae(n,T)&&(Ie(F.defaultValue)?Z(T,ze(ae(a,T))):(Z(T,F.defaultValue),_e(a,T,ze(F.defaultValue))),F.keepTouched||He(r.touchedFields,T),F.keepDirty||(He(r.dirtyFields,T),r.isDirty=F.defaultValue?L(T,ze(ae(a,T))):L()),F.keepError||(He(r.errors,T),m.isValid&&x()),f.state.next({...r}))},Fe=(T,F={})=>{const B=T?ze(T):a,ie=ze(B),te=ct(T),Q=te?a:ie;if(F.keepDefaultValues||(a=B),!F.keepValues){if(F.keepDirtyValues){const ve=new Set([...l.mount,...Object.keys(hn(a,s))]);for(const De of Array.from(ve)){const Re=ae(r.dirtyFields,De),st=ae(s,De),er=ae(Q,De);Re&&!Ie(st)?_e(Q,De,st):!Re&&!Ie(er)&&Z(De,er)}}else{if(El&&Ie(T))for(const ve of l.mount){const De=ae(n,ve);if(De&&De._f){const Re=Array.isArray(De._f.refs)?De._f.refs[0]:De._f.ref;if(ro(Re)){const st=Re.closest("form");if(st){st.reset();break}}}}if(F.keepFieldsRef)for(const ve of l.mount)Z(ve,ae(Q,ve));else n={}}s=t.shouldUnregister?F.keepDefaultValues?ze(a):{}:ze(Q),f.array.next({values:{...Q}}),f.state.next({values:{...Q}})}l={mount:F.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!m.isValid||!!F.keepIsValid||!!F.keepDirtyValues||!t.shouldUnregister&&!ct(Q),i.watch=!!t.shouldUnregister,i.keepIsValid=!!F.keepIsValid,i.action=!1,F.keepErrors||(r.errors={}),f.state.next({submitCount:F.keepSubmitCount?r.submitCount:0,isDirty:te?!1:F.keepDirty?r.isDirty:!!(F.keepDefaultValues&&!Zt(T,a)),isSubmitted:F.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:te?{}:F.keepDirtyValues?F.keepDefaultValues&&s?hn(a,s):r.dirtyFields:F.keepDefaultValues&&T?hn(a,T):F.keepDirty?r.dirtyFields:{},touchedFields:F.keepTouched?r.touchedFields:{},errors:F.keepErrors?r.errors:{},isSubmitSuccessful:F.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:a})},Le=(T,F)=>Fe(ft(T)?T(s):T,{...t.resetOptions,...F}),Ve=(T,F={})=>{const B=ae(n,T),ie=B&&B._f;if(ie){const te=ie.refs?ie.refs[0]:ie.ref;te.focus&&setTimeout(()=>{te.focus(),F.shouldSelect&&ft(te.select)&&te.select()})}},Ct=T=>{r={...r,...T}},Me={control:{register:J,unregister:re,getFieldState:ge,handleSubmit:ye,setError:G,_subscribe:W,_runSchema:C,_updateIsValidating:y,_focusError:ce,_getWatch:D,_getDirty:L,_setValid:x,_setFieldArray:b,_setDisabledField:K,_setErrors:w,_getFieldArray:z,_reset:Fe,_resetDefaultValues:()=>ft(t.defaultValues)&&t.defaultValues().then(T=>{Le(T,t.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:I,_disableForm:se,_subjects:f,_proxyFormState:m,get _fields(){return n},get _formValues(){return s},get _state(){return i},set _state(T){i=T},get _defaultValues(){return a},get _names(){return l},set _names(T){l=T},get _formState(){return r},get _options(){return t},set _options(T){t={...t,...T}}},subscribe:X,trigger:R,register:J,handleSubmit:ye,watch:ne,setValue:Z,getValues:oe,reset:Le,resetField:be,clearErrors:q,unregister:re,setError:G,setFocus:Ve,getFieldState:ge};return{...Me,formControl:Me}}var Tr=()=>{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)})},Es=(e,t,r={})=>r.shouldFocus||Ie(r.shouldFocus)?r.focusName||`${e}.${Ie(r.focusIndex)?t:r.focusIndex}.`:"",Ts=(e,t)=>[...e,...bt(t)],As=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Ds(e,t,r){return[...e.slice(0,t),...bt(r),...e.slice(t)]}var Rs=(e,t,r)=>Array.isArray(e)?(Ie(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[],Ps=(e,t)=>[...bt(t),...bt(e)];function CN(e,t){let r=0;const n=[...e];for(const a of t)n.splice(a-r,1),r++;return Xo(n).length?n:[]}var _s=(e,t)=>Ie(t)?[]:CN(e,bt(t).sort((r,n)=>r-n)),Is=(e,t,r)=>{[e[t],e[r]]=[e[r],e[t]]},Ad=(e,t,r)=>(e[t]=r,e);function gx(e){const t=Zo(),{control:r=t,name:n,keyName:a="id",shouldUnregister:s,rules:i}=e,[l,c]=j.useState(r._getFieldArray(n)),d=j.useRef(r._getFieldArray(n).map(Tr)),u=j.useRef(!1);r._names.array.add(n),j.useMemo(()=>i&&l.length>=0&&r.register(n,i),[r,n,l.length,i]),Ko(()=>r._subjects.array.subscribe({next:({values:w,name:N})=>{if(N===n||!N){const S=ae(w,n);Array.isArray(S)&&(c(S),d.current=S.map(Tr))}}}).unsubscribe,[r,n]);const m=j.useCallback(w=>{u.current=!0,r._setFieldArray(n,w)},[r,n]),p=(w,N)=>{const S=bt(ze(w)),A=Ts(r._getFieldArray(n),S);r._names.focus=Es(n,A.length-1,N),d.current=Ts(d.current,S.map(Tr)),m(A),c(A),r._setFieldArray(n,A,Ts,{argA:As(w)})},f=(w,N)=>{const S=bt(ze(w)),A=Ps(r._getFieldArray(n),S);r._names.focus=Es(n,0,N),d.current=Ps(d.current,S.map(Tr)),m(A),c(A),r._setFieldArray(n,A,Ps,{argA:As(w)})},v=w=>{const N=_s(r._getFieldArray(n),w);d.current=_s(d.current,w),m(N),c(N),!Array.isArray(ae(r._fields,n))&&_e(r._fields,n,void 0),r._setFieldArray(n,N,_s,{argA:w})},h=(w,N,S)=>{const A=bt(ze(N)),C=Ds(r._getFieldArray(n),w,A);r._names.focus=Es(n,w,S),d.current=Ds(d.current,w,A.map(Tr)),m(C),c(C),r._setFieldArray(n,C,Ds,{argA:w,argB:As(N)})},x=(w,N)=>{const S=r._getFieldArray(n);Is(S,w,N),Is(d.current,w,N),m(S),c(S),r._setFieldArray(n,S,Is,{argA:w,argB:N},!1)},y=(w,N)=>{const S=r._getFieldArray(n);Rs(S,w,N),Rs(d.current,w,N),m(S),c(S),r._setFieldArray(n,S,Rs,{argA:w,argB:N},!1)},b=(w,N)=>{const S=ze(N),A=Ad(r._getFieldArray(n),w,S);d.current=[...A].map((C,E)=>!C||E===w?Tr():d.current[E]),m(A),c([...A]),r._setFieldArray(n,A,Ad,{argA:w,argB:S},!0,!1)},k=w=>{const N=bt(ze(w));d.current=N.map(Tr),m([...N]),c([...N]),r._setFieldArray(n,[...N],S=>S,{},!0,!1)};return j.useEffect(()=>{if(r._state.action=!1,xi(n,r._names)&&r._subjects.state.next({...r._formState}),u.current&&(!vn(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!vn(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([n]).then(w=>{r._updateIsValidating([n]);const N=ae(w.errors,n),S=ae(r._formState.errors,n);(S?!N&&S.type||N&&(S.type!==N.type||S.message!==N.message):N&&N.type)&&(N?_e(r._formState.errors,n,N):He(r._formState.errors,n),r._subjects.state.next({errors:r._formState.errors}))});else{const w=ae(r._fields,n);w&&w._f&&!(vn(r._options.reValidateMode).isOnSubmit&&vn(r._options.mode).isOnSubmit)&&gi(w,r._names.disabled,r._formValues,r._options.criteriaMode===Ft.all,r._options.shouldUseNativeValidation,!0).then(N=>!ct(N)&&r._subjects.state.next({errors:xx(r._formState.errors,N,n)}))}r._subjects.state.next({name:n,values:ze(r._formValues)}),r._names.focus&&jn(r._fields,(w,N)=>{if(r._names.focus&&N.startsWith(r._names.focus)&&w.focus)return w.focus(),1}),r._names.focus="",r._setValid(),u.current=!1},[l,n,r]),j.useEffect(()=>(!ae(r._formValues,n)&&r._setFieldArray(n),()=>{const w=(N,S)=>{const A=ae(r._fields,N);A&&A._f&&(A._f.mount=S)};r._options.shouldUnregister||s?r.unregister(n):w(n,!1)}),[n,r,a,s]),{swap:j.useCallback(x,[m,n,r]),move:j.useCallback(y,[m,n,r]),prepend:j.useCallback(f,[m,n,r]),append:j.useCallback(p,[m,n,r]),remove:j.useCallback(v,[m,n,r]),insert:j.useCallback(h,[m,n,r]),update:j.useCallback(b,[m,n,r]),replace:j.useCallback(k,[m,n,r]),fields:j.useMemo(()=>l.map((w,N)=>({...w,[a]:d.current[N]||Tr()})),[l,a])}}function NN(e={}){const t=j.useRef(void 0),r=j.useRef(void 0),[n,a]=j.useState({isDirty:!1,isValidating:!1,isLoading:ft(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:ft(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!ft(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...l}=jN(e);t.current={...l,formState:n}}const s=t.current.control;return s._options=e,Ko(()=>{const i=s._subscribe({formState:s._proxyFormState,callback:()=>a({...s._formState}),reRenderRoot:!0});return a(l=>({...l,isReady:!0})),s._formState.isReady=!0,i},[s]),j.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),j.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),j.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),j.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),j.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==n.isDirty&&s._subjects.state.next({isDirty:i})}},[s,n.isDirty]),j.useEffect(()=>{var i;e.values&&!Zt(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),!((i=s._options.resetOptions)===null||i===void 0)&&i.keepIsValid||s._setValid(),r.current=e.values,a(l=>({...l}))):s._resetDefaultValues()},[s,e.values]),j.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=j.useMemo(()=>lx(n,s),[s,n]),t.current}var SN=Object.defineProperty,$N=(e,t,r)=>t in e?SN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Dd=(e,t,r)=>$N(e,typeof t!="symbol"?t+"":t,r);const vi=j.createContext({}),Ur=()=>j.useContext(vi),Rd=new Set(["__proto__","constructor","prototype"]),Ra=(e,t,r)=>{const n=t.split(".");let a=e;for(let i=0;i<n.length-1;i++){const l=n[i];if(Rd.has(l))return;(a[l]==null||typeof a[l]!="object")&&(a[l]={}),a=a[l]}const s=n[n.length-1];Rd.has(s)||(a[s]=r)},bn=async(e,t,r,n,a,s)=>{for(const i of e){const l=s[i.type];if(!l)continue;const c=await l(r,n,i,a);if(c)return i.message??c}},EN=(e,t={},r={})=>async n=>{var a,s,i,l,c;const d={},{errors:u}=Ci(e,n,t);for(const p of u){const f=p.campo.replace(/\[(\d+)\]/g,".$1");Ra(d,f,{type:"custom",message:p.message})}const m=[...e.containers].sort((p,f)=>p.ordem-f.ordem);for(const p of m)if(!p.repeatable&&Se(p.condicional,n,t))for(const f of p.campos){if(f.tipo===P.HIDDEN||f.isDisabled||f.isReadOnly||!Se(f.condicional,n,t))continue;if(f.tipo===P.FIELD_ARRAY){const h=Array.isArray(n[f.nome])?n[f.nome]:[];for(let x=0;x<h.length;x++){const y=h[x];for(const b of f.subFields??[]){if(b.isDisabled||b.isReadOnly||!Se(b.condicional,y,t)||!((a=b.validate)!=null&&a.length)||d[`${f.nome}.${x}.${b.nome}`])continue;const k=await bn(b.validate,b.nome,y[b.nome],y,t,r);k&&Ra(d,`${f.nome}.${x}.${b.nome}`,{type:"custom",message:k})}}continue}if(f.tipo===P.SUB_FORM){const h=n[f.nome]??{};for(const x of((s=f.subSchema)==null?void 0:s.fields)??[]){if(x.isDisabled||x.isReadOnly||!((i=x.validate)!=null&&i.length)||d[`${f.nome}.${x.nome}`])continue;const y=await bn(x.validate,x.nome,h[x.nome],h,t,r);y&&Ra(d,`${f.nome}.${x.nome}`,{type:"custom",message:y})}continue}if(!((l=f.validate)!=null&&l.length)||d[f.nome])continue;const v=await bn(f.validate,f.nome,n[f.nome],n,t,r);v&&(d[f.nome]={type:"custom",message:v})}for(const p of m){if(!p.repeatable||!p.nome||!Se(p.condicional,n,t))continue;const f=Array.isArray(n[p.nome])?n[p.nome]:[];for(let v=0;v<f.length;v++){const h=f[v];for(const x of p.campos){if(x.tipo===P.HIDDEN||x.isDisabled||x.isReadOnly||!Se(x.condicional,h,t)||!((c=x.validate)!=null&&c.length)||d[`${p.nome}.${v}.${x.nome}`])continue;const y=await bn(x.validate,x.nome,h[x.nome],h,t,r);y&&Ra(d,`${p.nome}.${v}.${x.nome}`,{type:"custom",message:y})}}}return Object.keys(d).length>0?{values:{},errors:d}:{values:n,errors:{}}},TN=(e,t={},r={})=>async n=>{var a,s;const i={},l=[...e.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l)if(!(c.condicional&&!Se(c.condicional,n,t))){if(c.repeatable&&c.nome){const d=Array.isArray(n[c.nome])?n[c.nome]:[];for(let u=0;u<d.length;u++){const m=d[u];for(const p of[...c.campos].sort((f,v)=>f.ordem-v.ordem)){if(!((a=p.warn)!=null&&a.length)||!Se(p.condicional,m,t))continue;const f=await bn(p.warn,p.nome,m[p.nome],m,t,r);f&&(i[`${c.nome}.${u}.${p.nome}`]=f)}}continue}for(const d of[...c.campos].sort((u,m)=>u.ordem-m.ordem)){if(!((s=d.warn)!=null&&s.length)||!Se(d.condicional,n,t))continue;const u=await bn(d.warn,d.nome,n[d.nome],n,t,r);u&&(i[d.nome]=u)}}return i},AN=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,yt=(e,t)=>e?e.replace(AN,(r,n)=>t[`evento.${n}`]??t[n]??r):e??"",DN=(e,t)=>({...e,label:yt(e.label,t)}),RN=(e,t)=>{var r;return{...e,label:yt(e.label,t),placeholder:yt(e.placeholder,t),hint:yt(e.hint,t),defaultValue:typeof e.defaultValue=="string"?yt(e.defaultValue,t):e.defaultValue,opcoes:(r=e.opcoes)==null?void 0:r.map(n=>DN(n,t))}},_l=(e,t)=>({...e,titulo:yt(e.titulo,t),descricao:yt(e.descricao,t),campos:e.campos.map(r=>RN(r,t))}),PN=(e,t)=>({...e,titulo:yt(e.titulo,t),descricao:yt(e.descricao,t),containers:e.containers.map(r=>_l(r,t))}),vx=()=>{const e=na(),t=e.layout.containerStyle,r=e.layout.roundness??"rounded-xl",n=Y("overflow-hidden",r,t==="card"?"border":"",t==="bordered"?"border":"",t==="glassmorphism"?"backdrop-blur-sm":""),a=t==="glassmorphism"?{background:"var(--t-surface)",borderColor:"var(--t-border)",borderWidth:"1px",borderStyle:"solid"}:{},s=Y("border-b px-6 py-4",t==="flat"?"border-transparent":"");return{wrapperClass:n,wrapperStyle:a,headerClass:s,headerStyle:t==="glassmorphism"?{borderColor:"var(--t-border)"}:{},tmpl:e}},zt=({name:e,control:t,placeholder:r,type:n="text",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),d=!!c.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...l,value:l.value??"",type:n,placeholder:r,disabled:a,readOnly:s,className:Y(d&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Il=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsx(co,{...i,value:i.value??"",placeholder:r,disabled:n,readOnly:a,rows:3,className:Y(l.error&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Ol=({name:e,control:t,placeholder:r,options:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(Vt,{value:l.value??"",onValueChange:d=>!s&&l.onChange(d),disabled:a||s,children:[o.jsx(Dt,{className:Y(c.error&&"border-destructive focus:ring-destructive"),onBlur:l.onBlur,children:o.jsx(Bt,{placeholder:r??"Selecione..."})}),o.jsx(Rt,{children:n.map(d=>o.jsx(Xe,{value:d.valor,disabled:d.disabled,children:d.label},d.valor))})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Fl=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(rt,{name:i.name,checked:!!i.value,onCheckedChange:c=>!a&&i.onChange(!!c),onBlur:i.onBlur,disabled:n}),r&&o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},bx=({name:e,control:t,options:r,disabled:n})=>{var a;const{field:s,fieldState:i}=Be({name:e,control:t}),l=Array.isArray(s.value)?s.value:[],c=d=>{const u=l.includes(d)?l.filter(m=>m!==d):[...l,d];s.onChange(u)};return o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex flex-col gap-2",onBlur:s.onBlur,children:r.map(d=>o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx(rt,{checked:l.includes(d.valor),onCheckedChange:()=>c(d.valor),disabled:n||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},yx=({name:e,control:t,options:r,visualStyle:n="default",disabled:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),c=n==="card";return o.jsxs("div",{className:"space-y-1",onBlur:i.onBlur,children:[o.jsx(Oi,{value:i.value??"",onValueChange:i.onChange,className:Y(c?"grid grid-cols-2 gap-2 sm:grid-cols-3":"flex flex-col gap-2"),children:r.map(d=>o.jsxs("label",{className:Y("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",(a||d.disabled)&&"cursor-not-allowed opacity-50"),"data-selected":i.value===d.valor?"true":void 0,children:[o.jsx(Fi,{value:d.valor,disabled:a||d.disabled}),o.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},wx=e=>{const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`},_N=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),wx(t)},IN=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),wx(t)},ta=({name:e,control:t,isDatetime:r,disabled:n,readOnly:a,validacao:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),d=r?"datetime-local":"date",u=f=>r?f+"T00:00":f,m=(s==null?void 0:s.minAge)!=null?u(_N(s.minAge)):(s==null?void 0:s.maxDate)!=null?u(s.maxDate):void 0,p=(s==null?void 0:s.maxAge)!=null?u(IN(s.maxAge)):(s==null?void 0:s.minDate)!=null?u(s.minDate):void 0;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value??"",onChange:l.onChange,onBlur:l.onBlur,type:d,min:p,max:m,disabled:n,readOnly:a,className:Y(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})};function ON(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const kx={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};for(const[e,t]of Object.entries(kx));let Pd;function FN(){if(!(typeof globalThis.TextDecoder>"u"))return Pd??(Pd=new globalThis.TextDecoder("utf-8"))}const Dn=32*1024,Gt=65533;function LN(e,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{const r=FN();return r?r.decode(e):MN(e)}case"utf-16le":return VN(e);case"us-ascii":case"ascii":return BN(e);case"latin1":case"iso-8859-1":return UN(e);case"windows-1252":return HN(e);default:throw new RangeError(`Encoding '${t}' not supported`)}}function Ll(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function Qe(e,t,r){t.push(r),t.length>=Dn&&Ll(e,t)}function zN(e,t,r){if(r<=65535){Qe(e,t,r);return}r-=65536,Qe(e,t,55296+(r>>10)),Qe(e,t,56320+(r&1023))}function MN(e){const t=[],r=[];let n=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(n=3);n<e.length;){const a=e[n];if(a<=127){Qe(t,r,a),n++;continue}if(a<194||a>244){Qe(t,r,Gt),n++;continue}if(a<=223){if(n+1>=e.length){Qe(t,r,Gt),n++;continue}const d=e[n+1];if((d&192)!==128){Qe(t,r,Gt),n++;continue}const u=(a&31)<<6|d&63;Qe(t,r,u),n+=2;continue}if(a<=239){if(n+2>=e.length){Qe(t,r,Gt),n++;continue}const d=e[n+1],u=e[n+2];if(!((d&192)===128&&(u&192)===128&&!(a===224&&d<160)&&!(a===237&&d>=160))){Qe(t,r,Gt),n++;continue}const m=(a&15)<<12|(d&63)<<6|u&63;Qe(t,r,m),n+=3;continue}if(n+3>=e.length){Qe(t,r,Gt),n++;continue}const s=e[n+1],i=e[n+2],l=e[n+3];if(!((s&192)===128&&(i&192)===128&&(l&192)===128&&!(a===240&&s<144)&&!(a===244&&s>143))){Qe(t,r,Gt),n++;continue}const c=(a&7)<<18|(s&63)<<12|(i&63)<<6|l&63;zN(t,r,c),n+=4}return Ll(t,r),t.join("")}function VN(e){const t=[],r=[],n=e.length;let a=0;for(;a+1<n;){const s=e[a]|e[a+1]<<8;if(a+=2,s>=55296&&s<=56319){if(a+1<n){const i=e[a]|e[a+1]<<8;i>=56320&&i<=57343?(Qe(t,r,s),Qe(t,r,i),a+=2):Qe(t,r,Gt)}else Qe(t,r,Gt);continue}if(s>=56320&&s<=57343){Qe(t,r,Gt);continue}Qe(t,r,s)}return a<n&&Qe(t,r,Gt),Ll(t,r),t.join("")}function BN(e){const t=[];for(let r=0;r<e.length;r+=Dn){const n=Math.min(e.length,r+Dn),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s]&127;t.push(String.fromCharCode.apply(null,a))}return t.join("")}function UN(e){const t=[];for(let r=0;r<e.length;r+=Dn){const n=Math.min(e.length,r+Dn),a=new Array(n-r);for(let s=r,i=0;s<n;s++,i++)a[i]=e[s];t.push(String.fromCharCode.apply(null,a))}return t.join("")}function HN(e){const t=[];let r="";for(let n=0;n<e.length;n++){const a=e[n],s=a>=128&&a<=159?kx[a]:void 0;r+=s??String.fromCharCode(a),r.length>=Dn&&(t.push(r),r="")}return r&&t.push(r),t.join("")}function jt(e){return new DataView(e.buffer,e.byteOffset)}const WN={len:1,get(e,t){return jt(e).getUint8(t)},put(e,t,r){return jt(e).setUint8(t,r),t+1}},Ge={len:2,get(e,t){return jt(e).getUint16(t,!0)},put(e,t,r){return jt(e).setUint16(t,r,!0),t+2}},fn={len:2,get(e,t){return jt(e).getUint16(t)},put(e,t,r){return jt(e).setUint16(t,r),t+2}},Ke={len:4,get(e,t){return jt(e).getUint32(t,!0)},put(e,t,r){return jt(e).setUint32(t,r,!0),t+4}},_d={len:4,get(e,t){return jt(e).getUint32(t)},put(e,t,r){return jt(e).setUint32(t,r),t+4}},qN={len:4,get(e,t){return jt(e).getInt32(t)},put(e,t,r){return jt(e).setInt32(t,r),t+4}},GN={len:8,get(e,t){return jt(e).getBigUint64(t,!0)},put(e,t,r){return jt(e).setBigUint64(t,r,!0),t+8}};class vr{constructor(t,r){this.len=t,this.encoding=r}get(t,r=0){const n=t.subarray(r,r+this.len);return LN(n,this.encoding)}}const XN="End-Of-Stream";class tt extends Error{constructor(){super(XN),this.name="EndOfStreamError"}}class ZN extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}class jx{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,r=!1){const n=await this.read(t,r);return this.peekQueue.push(t.subarray(0,n)),n}async read(t,r=!1){if(t.length===0)return 0;let n=this.readFromPeekBuffer(t);if(this.endOfStream||(n+=await this.readRemainderFromStream(t.subarray(n),r)),n===0&&!r)throw new tt;return n}readFromPeekBuffer(t){let r=t.length,n=0;for(;this.peekQueue.length>0&&r>0;){const a=this.peekQueue.pop();if(!a)throw new Error("peekData should be defined");const s=Math.min(a.length,r);t.set(a.subarray(0,s),n),n+=s,r-=s,s<a.length&&this.peekQueue.push(a.subarray(s))}return n}async readRemainderFromStream(t,r){let n=0;for(;n<t.length&&!this.endOfStream;){if(this.interrupted)throw new ZN;const a=await this.readFromStream(t.subarray(n),r);if(a===0)break;n+=a}if(!r&&n<t.length)throw new tt;return n}}class KN extends jx{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}class YN extends KN{async readFromStream(t,r){if(t.length===0)return 0;const n=await this.reader.read(new Uint8Array(t.length),{min:r?void 0:t.length});return n.done&&(this.endOfStream=n.done),n.value?(t.set(n.value),n.value.length):0}}class Id extends jx{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,r){const n=Math.min(r.length,t.length);return t.set(r.subarray(0,n)),n<r.length?this.buffer=r.subarray(n):this.buffer=null,n}async readFromStream(t,r){if(t.length===0)return 0;let n=0;for(this.buffer&&(n+=this.writeChunk(t,this.buffer));n<t.length&&!this.endOfStream;){const a=await this.reader.read();if(a.done){this.endOfStream=!0;break}a.value&&(n+=this.writeChunk(t.subarray(n),a.value))}if(!r&&n===0&&this.endOfStream)throw new tt;return n}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}function JN(e){try{const t=e.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new Id(t):new YN(t)}catch(t){if(t instanceof TypeError)return new Id(e.getReader());throw t}}class zl{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t==null?void 0:t.onClose,t!=null&&t.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.readBuffer(n,{position:r})<t.len)throw new tt;return t.get(n,0)}async peekToken(t,r=this.position){const n=new Uint8Array(t.len);if(await this.peekBuffer(n,{position:r})<t.len)throw new tt;return t.get(n,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new tt;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new tt;return t.get(this.numBuffer,0)}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");if(this.fileInfo.size!==void 0){const r=this.fileInfo.size-this.position;if(t>r)return this.position+=r,r}return this.position+=t,t}async close(){var t;await this.abort(),await((t=this.onClose)==null?void 0:t.call(this))}normalizeOptions(t,r){if(!this.supportsRandomAccess()&&r&&r.position!==void 0&&r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:t.length,position:this.position,...r}}abort(){return Promise.resolve()}}const QN=256e3;class e2 extends zl{constructor(t,r){super(r),this.streamReader=t,this.fileInfo=(r==null?void 0:r.fileInfo)??{}}async readBuffer(t,r){const n=this.normalizeOptions(t,r),a=n.position-this.position;if(a>0)return await this.ignore(a),this.readBuffer(t,r);if(a<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;const s=await this.streamReader.read(t.subarray(0,n.length),n.mayBeLess);if(this.position+=s,(!r||!r.mayBeLess)&&s<n.length)throw new tt;return s}async peekBuffer(t,r){const n=this.normalizeOptions(t,r);let a=0;if(n.position){const s=n.position-this.position;if(s>0){const i=new Uint8Array(n.length+s);return a=await this.peekBuffer(i,{mayBeLess:n.mayBeLess}),t.set(i.subarray(s)),a-s}if(s<0)throw new Error("Cannot peek from a negative offset in a stream")}if(n.length>0){try{a=await this.streamReader.peek(t.subarray(0,n.length),n.mayBeLess)}catch(s){if(r!=null&&r.mayBeLess&&s instanceof tt)return 0;throw s}if(!n.mayBeLess&&a<n.length)throw new tt}return a}async ignore(t){if(t<0)throw new RangeError("ignore length must be ≥ 0 bytes");const r=Math.min(QN,t),n=new Uint8Array(r);let a=0;for(;a<t;){const s=t-a,i=await this.readBuffer(n,{length:Math.min(r,s)});if(i<0)return i;a+=i}return a}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}class t2 extends zl{constructor(t,r){super(r),this.uint8Array=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.length}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new tt;return t.set(this.uint8Array.subarray(n.position,n.position+a)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}class r2 extends zl{constructor(t,r){super(r),this.blob=t,this.fileInfo={...(r==null?void 0:r.fileInfo)??{},size:t.size,mimeType:t.type}}async readBuffer(t,r){r!=null&&r.position&&(this.position=r.position);const n=await this.peekBuffer(t,r);return this.position+=n,n}async peekBuffer(t,r){const n=this.normalizeOptions(t,r),a=Math.min(this.blob.size-n.position,n.length);if(!n.mayBeLess&&a<n.length)throw new tt;const s=await this.blob.slice(n.position,n.position+a).arrayBuffer();return t.set(new Uint8Array(s)),a}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}function n2(e,t){const r=JN(e),n=t??{},a=n.onClose;return n.onClose=async()=>{if(await r.close(),a)return a()},new e2(r,n)}function a2(e,t){return new t2(e,t)}function o2(e,t){return new r2(e,t)}var bi={exports:{}},Os,Od;function s2(){if(Od)return Os;Od=1;var e=1e3,t=e*60,r=t*60,n=r*24,a=n*7,s=n*365.25;Os=function(u,m){m=m||{};var p=typeof u;if(p==="string"&&u.length>0)return i(u);if(p==="number"&&isFinite(u))return m.long?c(u):l(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function i(u){if(u=String(u),!(u.length>100)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(m){var p=parseFloat(m[1]),f=(m[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return p*s;case"weeks":case"week":case"w":return p*a;case"days":case"day":case"d":return p*n;case"hours":case"hour":case"hrs":case"hr":case"h":return p*r;case"minutes":case"minute":case"mins":case"min":case"m":return p*t;case"seconds":case"second":case"secs":case"sec":case"s":return p*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}}}function l(u){var m=Math.abs(u);return m>=n?Math.round(u/n)+"d":m>=r?Math.round(u/r)+"h":m>=t?Math.round(u/t)+"m":m>=e?Math.round(u/e)+"s":u+"ms"}function c(u){var m=Math.abs(u);return m>=n?d(u,m,n,"day"):m>=r?d(u,m,r,"hour"):m>=t?d(u,m,t,"minute"):m>=e?d(u,m,e,"second"):u+" ms"}function d(u,m,p,f){var v=m>=p*1.5;return Math.round(u/p)+" "+f+(v?"s":"")}return Os}function i2(e){r.debug=r,r.default=r,r.coerce=c,r.disable=i,r.enable=a,r.enabled=l,r.humanize=s2(),r.destroy=d,Object.keys(e).forEach(u=>{r[u]=e[u]}),r.names=[],r.skips=[],r.formatters={};function t(u){let m=0;for(let p=0;p<u.length;p++)m=(m<<5)-m+u.charCodeAt(p),m|=0;return r.colors[Math.abs(m)%r.colors.length]}r.selectColor=t;function r(u){let m,p=null,f,v;function h(...x){if(!h.enabled)return;const y=h,b=Number(new Date),k=b-(m||b);y.diff=k,y.prev=m,y.curr=b,m=b,x[0]=r.coerce(x[0]),typeof x[0]!="string"&&x.unshift("%O");let w=0;x[0]=x[0].replace(/%([a-zA-Z%])/g,(N,S)=>{if(N==="%%")return"%";w++;const A=r.formatters[S];if(typeof A=="function"){const C=x[w];N=A.call(y,C),x.splice(w,1),w--}return N}),r.formatArgs.call(y,x),(y.log||r.log).apply(y,x)}return h.namespace=u,h.useColors=r.useColors(),h.color=r.selectColor(u),h.extend=n,h.destroy=r.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(f!==r.namespaces&&(f=r.namespaces,v=r.enabled(u)),v),set:x=>{p=x}}),typeof r.init=="function"&&r.init(h),h}function n(u,m){const p=r(this.namespace+(typeof m>"u"?":":m)+u);return p.log=this.log,p}function a(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];const m=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const p of m)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function s(u,m){let p=0,f=0,v=-1,h=0;for(;p<u.length;)if(f<m.length&&(m[f]===u[p]||m[f]==="*"))m[f]==="*"?(v=f,h=p,f++):(p++,f++);else if(v!==-1)f=v+1,h++,p=h;else return!1;for(;f<m.length&&m[f]==="*";)f++;return f===m.length}function i(){const u=[...r.names,...r.skips.map(m=>"-"+m)].join(",");return r.enable(""),u}function l(u){for(const m of r.skips)if(s(u,m))return!1;for(const m of r.names)if(s(u,m))return!0;return!1}function c(u){return u instanceof Error?u.stack||u.message:u}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}var l2=i2;(function(e,t){t.formatArgs=n,t.save=a,t.load=s,t.useColors=r,t.storage=i(),t.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const d="color: "+this.color;c.splice(1,0,d,"color: inherit");let u=0,m=0;c[0].replace(/%[a-zA-Z%]/g,p=>{p!=="%%"&&(u++,p==="%c"&&(m=u))}),c.splice(m,0,d)}t.log=console.debug||console.log||(()=>{});function a(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function s(){let c;try{c=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function i(){try{return localStorage}catch{}}e.exports=l2(t);const{formatters:l}=e.exports;l.j=function(c){try{return JSON.stringify(c)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}})(bi,bi.exports);var c2=bi.exports;const d2=ON(c2),yn={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Fd={get(e){return{signature:Ke.get(e,0),compressedSize:Ke.get(e,8),uncompressedSize:Ke.get(e,12)}},len:16},u2={get(e){const t=Ge.get(e,6);return{signature:Ke.get(e,0),minVersion:Ge.get(e,4),dataDescriptor:!!(t&8),compressedMethod:Ge.get(e,8),compressedSize:Ke.get(e,18),uncompressedSize:Ke.get(e,22),filenameLength:Ge.get(e,26),extraFieldLength:Ge.get(e,28),filename:null}},len:30},m2={get(e){return{signature:Ke.get(e,0),nrOfThisDisk:Ge.get(e,4),nrOfThisDiskWithTheStart:Ge.get(e,6),nrOfEntriesOnThisDisk:Ge.get(e,8),nrOfEntriesOfSize:Ge.get(e,10),sizeOfCd:Ke.get(e,12),offsetOfStartOfCd:Ke.get(e,16),zipFileCommentLength:Ge.get(e,20)}},len:22},p2={get(e){const t=Ge.get(e,8);return{signature:Ke.get(e,0),minVersion:Ge.get(e,6),dataDescriptor:!!(t&8),compressedMethod:Ge.get(e,10),compressedSize:Ke.get(e,20),uncompressedSize:Ke.get(e,24),filenameLength:Ge.get(e,28),extraFieldLength:Ge.get(e,30),fileCommentLength:Ge.get(e,32),relativeOffsetOfLocalHeader:Ke.get(e,42),filename:null}},len:46};function Cx(e){const t=new Uint8Array(Ke.len);return Ke.put(t,0,e),t}const ar=d2("tokenizer:inflate"),Fs=256*1024,f2=Cx(yn.DataDescriptor),Pa=Cx(yn.EndOfCentralDirectory);class ha{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Fs)}async isZip(){return await this.peekSignature()===yn.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(Ke)}async findEndOfCentralDirectoryLocator(){const t=this.tokenizer,r=Math.min(16*1024,t.fileInfo.size),n=this.syncBuffer.subarray(0,r);await this.tokenizer.readBuffer(n,{position:t.fileInfo.size-r});for(let a=n.length-4;a>=0;a--)if(n[a]===Pa[0]&&n[a+1]===Pa[1]&&n[a+2]===Pa[2]&&n[a+3]===Pa[3])return t.fileInfo.size-r+a;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){ar("Cannot reading central-directory without random-read support");return}ar("Reading central-directory...");const t=this.tokenizer.position,r=await this.findEndOfCentralDirectoryLocator();if(r>0){ar("Central-directory 32-bit signature found");const n=await this.tokenizer.readToken(m2,r),a=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let s=0;s<n.nrOfEntriesOfSize;++s){const i=await this.tokenizer.readToken(p2);if(i.signature!==yn.CentralFileHeader)throw new Error("Expected Central-File-Header signature");i.filename=await this.tokenizer.readToken(new vr(i.filenameLength,"utf-8")),await this.tokenizer.ignore(i.extraFieldLength),await this.tokenizer.ignore(i.fileCommentLength),a.push(i),ar(`Add central-directory file-entry: n=${s+1}/${a.length}: filename=${a[s].filename}`)}return this.tokenizer.setPosition(t),a}this.tokenizer.setPosition(t)}async unzip(t){const r=await this.readCentralDirectory();if(r)return this.iterateOverCentralDirectory(r,t);let n=!1;do{const a=await this.readLocalFileHeader();if(!a)break;const s=t(a);n=!!s.stop;let i;if(await this.tokenizer.ignore(a.extraFieldLength),a.dataDescriptor&&a.compressedSize===0){const l=[];let c=Fs;ar("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let d=-1;for(;d<0&&c===Fs;){c=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),d=h2(this.syncBuffer.subarray(0,c),f2);const u=d>=0?d:c;if(s.handler){const m=new Uint8Array(u);await this.tokenizer.readBuffer(m),l.push(m)}else await this.tokenizer.ignore(u)}ar(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(a,x2(l),s.handler)}else s.handler?(ar(`Reading compressed-file-data: ${a.compressedSize} bytes`),i=new Uint8Array(a.compressedSize),await this.tokenizer.readBuffer(i),await this.inflate(a,i,s.handler)):(ar(`Ignoring compressed-file-data: ${a.compressedSize} bytes`),await this.tokenizer.ignore(a.compressedSize));if(ar(`Reading data-descriptor at pos=${this.tokenizer.position}`),a.dataDescriptor&&(await this.tokenizer.readToken(Fd)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Fd.len}`)}while(!n)}async iterateOverCentralDirectory(t,r){for(const n of t){const a=r(n);if(a.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);const s=await this.readLocalFileHeader();if(s){await this.tokenizer.ignore(s.extraFieldLength);const i=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(i),await this.inflate(s,i,a.handler)}}if(a.stop)break}}async inflate(t,r,n){if(t.compressedMethod===0)return n(r);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);ar(`Decompress filename=${t.filename}, compressed-size=${r.length}`);const a=await ha.decompressDeflateRaw(r);return n(a)}static async decompressDeflateRaw(t){const r=new ReadableStream({start(s){s.enqueue(t),s.close()}}),n=new DecompressionStream("deflate-raw"),a=r.pipeThrough(n);try{const s=await new Response(a).arrayBuffer();return new Uint8Array(s)}catch(s){const i=s instanceof Error?`Failed to deflate ZIP entry: ${s.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(i)}}async readLocalFileHeader(){const t=await this.tokenizer.peekToken(Ke);if(t===yn.LocalFileHeader){const r=await this.tokenizer.readToken(u2);return r.filename=await this.tokenizer.readToken(new vr(r.filenameLength,"utf-8")),r}if(t===yn.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}function h2(e,t){const r=e.length,n=t.length;if(n>r)return-1;for(let a=0;a<=r-n;a++){let s=!0;for(let i=0;i<n;i++)if(e[a+i]!==t[i]){s=!1;break}if(s)return a}return-1}function x2(e){const t=e.reduce((a,s)=>a+s.length,0),r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}class g2{constructor(t){this.tokenizer=t}inflate(){const t=this.tokenizer;return new ReadableStream({async pull(r){const n=new Uint8Array(1024),a=await t.readBuffer(n,{mayBeLess:!0});if(a===0){r.close();return}r.enqueue(n.subarray(0,a))}}).pipeThrough(new DecompressionStream("gzip"))}}new globalThis.TextDecoder("utf8");new globalThis.TextEncoder;Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ld(e){const{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}function v2(e,t){if(t==="utf-16le"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a&255,a>>8&255)}return r}if(t==="utf-16be"){const r=[];for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);r.push(a>>8&255,a&255)}return r}return[...e].map(r=>r.charCodeAt(0))}function b2(e,t=0){const r=Number.parseInt(new vr(6).get(e,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let n=256;for(let a=t;a<t+148;a++)n+=e[a];for(let a=t+156;a<t+512;a++)n+=e[a];return r===n}const y2={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},w2=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],k2=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"],Zn=4100,j2=Zn-2,ur=1024*1024,zd=1024,C2=2**31-1,Mt=16*1024*1024,Yo=ur,Md=ur,N2=Mt,S2=1,Vd=100,Ls=Mt,Bd=64,Ud=Yo,$2=256,E2=512,T2=Mt,A2=512,D2=512,Hd=256,Wd=Yo,qd=Yo,R2=Yo,Gd=Mt,P2=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),_2=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],I2=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);class Yr extends Error{}function O2(e){var t;const r=e==null?void 0:e.streamReader;if(((t=r==null?void 0:r.constructor)==null?void 0:t.name)!=="WebStreamByobReader")return e;const{reader:n}=r,a=async()=>{await n.cancel(),n.releaseLock()};return r.close=a,r.abort=async()=>{r.interrupted=!0,await a()},e}function Ml(e,t,r){if(!Number.isFinite(e)||e<0||e>t)throw new Yr(`${r} has invalid size ${e} (maximum ${t} bytes)`);return e}async function Rr(e,t,{maximumLength:r=Mt,reason:n="skip"}={}){const a=Ml(t,r,n);await e.ignore(a)}async function zs(e,t,r,{maximumLength:n=t.length,reason:a="read"}={}){const s=t.length,i=Ml(s,n,a);return e.readBuffer(t,{...r,length:i})}async function F2(e,{maximumLength:t=ur}={}){const r=new ReadableStream({start(l){l.enqueue(e),l.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),n=[];let a=0;try{for(;;){const{done:l,value:c}=await r.read();if(l)break;if(a+=c.length,a>t)throw await r.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);n.push(c)}}finally{r.releaseLock()}const s=new Uint8Array(a);let i=0;for(const l of n)s.set(l,i),i+=l.length;return s}const Nx=134695760,ao=16,L2=ao-1;function z2(e,t){if(e.length<ao)return-1;const r=e.length-ao;for(let n=0;n<=r;n++)if(Ke.get(e,n)===Nx&&Ke.get(e,n+8)===t+n)return n;return-1}function M2(e){return(e.codePointAt(0)&32)!==0}function V2(e,t){const r=new Uint8Array(t);let n=0;for(const a of e)r.set(a,n),n+=a.length;return r}async function B2(e,{shouldBuffer:t,maximumLength:r=ur}={}){const{syncBuffer:n}=e,{length:a}=n,s=[];let i=0;for(;;){const l=await e.tokenizer.peekBuffer(n,{mayBeLess:!0}),c=z2(n.subarray(0,l),i),d=c>=0?0:l===a?Math.min(L2,l-1):0,u=c>=0?c:l-d;if(u===0)break;if(i+=u,i>r)throw new Error(`ZIP entry compressed data exceeds ${r} bytes`);if(t){const m=new Uint8Array(u);await e.tokenizer.readBuffer(m),s.push(m)}else await e.tokenizer.ignore(u);if(c>=0)break}if(mt(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=i),!!t)return V2(s,i)}function U2(e,t){return mt(e.tokenizer)?Math.max(0,Mt-(e.tokenizer.position-t)):Math.max(0,ur-e.knownSizeDescriptorScannedBytes)}async function H2(e,t,{shouldBuffer:r,maximumDescriptorLength:n=ur}={}){if(t.dataDescriptor&&t.compressedSize===0)return B2(e,{shouldBuffer:r,maximumLength:n});if(!r){await Rr(e.tokenizer,t.compressedSize,{maximumLength:mt(e.tokenizer)?ur:e.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}const a=Y2(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>a)throw new Error(`ZIP entry compressed data exceeds ${a} bytes`);const s=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(s),s}ha.prototype.inflate=async function(e,t,r){if(e.compressedMethod===0)return r(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);const n=await F2(t,{maximumLength:ur});return r(n)};ha.prototype.unzip=async function(e){let t=!1,r=0;const n=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Kn(this.tokenizer,n,Mt))throw new Yr(`ZIP stream probing exceeds ${Mt} bytes`);const a=await this.readLocalFileHeader();if(!a)break;if(r++,r>zd)throw new Error(`ZIP entry count exceeds ${zd}`);const s=e(a);t=!!s.stop,await this.tokenizer.ignore(a.extraFieldLength);const i=await H2(this,a,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(ur,U2(this,n))});if(s.handler&&await this.inflate(a,i,s.handler),a.dataDescriptor){const l=new Uint8Array(ao);if(await this.tokenizer.readBuffer(l),Ke.get(l,0)!==Nx)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(Kn(this.tokenizer,n,Mt))throw new Yr(`ZIP stream probing exceeds ${Mt} bytes`)}while(!t)};function W2(e,t){const r=e.getReader();let n=0,a=!1,s=!1;const i=async l=>{a||s||(s=!0,await r.cancel(l))};return new ReadableStream({async pull(l){if(n>=t){l.close(),await i();return}const{done:c,value:d}=await r.read();if(c||!d){a=!0,l.close();return}const u=t-n;if(d.length>u){l.enqueue(d.subarray(0,u)),n+=u,l.close(),await i();return}l.enqueue(d),n+=d.length},async cancel(l){await i(l)}})}async function q2(e,t){return new Vl(t).fromBlob(e)}function Xd(e){switch(e=e.toLowerCase(),e){case"application/epub+zip":return{ext:"epub",mime:e};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:e};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:e};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:e};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:e};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:e};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:e};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:e};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:e};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:e};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:e};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:e};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:e};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:e};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:e};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:e};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"}}}function or(e,t,r){r={offset:0,...r};for(const[n,a]of t.entries())if(r.mask){if(a!==(r.mask[n]&e[n+r.offset]))return!1}else if(a!==e[n+r.offset])return!1;return!0}function G2(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):Zn}function X2(e,t,r){return r===void 0?e.read(t):(r.throwIfAborted(),new Promise((n,a)=>{const s=()=>{r.removeEventListener("abort",i)},i=()=>{const l=r.reason;s(),(async()=>{try{await e.cancel(l)}catch{}})(),a(l)};r.addEventListener("abort",i,{once:!0}),(async()=>{try{const l=await e.read(t);s(),n(l)}catch(l){s(),a(l)}})()}))}function Z2(e){return Number.isFinite(e)?Math.max(0,Math.min(j2,Math.trunc(e))):0}function K2(e){return Number.isFinite(e)?Math.max(0,e):Number.MAX_SAFE_INTEGER}function mt(e){const t=e.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Kn(e,t,r){return mt(e)&&e.position-t>r}function Y2(e){const t=e.fileInfo.size,r=Number.isFinite(t)?Math.max(0,t-e.position):Number.MAX_SAFE_INTEGER;return Math.min(r,C2)}function J2(e){if(e instanceof tt||e instanceof Yr)return!0;if(!(e instanceof Error))return!1;if(P2.has(e.message)||I2.has(e.code))return!0;for(const t of _2)if(e.message.startsWith(t))return!0;return!1}function Zd(e,t=ur){const r=[e.compressedSize,e.uncompressedSize];for(const n of r)if(!Number.isFinite(n)||n<0||n>t)return!1;return!0}function Q2(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function eS(e,t){t.startsWith("word/")&&(e.hasWordDirectory=!0),t.startsWith("ppt/")&&(e.hasPresentationDirectory=!0),t.startsWith("xl/")&&(e.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(e.hasThreeDimensionalModelEntry=!0)}function Kd(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(e.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(e.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(e.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function tS(e){const t=e.indexOf('.main+xml"');if(t===-1){const a="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return e.includes(`ContentType="${a}"`)?a:void 0}const r=e.slice(0,t),n=r.lastIndexOf('"');return r.slice(n+1)}class Vl{constructor(t){Dd(this,"detectConfident",async n=>{if(this.buffer=new Uint8Array(Zn),n.fileInfo.size===void 0&&(n.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=n,mt(n)&&(await n.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(n);if(await n.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await n.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=Hd?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(n));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(n);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await Rr(n,6,{maximumLength:6,reason:"ID3 header prefix"});const a=await n.readToken(y2),s=mt(n);if(!Number.isFinite(a)||a<0||s&&(a>Ls||n.position+a>Ls))return;if(n.position+a>n.fileInfo.size)return s?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await Rr(n,a,{maximumLength:s?Ls:n.fileInfo.size,reason:"ID3 payload"})}catch(i){if(i instanceof tt)return;throw i}return this.detectionReentryCount>=Hd?void 0:(this.detectionReentryCount++,this.parseTokenizer(n,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let a;const s=Q2();try{await new ha(n).unzip(i=>{eS(s,i.filename);const l=i.filename==="[Content_Types].xml",c=Kd(s);if(!l&&c)return a=c,{stop:!0};switch(i.filename){case"META-INF/mozilla.rsa":return a={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return a={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return Zd(i,Md)?{async handler(d){const u=new TextDecoder("utf-8").decode(d).trim();a=Xd(u)},stop:!0}:{};case"[Content_Types].xml":return s.hasContentTypesEntry=!0,Zd(i,Md)?(s.isParsingContentTypes=!0,{async handler(d){const u=new TextDecoder("utf-8").decode(d),m=tS(u);m&&(a=Xd(m)),s.hasParsedContentTypesEntry=!0,s.isParsingContentTypes=!1},stop:!0}):(s.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(i.filename)?(a={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(i){if(!J2(i))throw i;s.isParsingContentTypes&&(s.isParsingContentTypes=!1,s.hasUnparseableContentTypes=!0)}return a??Kd(s)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await n.ignore(28);const a=new Uint8Array(8);return await n.readBuffer(a),or(a,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:or(a,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:or(a,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:or(a,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:or(a,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:or(a,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const a=await this.readTiffHeader(!1);if(a)return a}if(this.check([77,77])){const a=await this.readTiffHeader(!0);if(a)return a}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function a(){const d=await n.peekNumber(WN);let u=128,m=0;for(;!(d&u)&&u!==0;)++m,u>>=1;const p=new Uint8Array(m+1);return await zs(n,p,void 0,{maximumLength:p.length,reason:"EBML field"}),p}async function s(){const d=await a(),u=await a();u[0]^=128>>u.length-1;const m=Math.min(6,u.length),p=new DataView(d.buffer),f=new DataView(u.buffer,u.length-m,m);return{id:Ld(p),len:Ld(f)}}async function i(d){let u=0;for(;d>0;){if(u++,u>$2||Kn(n,c,Mt))return;const m=n.position,p=await s();if(p.id===17026){if(p.len>Bd)return;const f=Ml(p.len,Bd,"EBML DocType");return(await n.readToken(new vr(f))).replaceAll(/\00.*$/g,"")}if(mt(n)&&(!Number.isFinite(p.len)||p.len<0||p.len>Ud)||(await Rr(n,p.len,{maximumLength:mt(n)?Ud:n.fileInfo.size,reason:"EBML payload"}),--d,n.position<=m))return}}const l=await s(),c=n.position;switch(await i(l.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){const a=_d.get(this.buffer,4),s=fn.get(this.buffer,6);if(a>0&&a<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(s>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const a=new vr(4,"latin1").get(this.buffer,2);if(a.match("^d*")&&a>=1e3&&a<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await n.ignore(8),await n.readToken(new vr(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
83
+ `,"\r"," "," ","\0"].some(a=>this.checkString(a,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){const a={ext:"png",mime:"image/png"},s={ext:"apng",mime:"image/apng"};await n.ignore(8);async function i(){return{length:await n.readToken(qN),type:await n.readToken(new vr(4,"latin1"))}}const l=mt(n),c=n.position;let d=0,u=!1;do{if(d++,d>E2||Kn(n,c,T2))break;const m=n.position,p=await i();if(p.length<0)return;if(p.type==="IHDR"){if(p.length!==13)return;u=!0}switch(p.type){case"IDAT":return a;case"acTL":return s;default:if(!u&&p.type!=="CgBI")return;if(l&&p.length>Wd)return u&&M2(p.type)?a:void 0;try{await Rr(n,p.length+4,{maximumLength:l?Wd+4:n.fileInfo.size,reason:"PNG chunk payload"})}catch(f){if(!l&&(f instanceof Yr||f instanceof tt))return a;throw f}}if(n.position<=m)break}while(n.position+8<n.fileInfo.size);return a}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&this.buffer[8]&96){const a=new vr(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(a){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return a.startsWith("3g")?a.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
84
+ `))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){let a=!1;try{async function s(){const d=new Uint8Array(16);return await zs(n,d,void 0,{maximumLength:d.length,reason:"ASF header GUID"}),{id:d,size:Number(await n.readToken(GN))}}await Rr(n,30,{maximumLength:30,reason:"ASF header prelude"});const i=mt(n),l=n.position;let c=0;for(;n.position+24<n.fileInfo.size&&(c++,!(c>A2||Kn(n,l,Mt)));){const d=n.position,u=await s();let m=u.size-24;if(!Number.isFinite(m)||m<0){a=!0;break}if(or(u.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const p=new Uint8Array(16);if(m-=await zs(n,p,void 0,{maximumLength:p.length,reason:"ASF stream type GUID"}),or(p,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(or(p,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(i&&m>qd){a=!0;break}if(await Rr(n,m,{maximumLength:i?qd:n.fileInfo.size,reason:"ASF header payload"}),n.position<=d){a=!0;break}}}catch(s){if(s instanceof tt||s instanceof Yr)mt(n)&&(a=!0);else throw s}return a?void 0:{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await n.ignore(20),await n.readToken(new vr(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await n.peekBuffer(this.buffer,{length:Math.min(256,n.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const a=new DataView(this.buffer.buffer).getUint32(12,!0);if(a>12&&this.buffer.length>=a+16)try{const s=new TextDecoder().decode(this.buffer.subarray(16,a+16));if(JSON.parse(s).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await n.peekBuffer(this.buffer,{length:Math.min(512,n.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&b2(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){const a="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:a})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:a})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
85
+ `,{offset:2,encoding:a})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}}),Dd(this,"detectImprecise",async n=>{this.buffer=new Uint8Array(Zn);const a=K2(n.fileInfo.size);if(await n.peekBuffer(this.buffer,{length:Math.min(8,a),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await n.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,a),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let s=0;s<=this.options.mpegOffsetTolerance;++s){const i=this.scanMpeg(s);if(i)return i}});const r=Z2(t==null?void 0:t.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:r},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return O2(n2(t,this.getTokenizerOptions()))}async parseTokenizer(t,r=0){this.detectionReentryCount=r;const n=t.position;for(const a of this.detectors){let s;try{s=await a.detect(t)}catch(i){if(i instanceof tt||i instanceof Yr)return;throw i}if(s)return s;if(n!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);const r=t instanceof Uint8Array?t:new Uint8Array(t);if((r==null?void 0:r.length)>1)return this.fromTokenizer(a2(r,this.getTokenizerOptions()))}async fromBlob(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=o2(t,this.getTokenizerOptions());return this.fromTokenizer(n)}async fromStream(t){var r;(r=this.options.signal)==null||r.throwIfAborted();const n=this.createTokenizerFromWebStream(t);return this.fromTokenizer(n)}async toDetectionStream(t,r){const n=G2((r==null?void 0:r.sampleSize)??Zn);let a,s;const i=t.getReader({mode:"byob"});try{const{value:d,done:u}=await X2(i,new Uint8Array(n),this.options.signal);if(s=d,!u&&d)try{a=await this.fromBuffer(d.subarray(0,n))}catch(m){if(!(m instanceof tt))throw m;a=void 0}s=d}finally{i.releaseLock()}const l=new TransformStream({async start(d){d.enqueue(s)},transform(d,u){u.enqueue(d)}}),c=t.pipeThrough(l);return c.fileType=a,c}async detectGzip(t){var r;if(this.gzipProbeDepth>=S2)return{ext:"gz",mime:"application/gzip"};const n=new g2(t),a=W2(n.inflate(),N2),s=mt(t);let i,l,c,d;if(s){const u=new AbortController;i=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${Vd} ms`,"TimeoutError"))},Vd),l=this.options.signal===void 0?u.signal:AbortSignal.any([this.options.signal,u.signal]),c=new Vl({...this.options,signal:l}),c.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{d=await(c??this).fromStream(a)}catch(u){if((u==null?void 0:u.name)==="AbortError"&&((r=l==null?void 0:l.reason)==null?void 0:r.name)!=="TimeoutError")throw u}finally{clearTimeout(i),s||this.gzipProbeDepth--}return(d==null?void 0:d.ext)==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,r){return or(this.buffer,t,r)}checkString(t,r){return this.check(v2(t,r==null?void 0:r.encoding),r)}async readTiffTag(t){const r=await this.tokenizer.readToken(t?fn:Ge);switch(await this.tokenizer.ignore(10),r){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(t){const r=await this.tokenizer.readToken(t?fn:Ge);if(!(r>D2)&&!(mt(this.tokenizer)&&2+r*12>Gd))for(let n=0;n<r;++n){const a=await this.readTiffTag(t);if(a)return a}}async readTiffHeader(t){const r={ext:"tif",mime:"image/tiff"},n=(t?fn:Ge).get(this.buffer,2),a=(t?_d:Ke).get(this.buffer,4);if(n===42){if(a>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(a>=8){const l=(t?fn:Ge).get(this.buffer,8),c=(t?fn:Ge).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(mt(this.tokenizer)&&a>R2)return r;const s=mt(this.tokenizer)?Gd:this.tokenizer.fileInfo.size;try{await Rr(this.tokenizer,a,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof tt)return;throw l}let i;try{i=await this.readTiffIFD(t)}catch(l){if(l instanceof tt)return;throw l}return i??r}if(n===43)return r}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}}new Set(w2);new Set(k2);const Yd=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,Sx=({name:e,control:t,disabled:r,campo:n,fileTypes:a,maxFileSize:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),{uploadFile:d,deleteUploadedFile:u,onUploadStart:m,onUploadEnd:p}=Ur(),[f,v]=j.useState({status:"idle"}),h=j.useRef(null),[x,y]=j.useState(!1),b=j.useRef(!0),k=j.useRef(m);k.current=m;const w=j.useRef(p);w.current=p,j.useEffect(()=>()=>{b.current=!1},[]);const N=typeof l.value=="string"&&l.value?l.value:null,S=j.useCallback(async $=>{var I,L,D;if(a&&a.length>0){const z=await q2($),H=(z==null?void 0:z.ext)??"",U=(z==null?void 0:z.mime)??"",Z=((I=$.name.split(".").pop())==null?void 0:I.toLowerCase())??"",V=$.type.toLowerCase();if(!a.some(M=>{const R=M.toLowerCase();return!!(H&&(R===H||R===U)||U&&R.endsWith("/*")&&U.startsWith(R.slice(0,-1))||!H&&(R===Z||R===V||R.endsWith("/*")&&V.startsWith(R.slice(0,-1))))})){v({status:"error",message:`Tipo de arquivo não permitido. Permitidos: ${a.join(", ")}`});return}}if(s&&$.size>s){v({status:"error",message:`Arquivo muito grande. Tamanho máximo: ${Yd(s)}`});return}if(!d){v({status:"error",message:"Preview: upload não disponível sem configuração."});return}v({status:"uploading",fileName:$.name,progress:0}),(L=k.current)==null||L.call(k);try{if(N&&u)try{await u(N)}catch{}const z=await d($,n??e,H=>{b.current&&v(U=>U.status==="uploading"?{...U,progress:Math.min(100,H)}:U)});if(!b.current)return;l.onChange(z),v({status:"done",uploadId:z,fileName:$.name,size:$.size})}catch{if(!b.current)return;v({status:"error",message:"Falha no upload. Tente novamente."})}finally{b.current&&((D=w.current)==null||D.call(w))}},[d,u,N,n,e,l,a,s]),A=j.useCallback($=>{var I;const L=(I=$.target.files)==null?void 0:I[0];L&&S(L),$.target.value=""},[S]),C=j.useCallback(()=>{var $;N&&u&&(($=k.current)==null||$.call(k),u(N).catch(()=>{}).finally(()=>{var I;(I=w.current)==null||I.call(w)})),l.onChange(""),v({status:"idle"}),h.current&&(h.current.value="")},[l,N,u]);if(f.status==="done"||f.status==="idle"&&N){const $=f.status==="done"?f.fileName:"Arquivo enviado",I=f.status==="done"?f.size:null;return o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-green-500 bg-green-500/5 px-4 py-3 gap-2",children:[o.jsxs("svg",{className:"shrink-0 text-green-500",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[o.jsx("rect",{width:"20",height:"20",rx:"4",fill:"currentColor",fillOpacity:"0.15"}),o.jsx("path",{d:"M5 10.5L8.5 14L15 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:$}),I!==null&&o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:Yd(I)}),!r&&o.jsx("button",{type:"button",onClick:C,className:"ml-2 shrink-0 text-muted-foreground hover:text-destructive transition-colors","aria-label":"Remover arquivo",children:"✕"})]})}if(f.status==="uploading"){const{fileName:$,progress:I}=f;return o.jsxs("div",{className:"rounded-lg border border-input px-4 py-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm font-medium truncate flex-1",children:$}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:[I,"%"]})]}),o.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary transition-all duration-200 rounded-full",style:{width:`${I}%`}})})]})}const E=f.status==="error";return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{role:"button",tabIndex:r?-1:0,"aria-label":"Selecionar arquivo",className:Y("flex items-center justify-center rounded-lg border-2 border-dashed px-4 py-6 transition-colors cursor-pointer",x?"border-primary bg-primary/5":E||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 $;return!r&&(($=h.current)==null?void 0:$.click())},onKeyDown:$=>{var I;($.key==="Enter"||$.key===" ")&&((I=h.current)==null||I.click())},onDragOver:$=>{$.preventDefault(),r||y(!0)},onDragLeave:()=>y(!1),onDrop:r?void 0:$=>{var I;$.preventDefault(),y(!1);const L=(I=$.dataTransfer.files)==null?void 0:I[0];L&&S(L)},onBlur:l.onBlur,children:[o.jsx("input",{ref:h,type:"file",onChange:A,disabled:r,className:"sr-only"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:x?"Solte o arquivo aqui":"Clique ou arraste um arquivo"})]}),E&&o.jsxs("p",{className:"text-sm text-destructive",children:[f.message," · ",o.jsx("button",{type:"button",className:"underline hover:no-underline",onClick:()=>v({status:"idle"}),children:"Tentar novamente"})]}),!E&&((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},rS={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")},Jr=({name:e,control:t,placeholder:r,maskType:n,disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),d=rS[n||""],u=j.useCallback(m=>{l.onChange(d?d(m.target.value):m.target.value)},[l,d]);return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{name:l.name,value:l.value||"",onChange:u,onBlur:l.onBlur,placeholder:r,disabled:a,readOnly:s,className:Y(c.error&&"border-destructive focus-visible:ring-destructive")}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Bl=({name:e,control:t})=>{const{field:r}=Be({name:e,control:t});return o.jsx("input",{type:"hidden",...r,value:r.value??""})},$x=e=>e.replace(/\D/g,""),nS=e=>{const t=$x(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},aS=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()},Ex=({name:e,control:t,placeholder:r="00000-000",disabled:n,readOnly:a,cepFillMap:s})=>{var i,l;const{field:c,fieldState:d}=Be({name:e,control:t}),{setValue:u}=lN(),{cepLookup:m}=Ur(),[p,f]=j.useState("idle"),[v,h]=j.useState(null),x=j.useRef(null),y=j.useRef(!0);j.useEffect(()=>()=>{var w;y.current=!1,(w=x.current)==null||w.abort()},[]);const b=j.useCallback(async()=>{var w;c.onBlur();const N=$x(c.value??"");if(N.length===8){(w=x.current)==null||w.abort(),x.current=new AbortController,f("loading"),h(null);try{let S;if(m){const E=x.current;if(S=await m(N,E.signal),E.signal.aborted||!y.current)return}else{const E=await aS(N,x.current.signal);if(!y.current)return;if(E.erro){f("error"),h("CEP não encontrado");return}S={logradouro:E.logradouro,bairro:E.bairro,cidade:E.localidade,estado:E.uf}}if(!y.current)return;if(S.erro){f("error"),h("CEP não encontrado");return}const A=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",C=(E,$,I)=>{if(!I)return;const L=s!=null&&s[E]?`${A}${s[E]}`:`${A}${$}`;u(L,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),f("success")}catch(S){if(S instanceof Error&&S.name==="AbortError"||!y.current)return;f("error"),h("Erro ao buscar CEP")}}},[c,m,u,e,s]),k=j.useCallback(w=>{c.onChange(nS(w.target.value))},[c]);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{name:c.name,value:c.value||"",onChange:k,onBlur:b,placeholder:r,disabled:n,readOnly:a,className:Y("pr-9",d.error&&"border-destructive focus-visible:ring-destructive")}),o.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",children:[p==="loading"&&o.jsx(O.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"}),p==="success"&&o.jsx(O.Check,{className:"h-4 w-4 text-green-500"}),p==="error"&&o.jsx(O.AlertCircle,{className:"h-4 w-4 text-destructive"})]})]}),(((i=d.error)==null?void 0:i.message)||v)&&o.jsx("p",{className:"text-sm text-destructive",children:((l=d.error)==null?void 0:l.message)||v})]})},oS=({field:e,control:t,nameOverride:r})=>{const n={name:r,control:t,placeholder:e.placeholder};switch(e.tipo){case P.TEXTO:return o.jsx(zt,{...n,type:"text"});case P.EMAIL:return o.jsx(zt,{...n,type:"email"});case P.NUMBER:return o.jsx(zt,{...n,type:"number"});case P.TEXTAREA:return o.jsx(Il,{...n});case P.SELECT:return o.jsx(Ol,{...n,options:e.opcoes??[]});case P.RADIO:return o.jsx(yx,{...n,options:e.opcoes??[]});case P.CHECKBOX:return o.jsx(Fl,{name:r,control:t,label:e.label});case P.CHECKBOX_GROUP:return o.jsx(bx,{...n,options:e.opcoes??[]});case P.DATE:return o.jsx(ta,{...n,validacao:e.validacao});case P.DATETIME:return o.jsx(ta,{...n,isDatetime:!0,validacao:e.validacao});case P.FILE:return o.jsx(Sx,{name:r,control:t});case P.TELEFONE:return o.jsx(Jr,{...n,maskType:"telefone"});case P.CPF:return o.jsx(Jr,{...n,maskType:"cpf"});case P.CEP:return o.jsx(Ex,{name:r,control:t,placeholder:e.placeholder});case P.HIDDEN:return o.jsx(Bl,{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.`),o.jsx(zt,{...n,type:"text"})}},sS=({name:e,control:t,subFields:r=[],minItems:n=1,maxItems:a,itemLabel:s="Item",addLabel:i})=>{var l;const{fields:c,append:d,remove:u}=gx({control:t,name:e}),{errors:m}=cx({control:t}),p=(l=m[e])==null?void 0:l.message,f=j.useCallback(()=>{const y={};for(const b of r)b.initialValue!==void 0?y[b.nome]=b.initialValue:b.defaultValue!==void 0&&(y[b.nome]=b.defaultValue);return y},[r]);j.useEffect(()=>{if(c.length<n)for(let y=c.length;y<n;y++)d(f())},[n]);const v=[...r].sort((y,b)=>y.ordem-b.ordem),h=!a||c.length<a,x=i??`Adicionar ${s.toLowerCase()}`;return o.jsxs("div",{className:"space-y-3",children:[c.map((y,b)=>o.jsxs("div",{className:"rounded-lg border p-4",style:{borderColor:"var(--t-border)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary/10 text-xs font-bold text-primary shrink-0",children:b+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[s," ",b+1]})]}),c.length>n&&o.jsx(Te,{type:"button",variant:"ghost",size:"icon",onClick:()=>u(b),"aria-label":`Remover ${s.toLowerCase()} ${b+1}`,className:"text-muted-foreground hover:text-destructive",children:o.jsx(O.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:v.map(k=>{const w=`${e}.${b}.${k.nome}`,N=`span ${k.tamanho??12}`,S=o.jsx(oS,{field:k,control:t,nameOverride:w});return k.tipo===P.CHECKBOX||k.tipo===P.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:N},children:S},k.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:N},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1 text-sm text-foreground",children:[k.label,k.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),S,k.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:k.hint})]},k.id)})})]},y.id)),h&&o.jsxs(Te,{type:"button",variant:"outline",className:"w-full",onClick:()=>d(f()),children:[o.jsx(O.Plus,{className:"w-4 h-4"}),x]}),a&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",a," ",s.toLowerCase(),a>1?"s":""]}),p&&o.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[o.jsx(O.AlertCircle,{className:"w-4 h-4 shrink-0"}),p]})]})},Jd=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,iS=(e,t)=>{const r=new Date(e.slice(0,10)+"T00:00:00Z"),n=new Date(t.slice(0,10)+"T00:00:00Z");return Math.round((n.getTime()-r.getTime())/864e5)+1},lS=(e,t)=>{const r=[],n=new Date(e.slice(0,10)+"T00:00:00Z"),a=new Date(t.slice(0,10)+"T00:00:00Z");let s=0;for(;n<=a&&s<60;)r.push(n.toISOString().slice(0,10)),n.setUTCDate(n.getUTCDate()+1),s++;return r},cS=e=>{const[t,r,n]=e.split("-").map(Number),a=new Date(Date.UTC(t,r-1,n)),s=String(n).padStart(2,"0"),i=String(r).padStart(2,"0"),l=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(a),c=l.charAt(0).toUpperCase()+l.slice(1);return`${s}/${i} - ${c}`},dS=(e,t)=>{const r=n=>{const[a,s,i]=n.slice(0,10).split("-");return`${i}/${s}/${a}`};return`${r(e)} a ${r(t)}`},uS=({name:e,control:t})=>{var r;const{field:n,fieldState:a}=Be({name:e,control:t}),{externalData:s={}}=Ur(),i=n.value??null,l=(r=a.error)==null?void 0:r.message,c=V=>s[`evento.${V}`]??s[V],d=c("dataInicioEvento")??"",u=c("dataFimEvento")??"",m=Number(c("valor")??0),p=Number(c("valorPorDia")??0),f=c("vagasTotal"),v=c("vagasPorDia"),h=c("vagasMasculinas"),x=c("vagasFemininas"),y=f!=null?Number(f):null,b=v!=null?Number(v):null,k=h!=null?Number(h):null,w=x!=null?Number(x):null,{dias:N,eventoMultiDia:S}=j.useMemo(()=>{if(!d||!u)return{dias:[],eventoMultiDia:!1};const V=lS(d,u),M=iS(d,u);return{dias:V,eventoMultiDia:M>1}},[d,u]),A=j.useMemo(()=>k!=null&&k>0&&w!=null&&w>0,[k,w]),C=j.useMemo(()=>k!=null&&w==null?"masculino":w!=null&&k==null?"feminino":null,[k,w]),E=(i==null?void 0:i.tipo)??null,$=(i==null?void 0:i.data)??null,I=(i==null?void 0:i.genero)??null,L=j.useRef(i);L.current=i;const D=j.useRef(n.onChange);D.current=n.onChange,j.useEffect(()=>{var V,M,R;C&&((V=L.current)==null?void 0:V.genero)!==C&&D.current({tipo:((M=L.current)==null?void 0:M.tipo)??null,data:((R=L.current)==null?void 0:R.data)??null,genero:C})},[C]);const z=j.useCallback(V=>{const M={tipo:V,data:null};(A||C)&&(M.genero=I??C??void 0),n.onChange(M)},[n,A,C,I]),H=j.useCallback(V=>{const M={tipo:"por_dia",data:V};(A||C)&&(M.genero=I??C??void 0),n.onChange(M)},[n,A,C,I]),U=j.useCallback(V=>{n.onChange({tipo:E,data:$,genero:V})},[n,E,$]),Z=j.useCallback(V=>E===V,[E]);return o.jsxs("div",{className:"space-y-3",children:[A&&o.jsxs("div",{className:"flex items-center gap-2 px-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Você é:"}),o.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(V=>o.jsx("button",{type:"button",onClick:()=>U(V),className:Y("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))})]}),o.jsxs("button",{type:"button",onClick:()=>z("todos_os_dias"),style:Z("todos_os_dias")?void 0:{borderColor:"var(--t-border)"},className:Y("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("todos_os_dias")?"border-primary bg-primary/5":"hover:border-primary/50"),children:[o.jsx("div",{className:Y("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("todos_os_dias")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(O.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar todos os dias"}),d&&u?o.jsx("p",{className:"text-xs text-muted-foreground",children:dS(d,u)}):o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Datas do evento"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[m>0&&o.jsx("p",{className:Y("font-bold text-sm",Z("todos_os_dias")?"text-primary":"text-foreground"),children:Jd(m)}),y!=null&&y>0&&o.jsxs("p",{className:"text-xs flex items-center justify-end gap-1 text-muted-foreground",children:[o.jsx(O.Users,{className:"w-3 h-3"}),y," vagas disponíveis"]})]})]}),S&&b!=null&&b!==0?o.jsxs("button",{type:"button",onClick:()=>z("por_dia"),style:Z("por_dia")?void 0:{borderColor:"var(--t-border)"},className:Y("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",Z("por_dia")?"border-primary bg-primary/5":"hover:border-primary/50"),children:[o.jsx("div",{className:Y("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",Z("por_dia")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:o.jsx(O.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado abaixo"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[p>0&&o.jsx("p",{className:Y("font-bold text-sm",Z("por_dia")?"text-primary":"text-foreground"),children:Jd(p)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"por dia"})]})]}):!S&&d?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg border border-input bg-muted/30",children:[o.jsx(O.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.'})]}):null,E==="por_dia"&&o.jsxs("div",{className:"pl-2 space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-primary",children:"Selecione o dia:"}),N.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Nenhuma data configurada no evento"}):N.map(V=>o.jsxs("button",{type:"button",onClick:()=>H(V),style:$!==V?{borderColor:"var(--t-border)"}:void 0,className:Y("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",$===V?"border-primary bg-primary/5":"hover:border-primary/50"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:Y("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center transition-colors",$===V?"border-primary bg-primary":""),style:$!==V?{borderColor:"var(--t-border)"}:void 0,children:$===V&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-white"})}),o.jsx("span",{className:"text-sm",children:cS(V)})]}),b!=null&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[b," vagas"]})]},V))]}),l&&o.jsx("p",{className:"text-sm text-destructive",children:l})]})},Qd=.0315,eu=.124,tu=7,ru=12,mS=[{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:Qd,taxaLabel:`Taxa: ${(Qd*100).toFixed(2).replace(".",",")}%`}],pS=[{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é ${tu}x sem juros`,Icon:O.Smartphone,taxa:0,parcelas:tu},{id:"cartao",label:"Cartão de Crédito",description:`Parcelado em até ${ru}x`,Icon:O.CreditCard,taxa:eu,parcelas:ru,taxaLabel:`Taxa: ${(eu*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:O.Banknote,taxa:0}],_a=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,nu=(e,t)=>Math.round(e*(1+t)*100)/100,fS=(e,t)=>Math.round(e/t*100)/100,hS=({name:e,control:t,relatedFieldName:r="tipo_participacao"})=>{var n;const{field:a,fieldState:s}=Be({name:e,control:t}),{externalData:i={},paymentMethodOptions:l}=Ur(),c=a.value??null,d=(n=s.error)==null?void 0:n.message,u=Ln({control:t,name:r}),m=(u==null?void 0:u.tipo)??null,p=k=>i[`evento.${k}`]??i[k],f=Number(p("valor")??0),v=Number(p("valorPorDia")??0),h=m==="por_dia"&&v>0?v:f,x=m==="por_dia"?(l==null?void 0:l.porDia)??mS:(l==null?void 0:l.todosOsDias)??pS,y=m==="por_dia"?(()=>{if(!(u!=null&&u.data))return"Um dia";const k=u.data.split("-");if(k.length===3){const[w,N,S]=k;return`${S}/${N}/${w}`}return u.data})():"Todos os dias",b=k=>{if(k.disabled)return;const w=nu(h,k.taxa),N={metodo:k.id,valorTotal:w};k.parcelas&&(N.parcelas=k.parcelas),a.onChange(N)};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-xl border px-4 py-3",style:{borderColor:"var(--t-border)"},children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:y})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Valor base"}),o.jsx("p",{className:"text-lg font-bold text-primary",children:_a(h)})]})]}),o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border bg-muted/30 px-3 py-2.5",style:{borderColor:"var(--t-border)"},children:[o.jsx(O.Info,{className:"h-4 w-4 mt-0.5 shrink-0 text-muted-foreground"}),o.jsxs("p",{className:"text-xs",children:[o.jsx("span",{className:"font-bold",children:"Importante:"})," Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:x.map(k=>{const{Icon:w}=k,N=(c==null?void 0:c.metodo)===k.id,S=nu(h,k.taxa),A=!!k.parcelas&&k.parcelas>1,C=A?fS(S,k.parcelas):null;return o.jsxs("button",{type:"button",disabled:k.disabled,onClick:()=>b(k),style:N?void 0:{borderColor:"var(--t-border)"},className:Y("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":"hover:border-primary/50",k.disabled&&"opacity-50 cursor-not-allowed"),children:[o.jsx("div",{className:Y("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:o.jsx(w,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:k.label}),o.jsx("p",{className:"text-xs text-muted-foreground",children:k.description}),k.taxaLabel&&o.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["* ",k.taxaLabel]}),k.taxa>0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",_a(S)]})]}),o.jsx("div",{className:"text-right shrink-0",children:A?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[k.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold text-primary",children:_a(C)})]}):o.jsx("p",{className:"text-base font-bold text-primary",children:_a(S)})})]},k.id)})}),d&&o.jsx("p",{className:"text-xs text-destructive",children:d})]})},xS=({name:e,control:t,label:r,termoTexto:n,termoPdfUrl:a,termoPdfUploadId:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),{resolveTermsUploadUrl:d}=Ur(),u=!!c.error,m=(i=c.error)==null?void 0:i.message,[p,f]=j.useState(null),[v,h]=j.useState(!1),[x,y]=j.useState(!1),[b,k]=j.useState(null),[w,N]=j.useState(!1),[S,A]=j.useState(null),C=j.useRef(null);j.useEffect(()=>{if(!s||!d){f(null);return}let D=!1;return h(!0),d(s).then(z=>{D||f(z)}).catch(()=>{D||f(null)}).finally(()=>{D||h(!1)}),()=>{D=!0}},[s,d]);const E=l.value==="accepted",$=p||a||null,I=!!(n||$||s),L=!!$;return j.useEffect(()=>{if(!x||!$)return;let D=!1;return N(!0),A(null),k(null),fetch($).then(z=>{if(!z.ok)throw new Error("fetch failed");return z.blob()}).then(z=>{if(!D){C.current&&URL.revokeObjectURL(C.current);const H=URL.createObjectURL(z);C.current=H,k(H)}}).catch(()=>{D||A("Não foi possível carregar o PDF.")}).finally(()=>{D||N(!1)}),()=>{D=!0}},[x,$]),j.useEffect(()=>()=>{C.current&&URL.revokeObjectURL(C.current)},[]),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:Y("rounded-lg border p-4 space-y-4 transition-colors",u?"border-destructive bg-destructive/5":E?"border-green-500 bg-green-500/5":"border-input"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(O.ScrollText,{className:"h-4 w-4 shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:r||"Termos e condições"})]}),I?o.jsxs(sl,{open:x,onOpenChange:y,children:[o.jsx(kf,{asChild:!0,children:o.jsxs(Te,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:v,children:[v?o.jsx(O.Loader2,{className:"h-3 w-3 animate-spin"}):o.jsx(O.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]})}),o.jsxs(Ao,{className:"max-w-2xl flex flex-col max-h-[90vh]",children:[o.jsx(Do,{children:o.jsxs(Ro,{className:"flex items-center gap-2",children:[o.jsx(O.ScrollText,{className:"h-4 w-4"}),"Termos e condições"]})}),L?o.jsxs("div",{className:"flex-1 min-h-0 space-y-2",children:[w&&o.jsx("div",{className:"w-full h-[62vh] rounded border flex items-center justify-center bg-muted/20",children:o.jsx(O.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"})}),!w&&S&&o.jsxs("div",{className:"w-full h-[62vh] rounded border flex flex-col items-center justify-center gap-2 bg-muted/20",children:[o.jsx(O.AlertCircle,{className:"h-6 w-6 text-muted-foreground"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:S})]}),!w&&b&&o.jsx("iframe",{src:b,className:"w-full h-[62vh] rounded border",title:"Termos e condições"}),o.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:["Prefere abrir fora?"," ",o.jsx("a",{href:$,target:"_blank",rel:"noopener noreferrer",className:"underline text-primary",children:"Abrir em nova aba"})]})]}):o.jsx(Fn,{className:"flex-1 max-h-[62vh] rounded border p-4 bg-muted/20",children:o.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:n})})]})]}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:s&&v?"Carregando PDF...":"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx(rt,{className:"mt-0.5",checked:E,onCheckedChange:D=>l.onChange(D?"accepted":"")}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito ",r?`"${r}"`:"os termos e condições"]}),E&&o.jsx(O.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]}),u&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[o.jsx(O.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),m||"Você precisa aceitar os termos para continuar"]})]})},gS=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),[c,d]=j.useState(!1),u=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{...i,value:i.value??"",type:c?"text":"password",placeholder:r,disabled:n,readOnly:a,className:Y("pr-10",u&&"border-destructive focus-visible:ring-destructive")}),o.jsx("button",{type:"button",tabIndex:-1,onClick:()=>d(m=>!m),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?o.jsx(O.EyeOff,{size:16}):o.jsx(O.Eye,{size:16})})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Tx=({name:e,control:t,label:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),c=!!i.value;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[o.jsx(Li,{checked:c,onCheckedChange:d=>!a&&i.onChange(d),disabled:n||a,onBlur:i.onBlur}),o.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},vS=({name:e,control:t,minValue:r=0,maxValue:n=100,step:a=1,disabled:s,readOnly:i})=>{var l;const{field:c,fieldState:d}=Be({name:e,control:t}),u=c.value??r;return j.useEffect(()=>{(c.value===void 0||c.value===null)&&c.onChange(r)},[]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Eo,{min:r,max:n,step:a,value:[u],onValueChange:m=>!i&&c.onChange(m[0]),disabled:s||i,className:"flex-1"}),o.jsx("span",{className:"text-sm font-medium text-primary min-w-[3rem] text-right tabular-nums",children:u})]}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:r}),o.jsx("span",{children:n})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",children:d.error.message})]})},Ms=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),bS=({name:e,control:t,disabled:r,readOnly:n})=>{var a;const{field:s,fieldState:i}=Be({name:e,control:t}),l=s.value||"#000000",[c,d]=j.useState(l);return j.useEffect(()=>{d(l)},[l]),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("input",{type:"color",value:Ms(l)?l:"#000000",disabled:r||n,onChange:u=>s.onChange(u.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"}),o.jsx(ue,{type:"text",value:c,readOnly:n,disabled:r,onChange:u=>{const m=u.target.value;d(m),Ms(m)&&s.onChange(m.toUpperCase())},onBlur:()=>{Ms(c)||d(l),s.onBlur()},className:Y("flex-1 font-mono uppercase",i.error&&"border-destructive focus-visible:ring-destructive"),maxLength:7,placeholder:"#000000"})]}),((a=i.error)==null?void 0:a.message)&&o.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},yS=({name:e,control:t,options:r,placeholder:n,disabled:a,readOnly:s})=>{var i,l;const{field:c,fieldState:d}=Be({name:e,control:t}),[u,m]=j.useState(""),[p,f]=j.useState(!1),[v,h]=j.useState(-1),x=j.useRef(null),y=j.useRef(null),b=`autocomplete-${e}-listbox`,k=((i=r.find($=>$.valor===c.value))==null?void 0:i.label)??"",w=u.length>0?r.filter($=>$.label.toLowerCase().includes(u.toLowerCase())):r;j.useEffect(()=>{const $=I=>{x.current&&!x.current.contains(I.target)&&(f(!1),m(""),h(-1))};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);const N=()=>{f(!1),m(""),h(-1)};j.useEffect(()=>{if(v<0||!y.current)return;const $=y.current.querySelector(`[id="${b}-option-${v}"]`);$==null||$.scrollIntoView({block:"nearest"})},[v,b]);const S=$=>{$.disabled||(c.onChange($.valor),N())},A=()=>{c.onChange(""),m(""),h(-1)},C=$=>{if(!p){($.key==="ArrowDown"||$.key==="ArrowUp")&&($.preventDefault(),f(!0),h(0));return}switch($.key){case"ArrowDown":$.preventDefault(),h(I=>I<w.length-1?I+1:I);break;case"ArrowUp":$.preventDefault(),h(I=>I>0?I-1:0);break;case"Enter":$.preventDefault(),v>=0&&w[v]&&!w[v].disabled&&S(w[v]);break;case"Escape":$.preventDefault(),N();break;case"Tab":N();break}},E=p&&v>=0?`${b}-option-${v}`:void 0;return o.jsxs("div",{className:"space-y-1",ref:x,children:[o.jsxs("div",{className:"relative",children:[o.jsx(ue,{type:"text",role:"combobox","aria-expanded":p,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":b,"aria-activedescendant":E,value:p?u:k,placeholder:n??"Buscar...",disabled:a,readOnly:s,onChange:$=>{m($.target.value),h(-1),f(!0)},onFocus:()=>!s&&f(!0),onKeyDown:C,className:Y("pr-8",d.error&&"border-destructive focus-visible:ring-destructive"),autoComplete:"off"}),o.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:c.value?o.jsx("button",{type:"button",onClick:A,className:"text-[var(--t-text-muted)] hover:text-[var(--t-text)]",tabIndex:-1,"aria-label":"Limpar seleção",children:o.jsx(O.X,{size:14})}):o.jsx(O.ChevronDown,{size:16,className:"text-muted-foreground pointer-events-none","aria-hidden":"true"})}),p&&!a&&!s&&o.jsx("ul",{role:"listbox",id:b,ref:y,"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:w.length===0?o.jsx("li",{role:"option","aria-selected":!1,className:"px-3 py-2 text-sm text-muted-foreground",children:"Nenhuma opção encontrada"}):w.map(($,I)=>o.jsx("li",{id:`${b}-option-${I}`,role:"option","aria-selected":c.value===$.valor,"aria-disabled":$.disabled,onMouseDown:()=>S($),className:["flex cursor-pointer items-center px-3 py-2 text-sm",$.disabled?"cursor-not-allowed opacity-40":I===v?"bg-accent":"hover:bg-accent",c.value===$.valor?"font-medium text-primary":"text-foreground"].join(" "),children:$.label},$.valor))})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"text-sm text-destructive",role:"alert",children:d.error.message})]})},Ax=({name:e,control:t,placeholder:r,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),c=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(ue,{...i,value:i.value??"",type:"time",placeholder:r,disabled:n,readOnly:a,className:Y(c&&"border-destructive focus-visible:ring-destructive")}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},wS=({name:e,control:t,startLabel:r="Data inicial",endLabel:n="Data final",disabled:a,readOnly:s})=>{var i;const{field:l,fieldState:c}=Be({name:e,control:t}),d=l.value??{},u=(p,f)=>{l.onChange({...d,[p]:f})},m=!!c.error;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{children:r}),o.jsx(ue,{type:"date",value:d.start??"",disabled:a,readOnly:s,onChange:p=>u("start",p.target.value),max:d.end??void 0,className:Y(m&&"border-destructive focus-visible:ring-destructive")})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(le,{children:n}),o.jsx(ue,{type:"date",value:d.end??"",disabled:a,readOnly:s,onChange:p=>u("end",p.target.value),min:d.start??void 0,className:Y(m&&"border-destructive focus-visible:ring-destructive")})]})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},kS=({name:e,control:t,maxRating:r=5,disabled:n,readOnly:a})=>{var s;const{field:i,fieldState:l}=Be({name:e,control:t}),c=i.value??0,d=Array.from({length:r},(u,m)=>m+1);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[d.map(u=>o.jsx("button",{type:"button",disabled:n||a,onClick:()=>i.onChange(u===c?0:u),className:"transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":`${u} estrela${u>1?"s":""}`,children:o.jsx(O.Star,{size:24,className:"transition-colors",fill:u<=c?"var(--color-primary)":"transparent",stroke:u<=c?"var(--color-primary)":"currentColor"})},u)),c>0&&o.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[c,"/",r]})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},jS=({field:e,name:t,control:r,disabled:n,readOnly:a})=>{const s=n||e.isDisabled,i=a||e.isReadOnly;switch(e.tipo){case P.EMAIL:return o.jsx(zt,{name:t,control:r,type:"email",placeholder:e.placeholder,disabled:s,readOnly:i});case P.NUMBER:return o.jsx(zt,{name:t,control:r,type:"number",placeholder:e.placeholder,disabled:s,readOnly:i});case P.PASSWORD:return o.jsx(zt,{name:t,control:r,type:"password",placeholder:e.placeholder,disabled:s,readOnly:i});case P.TELEFONE:return o.jsx(Jr,{name:t,control:r,maskType:"telefone",placeholder:e.placeholder??"(00) 00000-0000",disabled:s,readOnly:i});case P.CPF:return o.jsx(Jr,{name:t,control:r,maskType:"cpf",placeholder:e.placeholder??"000.000.000-00",disabled:s,readOnly:i});case P.CEP:return o.jsx(Jr,{name:t,control:r,maskType:"cep",placeholder:e.placeholder??"00000-000",disabled:s,readOnly:i});case P.TEXTAREA:return o.jsx(Il,{name:t,control:r,placeholder:e.placeholder,disabled:s,readOnly:i});case P.SELECT:return o.jsx(Ol,{name:t,control:r,options:e.opcoes??[],placeholder:e.placeholder,disabled:s,readOnly:i});case P.CHECKBOX:return o.jsx(Fl,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case P.SWITCH:return o.jsx(Tx,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case P.DATE:return o.jsx(ta,{name:t,control:r,disabled:s,readOnly:i});case P.TIME:return o.jsx(Ax,{name:t,control:r,disabled:s,readOnly:i});case P.HIDDEN:return o.jsx(Bl,{name:t,control:r});default:return o.jsx(zt,{name:t,control:r,type:"text",placeholder:e.placeholder,disabled:s,readOnly:i})}},CS=({name:e,control:t,subSchema:r,disabled:n,readOnly:a})=>{if(!r||r.fields.length===0)return null;const s=[...r.fields].sort((i,l)=>i.ordem-l.ordem);return o.jsxs("div",{className:"rounded-xl border border-input bg-muted/30 p-4 space-y-4",children:[r.titulo&&o.jsx("h4",{className:"text-sm font-semibold text-muted-foreground",children:r.titulo}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:s.map(i=>{const l=`${e}.${i.nome}`,c=i.tipo===P.CHECKBOX||i.tipo===P.SWITCH||i.tipo===P.HIDDEN,d=i.tamanho??6;return o.jsxs("div",{className:`col-span-${d}`,children:[!c&&o.jsxs("label",{className:"mb-1 block text-sm font-medium text-foreground",children:[i.label,i.obrigatorio&&o.jsx("span",{className:"text-destructive",children:" *"})]}),o.jsx(jS,{field:i,name:l,control:t,disabled:n,readOnly:a})]},i.id)})})]})},Dx=({field:e,control:t,nameOverride:r})=>{var n,a;const s=r??e.nome,{componentMapper:i}=Ur(),l=i==null?void 0:i[e.tipo];if(l)return o.jsx(l,{name:s,control:t,field:e});const c={name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly};switch(e.tipo){case P.TEXTO:return o.jsx(zt,{...c,type:"text"});case P.EMAIL:return o.jsx(zt,{...c,type:"email"});case P.NUMBER:return o.jsx(zt,{...c,type:"number"});case P.PASSWORD:return o.jsx(gS,{...c});case P.TEXTAREA:return o.jsx(Il,{...c});case P.SELECT:return o.jsx(Ol,{...c,options:e.opcoes??[]});case P.AUTOCOMPLETE:return o.jsx(yS,{...c,options:e.opcoes??[]});case P.SWITCH:return o.jsx(Tx,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case P.SLIDER:return o.jsx(vS,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case P.RATING:return o.jsx(kS,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case P.COLOR:return o.jsx(bS,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case P.TIME:return o.jsx(Ax,{...c});case P.DATE_RANGE:return o.jsx(wS,{name:s,control:t,startLabel:e.dateRangeStartLabel,endLabel:e.dateRangeEndLabel,disabled:e.isDisabled,readOnly:e.isReadOnly});case P.RADIO:return o.jsx(yx,{...c,options:e.opcoes??[]});case P.CHECKBOX:return o.jsx(Fl,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case P.CHECKBOX_GROUP:return o.jsx(bx,{...c,options:e.opcoes??[]});case P.DATE:return o.jsx(ta,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case P.DATETIME:return o.jsx(ta,{name:s,control:t,isDatetime:!0,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case P.FILE:return o.jsx(Sx,{name:s,control:t,disabled:e.isDisabled,fileTypes:(n=e.validacao)==null?void 0:n.fileTypes,maxFileSize:(a=e.validacao)==null?void 0:a.maxFileSize});case P.TELEFONE:return o.jsx(Jr,{...c,maskType:"telefone"});case P.CPF:return o.jsx(Jr,{...c,maskType:"cpf"});case P.CEP:return o.jsx(Ex,{name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly,cepFillMap:e.cepFillMap});case P.HIDDEN:return o.jsx(Bl,{name:s,control:t});case P.PARTICIPATION_TYPE:return o.jsx(uS,{name:s,control:t});case P.PAYMENT_METHOD:return o.jsx(hS,{name:s,control:t,relatedFieldName:e.relatedFieldName});case P.TERMS:return o.jsx(xS,{name:s,control:t,label:e.label,termoTexto:e.termoTexto,termoPdfUrl:e.termoPdfUrl,termoPdfUploadId:e.termoPdfUploadId});case P.FIELD_ARRAY:return o.jsx(sS,{name:s,control:t,subFields:e.subFields,minItems:e.minItems,maxItems:e.maxItems,itemLabel:e.itemLabel,addLabel:e.addLabel});case P.SUB_FORM:return o.jsx(CS,{name:s,control:t,subSchema:e.subSchema,disabled:e.isDisabled,readOnly:e.isReadOnly});default:return o.jsx(zt,{...c,type:"text"})}},NS=({container:e,control:t})=>{var r;const{externalData:n={},fieldResolvers:a}=Ur(),s=e.icone?Pt[e.icone]:void 0,i=n,l=j.useMemo(()=>_l(e,i),[e,JSON.stringify(i)]),c=j.useMemo(()=>[...l.campos].sort((x,y)=>x.ordem-y.ordem),[l.campos]),d=Ln({control:t}),{wrapperClass:u,wrapperStyle:m,headerClass:p,headerStyle:f,tmpl:v}=vx(),h=x=>{if(!Se(x.condicional,d,n))return null;let y=x;if(x.resolvePropsKey&&a!=null&&a[x.resolvePropsKey]){const S=a[x.resolvePropsKey](x,d,n);y={...x,...S}}if(y.opcoesFromVar){const S=n[y.opcoesFromVar];Array.isArray(S)&&(y={...y,opcoes:S.map(A=>typeof A=="string"?{valor:A,label:A}:A&&typeof A=="object"&&"valor"in A&&"label"in A?A:{valor:String(A),label:String(A)})})}const b=y.tamanho??12,k=y.inicioColuna,w=k?`${k} / span ${b}`:`span ${b}`,N=o.jsx(Dx,{field:y,control:t});return y.tipo===P.CHECKBOX||y.tipo===P.HIDDEN||y.tipo===P.SWITCH?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:w},children:N},y.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:w},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[y.label,y.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),N,y.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:y.hint})]},y.id)};return o.jsxs("div",{className:u,style:m,children:[(l.titulo||s)&&o.jsx("div",{className:p,style:f,children:o.jsxs("div",{className:"flex items-center gap-3",children:[s&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(s,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=v.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:l.titulo}),l.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:l.descricao})]})]})}),o.jsx("div",{className:"p-6 grid grid-cols-12 gap-4",children:c.map(h)})]})},SS=({container:e,control:t})=>{var r;const{externalData:n={}}=Ur(),a=e.nome??"__invalid__",s=e.minItems??1,i=e.maxItems,l=e.itemLabel??"Item",c=e.icone?Pt[e.icone]:void 0,d=n,u=j.useMemo(()=>_l(e,d),[e,JSON.stringify(d)]),m=j.useMemo(()=>[...u.campos].sort((C,E)=>C.ordem-E.ordem),[u.campos]),p=j.useCallback(()=>{const C={};for(const E of m)E.initialValue!==void 0?C[E.nome]=typeof E.initialValue=="string"?yt(E.initialValue,d):E.initialValue:E.defaultValue!==void 0&&(C[E.nome]=E.defaultValue);return C},[m,d]),{fields:f,append:v,remove:h}=gx({control:t,name:a});j.useEffect(()=>{if(e.nome&&f.length<s)for(let C=f.length;C<s;C++)v(p())},[s]);const x=Ln({control:t}),y=j.useMemo(()=>{const C=x[a];return Array.isArray(C)?C:[]},[x,a]),{wrapperClass:b,wrapperStyle:k,headerClass:w,headerStyle:N,tmpl:S}=vx();if(!e.nome)return console.error("[RepeatableContainerRenderer] container.nome é obrigatório para containers repetíveis. Container id:",e.id),null;const A=(C,E)=>{const $=y[E]??{};if(!Se(C.condicional,$,n))return null;const I=`${a}.${E}.${C.nome}`,L=C.tamanho??12,D=C.inicioColuna,z=D?`${D} / span ${L}`:`span ${L}`,H=o.jsx(Dx,{field:C,control:t,nameOverride:I});return C.tipo===P.CHECKBOX||C.tipo===P.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:z},children:H},`${C.id}-${E}`):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:z},children:[o.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[C.label,C.obrigatorio&&o.jsx("span",{className:"text-destructive",children:"*"})]}),H,C.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:C.hint})]},`${C.id}-${E}`)};return o.jsxs("div",{className:b,style:k,children:[(u.titulo||c)&&o.jsx("div",{className:w,style:N,children:o.jsxs("div",{className:"flex items-center gap-3",children:[c&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(c,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=S.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:u.titulo}),u.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:u.descricao})]})]})}),o.jsxs("div",{className:"p-6 space-y-4",children:[f.map((C,E)=>o.jsxs("div",{className:"border border-input rounded-lg p-4 bg-muted/30",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 bg-primary text-primary-foreground",children:E+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[l," ",E+1]})]}),f.length>s&&o.jsx("button",{type:"button",onClick:()=>h(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:o.jsx(O.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:m.map($=>A($,E))})]},C.id)),(!i||f.length<i)&&o.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:()=>v(p()),children:[o.jsx(O.Plus,{className:"w-4 h-4"}),"Adicionar ",l.toLowerCase()]}),i&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",i," ",l.toLowerCase(),i>1?"s":""]})]})]})},$S=e=>e.container.repeatable&&e.container.nome?o.jsx(SS,{...e}):o.jsx(NS,{...e}),ES=({step:e,control:t,externalData:r={}})=>{const n=j.useMemo(()=>[...e.containers].sort((s,i)=>s.ordem-i.ordem),[e.containers]),a=Ln({control:t});return o.jsx("div",{className:"grid grid-cols-12 gap-4",children:n.map(s=>{if(s.condicional&&!Se(s.condicional,a,r))return null;const i=s.tamanho??12,l=s.inicioColuna,c=l?`${l} / span ${i}`:`span ${i}`;return o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:c},children:o.jsx($S,{container:s,control:t})},s.id)})})},TS=j.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),AS=TS.Provider,au=({stepIndex:e,totalSteps:t,step:r,defaultValues:n,externalData:a,fieldErrors:s,isSubmitting:i,isUploading:l=!1,submitError:c,validatorMapper:d={},onWarningsChange:u,onValuesChange:m,onSubmit:p,onBack:f})=>{const v=e===t-1,h=j.useMemo(()=>JSON.stringify(a),[a]),x=j.useMemo(()=>EN(r,a,d),[r.id,h]),y=j.useMemo(()=>TN(r,a,d),[r.id,h]),[b,k]=j.useState({}),w=j.useRef(u);w.current=u;const N=a,S=j.useMemo(()=>PN(r,N),[r,h]),A=NN({resolver:x,defaultValues:n,mode:"onTouched"}),{control:C,handleSubmit:E,setError:$,clearErrors:I,setValue:L}=A;j.useEffect(()=>{I();for(const[q,G]of Object.entries(s))$(q,{type:"server",message:G})},[s,$,I]);const D=j.useMemo(()=>r.containers.filter(q=>!q.repeatable).flatMap(q=>q.campos).filter(q=>!!q.condicional),[r.containers]),z=j.useMemo(()=>r.containers.filter(q=>!!q.condicional),[r.containers]),H=j.useMemo(()=>r.containers.filter(q=>!q.repeatable).flatMap(q=>q.campos).filter(q=>{var G;return q.condicional&&((G=q.setValues)==null?void 0:G.length)}),[r.containers]),U=j.useMemo(()=>r.containers.filter(q=>q.repeatable&&!!q.nome).map(q=>({container:q,fields:q.campos.filter(G=>!!G.condicional)})).filter(q=>q.fields.length>0),[r.containers]),Z=j.useRef({}),V=j.useRef(!0),M=Ln({control:C}),R=j.useRef(m);R.current=m,j.useEffect(()=>{var q;(q=R.current)==null||q.call(R,M)},[M]),j.useEffect(()=>{let q=!1;return y(M).then(G=>{var ne;q||(k(G),(ne=w.current)==null||ne.call(w,G))}).catch(G=>{q||console.error("[StepForm] warnComputer error:",G)}),()=>{q=!0}},[M,y]),j.useEffect(()=>{var q;if(!D.length&&!H.length&&!z.length&&!U.length)return;const G=M;for(const W of D)if(!Se(W.condicional,G,a)){if(I(W.nome),W.tipo===P.FIELD_ARRAY){const X=G[W.nome];Array.isArray(X)&&X.forEach((re,K)=>{(W.subFields??[]).forEach(J=>I(`${W.nome}.${K}.${J.nome}`))})}if(W.clearedValue!==void 0){const X=W.clearedValue??"";G[W.nome]!==X&&L(W.nome,X,{shouldValidate:!1})}}for(const W of z)if(!Se(W.condicional,G,a))if(W.repeatable&&W.nome)(Array.isArray(G[W.nome])?G[W.nome]:[]).forEach((X,re)=>{for(const K of W.campos)I(`${W.nome}.${re}.${K.nome}`)});else for(const X of W.campos){I(X.nome);const re=X.clearedValue!==void 0?X.clearedValue:void 0;re!==void 0&&G[X.nome]!==re&&L(X.nome,re,{shouldValidate:!1})}for(const{container:W,fields:X}of U){const re=W.nome,K=Array.isArray(G[re])?G[re]:[];for(let J=0;J<K.length;J++){const ce=K[J];for(const se of X)if(!Se(se.condicional,ce,a)&&(I(`${re}.${J}.${se.nome}`),se.clearedValue!==void 0)){const ye=se.clearedValue??"";ce[se.nome]!==ye&&L(`${re}.${J}.${se.nome}`,ye,{shouldValidate:!1})}}}const ne=V.current;for(const W of H){const X=Se(W.condicional,G,a),re=ne?X:Z.current[W.nome]??!1;if(X&&!re&&(q=W.setValues)!=null&&q.length)for(const K of W.setValues){const J=typeof K.valor=="string"?yt(K.valor,N):K.valor;L(K.campo,J,{shouldValidate:!1})}Z.current[W.nome]=X}V.current=!1},[M,D,H,z,U,a,L,I]);const oe=S.icone?Pt[S.icone]:void 0,ge=j.useMemo(()=>()=>{A.handleSubmit(p)()},[p]);return o.jsx(cN,{...A,children:o.jsx(AS,{value:{submitting:i,warnings:b,requestSubmit:ge},children:o.jsx("form",{onSubmit:E(p),noValidate:!0,onKeyDown:q=>{q.key==="Enter"&&q.target.tagName==="INPUT"&&q.preventDefault()},children:o.jsxs("div",{className:"space-y-6",children:[S.showLabel!==!1&&o.jsxs("div",{className:"text-center space-y-2",children:[oe&&o.jsx("div",{className:"w-12 h-12 mx-auto rounded-xl flex items-center justify-center",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(oe,{className:"w-6 h-6",style:{color:"var(--t-primary)"}})}),o.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:S.titulo}),S.descricao&&o.jsx("p",{className:"text-sm text-muted-foreground",children:S.descricao})]}),o.jsx(ES,{step:S,control:C,externalData:a}),o.jsxs("div",{className:"flex items-center justify-between gap-4 pt-6 pb-2",children:[o.jsxs(Te,{type:"button",variant:"outline",onClick:f,disabled:e===0||l,className:Y(e>0&&!l&&"border-primary/40 text-primary hover:bg-primary/5"),children:[o.jsx(O.ChevronLeft,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),o.jsxs("span",{className:"text-xs font-semibold tabular-nums sm:hidden text-muted-foreground",children:[e+1,"/",t]}),o.jsxs(Te,{type:"submit",disabled:i||l,children:[i?o.jsx(O.Loader2,{className:"w-4 h-4 animate-spin"}):l?o.jsx(O.Loader2,{className:"w-4 h-4 animate-spin"}):v?o.jsx(O.Check,{className:"w-4 h-4"}):o.jsx(O.ChevronRight,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:v?"Finalizar":"Próximo"})]})]}),c&&o.jsx("p",{className:"text-sm text-destructive mt-2 text-center",children:c})]})})})})},oo=e=>{if(e)return Pt[e]},DS=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:s=>s.key==="Enter"&&(r==null?void 0:r(a)),className:Y("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:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(O.Check,{className:"w-4 h-4"}):a+1},n.id))}),RS=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,a)=>{const s=oo(n.icone)??O.CircleDot;return o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(a),onKeyDown:i=>i.key==="Enter"&&(r==null?void 0:r(a)),className:Y("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:a===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:a<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:a<t?o.jsx(O.Check,{className:"w-4 h-4"}):o.jsx(s,{className:"w-4 h-4"})},n.id)})}),PS=({steps:e,currentStep:t,position:r,orientation:n="horizontal",onStepClick:a})=>n==="vertical"?o.jsx("div",{className:"flex flex-col gap-0",children:e.map((s,i)=>{const l=oo(s.icone)??O.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:Y("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#fff",boxShadow:"0 0 10px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#fff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(O.Check,{className:"w-3.5 h-3.5"}):o.jsx(l,{className:"w-3.5 h-3.5"})}),!u&&o.jsx("div",{className:"w-[2px] my-1",style:{height:"24px",background:d?"#22c55e":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]}),o.jsx("span",{className:"text-sm font-medium leading-tight mt-1.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]},s.id)})}):o.jsx("div",{className:"w-full flex items-start",children:e.map((s,i)=>{const l=oo(s.icone)??O.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:Y("flex items-start",!u&&"flex-1"),children:[o.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto",children:[o.jsx("button",{type:"button",onClick:()=>a==null?void 0:a(i),className:Y("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",a&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 12px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#ffffff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(O.Check,{className:"w-4 h-4"}):o.jsx(l,{className:"w-4 h-4"})}),o.jsx("span",{className:"text-[10px] font-medium text-center leading-tight line-clamp-2 px-0.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]}),!u&&o.jsx("div",{className:"flex-1 h-[1.5px] mt-5 mx-1",style:{background:d?"linear-gradient(90deg, var(--t-primary), color-mix(in srgb, var(--t-primary) 40%, transparent))":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]},s.id)})}),Rx=({steps:e,currentStep:t,onStepClick:r,className:n,forceShow:a})=>{const s=na(),{layout:i}=s;if(!i.showStepIndicators||e.length<=1&&!a)return null;const l=i.stepIndicatorVariant??"numbers",c=i.stepIndicatorPosition??"top-center",d=i.stepIndicatorOrientation??"horizontal",u=(t+1)/e.length*100,m=e[t],p=oo(m==null?void 0:m.icone)??O.CircleDot,f=o.jsx("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"color-mix(in srgb, var(--t-primary) 15%, transparent)"},children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${u}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),v=o.jsxs("div",{className:"block sm:hidden space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:o.jsx(p,{className:"w-5 h-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:(m==null?void 0:m.label)??(m==null?void 0:m.id)}),o.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),f]}),h=o.jsxs("div",{className:"hidden sm:block",children:[l==="numbers"&&o.jsx(DS,{steps:e,currentStep:t,onStepClick:r}),l==="icons"&&o.jsx(RS,{steps:e,currentStep:t,onStepClick:r}),l==="icons-labeled"&&o.jsx(PS,{steps:e,currentStep:t,position:c,orientation:d,onStepClick:r})]}),x=i.showProgressBar?o.jsx("div",{className:"hidden sm:block",children:f}):null;return d==="vertical"?o.jsxs("div",{className:Y("flex gap-6 items-start",n),children:[v,o.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[h,x&&o.jsx("div",{className:"flex-1 pt-4",children:x})]})]}):o.jsxs("div",{className:Y("space-y-3",n),children:[v,o.jsxs("div",{className:"hidden sm:block space-y-3",children:[h,x]})]})},_S=(e,t,r)=>{var n;const a={...t},s=r;for(const i of e.containers){for(const l of i.campos)if(a[l.nome]===void 0&&(l.initialValue!==void 0?a[l.nome]=typeof l.initialValue=="string"?yt(l.initialValue,s):l.initialValue:l.defaultValue!==void 0&&(a[l.nome]=l.defaultValue)),l.tipo===P.FIELD_ARRAY&&(n=l.subFields)!=null&&n.length){const c=a[l.nome];Array.isArray(c)&&c.length>0&&(a[l.nome]=c.map(d=>{const u={...d};for(const m of l.subFields)u[m.nome]===void 0&&(m.initialValue!==void 0?u[m.nome]=typeof m.initialValue=="string"?yt(m.initialValue,s):m.initialValue:m.defaultValue!==void 0&&(u[m.nome]=m.defaultValue));return u}))}if(i.repeatable&&i.nome){const l=a[i.nome];Array.isArray(l)&&l.length>0&&(a[i.nome]=l.map(c=>{const d={...c};for(const u of i.campos)d[u.nome]===void 0&&(u.initialValue!==void 0?d[u.nome]=typeof u.initialValue=="string"?yt(u.initialValue,s):u.initialValue:u.defaultValue!==void 0&&(d[u.nome]=u.defaultValue));return d}))}}return a},IS=({schema:e,initialValues:t={},initialStep:r=0,onSubmitStep:n,onComplete:a,template:s,formTitle:i,externalData:l={},fieldErrors:c={},uploadFile:d,deleteUploadedFile:u,cepLookup:m,resolveTermsUploadUrl:p,fieldResolvers:f,validatorMapper:v,componentMapper:h,paymentMethodOptions:x,onValuesChange:y,className:b,StepIndicator:k=Rx})=>{const[w,N]=j.useState(()=>r),[S,A]=j.useState({...t}),[C,E]=j.useState(()=>r),[$,I]=j.useState(!1),[L,D]=j.useState(null),[z,H]=j.useState({}),[U,Z]=j.useState(!1),V=j.useRef(0),M=j.useCallback(()=>{V.current+=1,V.current===1&&j.startTransition(()=>Z(!0))},[]),R=j.useCallback(()=>{V.current=Math.max(0,V.current-1),V.current===0&&j.startTransition(()=>Z(!1))},[]),oe=j.useRef(p);oe.current=p;const ge=j.useCallback(T=>oe.current(T),[]),q=!!p,G=j.useRef(u);G.current=u;const ne=j.useCallback(T=>G.current(T),[]),W=!!u,X=j.useMemo(()=>JSON.stringify(l),[l]),re=j.useMemo(()=>JSON.stringify(e.stepConfig),[e.stepConfig]),K=j.useMemo(()=>{const T=io(s);return e.stepConfig?{...T,layout:{...T.layout,...e.stepConfig}}:T},[s,re]),J=j.useMemo(()=>[...e.steps].sort((T,F)=>T.ordem-F.ordem),[e.steps]),ce=J.length,se=ce>0?J[Math.min(w,ce-1)]:null,ye=j.useMemo(()=>se?_S(se,S,l):{},[se,S,X]),be=j.useMemo(()=>({uploadFile:d,deleteUploadedFile:W?ne:void 0,cepLookup:m,resolveTermsUploadUrl:q?ge:void 0,externalData:l,fieldResolvers:f,validatorMapper:v,fieldWarnings:z,componentMapper:h,paymentMethodOptions:x,onUploadStart:M,onUploadEnd:R}),[d,W,ne,m,ge,q,f,v,z,h,x,M,R,X]),Fe=j.useCallback(async T=>{if(!$){I(!0),D(null);try{const{cleaned:F,fileIdsToDelete:B}=ji(se,T,l);B.length&&u&&await Promise.allSettled(B.map(te=>u(te)));const ie={...S,...F};if(A(ie),n&&await n(w,F),w===ce-1)a&&await a(ie);else{const te=w+1;N(te),E(Q=>Math.max(Q,te))}}catch(F){console.error("[FormRenderer] Submit error:",F);const B=F instanceof Error?F.message:"Ocorreu um erro. Tente novamente.";D(B)}finally{I(!1)}}},[w,S,$,ce,n,a,se,l,u]),Le=j.useCallback(()=>{w>0&&N(T=>T-1)},[w]);if(!se)return o.jsx(vi.Provider,{value:be,children:o.jsx(Yn,{config:K,className:`min-h-dvh ${K.wrapperClass??""} ${b??""}`,renderWrapper:!0,children:o.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 Ve=K.layout.eventTitleStyle??"bar",Ct=(K.layout.stepIndicatorOrientation??"horizontal")==="vertical",Me=ce>=1?o.jsx(k,{steps:J.map(T=>({id:T.id,label:T.titulo,icone:T.icone})),currentStep:w,onStepClick:T=>{!U&&T!==w&&T<=C&&N(T)}}):null;return o.jsx(vi.Provider,{value:be,children:o.jsx(Yn,{config:K,className:`min-h-dvh ${K.wrapperClass??""} ${b??""}`,renderWrapper:!0,children:o.jsxs("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6",children:[i&&Ve==="bar"&&o.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:i}),i&&Ve==="inline"&&o.jsxs("div",{className:"text-center mb-6",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest mb-1",style:{color:"var(--t-text-muted)"},children:"Inscrição"}),o.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:i}),o.jsx("div",{className:"h-0.5 w-12 mx-auto mt-3 rounded-full",style:{background:"var(--t-primary)"}})]}),Ct?o.jsxs("div",{className:"flex gap-6 items-start",children:[o.jsx("div",{className:"hidden sm:block shrink-0 w-44 pt-1",children:Me}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"sm:hidden mb-6",children:Me}),o.jsx(au,{stepIndex:w,totalSteps:ce,step:se,defaultValues:ye,externalData:l,fieldErrors:c,isSubmitting:$,isUploading:U,submitError:L,validatorMapper:v,onWarningsChange:H,onValuesChange:y,onSubmit:Fe,onBack:Le},w)]})]}):o.jsxs(o.Fragment,{children:[Me&&o.jsx("div",{className:"mb-8",children:Me}),o.jsx(au,{stepIndex:w,totalSteps:ce,step:se,defaultValues:ye,externalData:l,fieldErrors:c,isSubmitting:$,isUploading:U,submitError:L,validatorMapper:v,onWarningsChange:H,onValuesChange:y,onSubmit:Fe,onBack:Le},w)]})]})})})},OS=({onFillMock:e,onClear:t})=>o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(ax,{}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(Te,{variant:"outline",size:"sm",onClick:e,children:[o.jsx(O.FlaskConical,{className:"w-3.5 h-3.5 mr-1"}),"Preencher mock"]}),o.jsxs(Te,{variant:"ghost",size:"sm",onClick:t,children:[o.jsx(O.Eraser,{className:"w-3.5 h-3.5 mr-1"}),"Limpar"]})]})]}),FS=({onRestart:e})=>o.jsxs("div",{className:"max-w-4xl mx-auto flex flex-col items-center justify-center py-16 space-y-4",children:[o.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:o.jsx(O.PartyPopper,{className:"w-8 h-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Formulário enviado!"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Este é um preview simulado. Nenhum dado foi enviado."}),o.jsxs(Te,{variant:"outline",onClick:e,children:[o.jsx(O.RotateCcw,{className:"w-4 h-4 mr-1"}),"Recomeçar"]})]}),LS=e=>o.jsx(Rx,{...e,forceShow:!0}),zS=async(e,t,r)=>{for(let n=20;n<=100;n+=20)await new Promise(a=>setTimeout(a,80)),r==null||r(n);return`mock-upload-${Date.now()}`},MS=async e=>({}),ou={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 VS(e){var t,r;const n=e.tipo;if(!(n==="hidden"||n==="terms"||n==="field_array"))return ou[n]!==void 0?ou[n]:(n==="select"||n==="radio"||n==="autocomplete")&&(t=e.opcoes)!=null&&t.length?e.opcoes[0].valor:n==="checkbox_group"&&(r=e.opcoes)!=null&&r.length?[e.opcoes[0].valor]:"Teste"}function BS(e){const t={};for(const r of e.steps)for(const n of r.containers)for(const a of n.campos){const s=VS(a);s!==void 0&&(t[a.nome]=s)}return t}const US=({eventoData:e})=>{const{containers:t,configs:r,previewTemplateId:n,stepConfig:a}=xt(),s=j.useMemo(()=>Cl({containers:t},r,{nome:"Preview",status:ki.RASCUNHO,template:n,stepConfig:a}),[t,r,n,a]),[i,l]=j.useState(0),[c,d]=j.useState({}),[u,m]=j.useState(!1),p=j.useCallback(()=>{d(BS(s)),l(h=>h+1),m(!1)},[s]),f=j.useCallback(()=>{d({}),l(h=>h+1),m(!1)},[]),v=j.useCallback(()=>{d({}),l(h=>h+1),m(!1)},[]);return s.steps.length===0?o.jsx("div",{className:"rounded-lg border border-dashed border-border/40 p-6 text-center text-xs text-muted-foreground/50",children:"Adicione steps, containers e campos para ver o preview ao vivo"}):u?o.jsx(FS,{onRestart:v}):o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"px-1",children:o.jsx(OS,{onFillMock:p,onClear:f})}),o.jsx(IS,{schema:s,initialValues:c,template:n,externalData:e,uploadFile:zS,cepLookup:MS,onComplete:async()=>m(!0),StepIndicator:LS},i)]})},Px=({id:e,currentTamanho:t,inicioColuna:r,onResize:n,pushSnapshot:a})=>{const s=j.useRef(null),[i,l]=j.useState(!1),[c,d]=j.useState(null),u=j.useRef(null);j.useEffect(()=>()=>{var p;(p=u.current)==null||p.call(u)},[]);const m=j.useCallback(p=>{p.preventDefault(),p.stopPropagation(),a==null||a();const f=s.current;if(!f)return;const v=f.parentElement;if(!v)return;const h=v.getBoundingClientRect().width,x=f.getBoundingClientRect().width,y=p.clientX,b=r?13-r:12;l(!0);const k=N=>{const S=N.clientX-y,A=(x+S)/h,C=Math.max(1,Math.min(b,Math.round(A*12)));d(C),n(C)},w=()=>{l(!1),d(null),u.current=null,window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",w)};u.current=()=>{l(!1),d(null),window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",w)},window.addEventListener("mousemove",k),window.addEventListener("mouseup",w)},[r,n,a]);return{resizeRef:s,resizing:i,resizePreview:c,handleResizeStart:m}},HS=({id:e,elementRef:t,onPositionApply:r,setPositionDrag:n,setSelected:a,pushSnapshot:s})=>{const i=j.useRef(null);return j.useEffect(()=>()=>{var l;(l=i.current)==null||l.call(i)},[]),{handlePositionMouseDown:j.useCallback(l=>{l.preventDefault(),l.stopPropagation(),s==null||s(),a(e);const c=t.current;if(!c)return;const d=c.parentElement;if(!d)return;const u=d.getBoundingClientRect(),m=u.width/12,p=c.getBoundingClientRect(),f=Math.max(1,Math.round(p.width/m)),v=p.left-u.left,h=l.clientX-p.left,x=w=>{const N=w-u.left-h,S=Math.round(N/m)+1;return Math.max(1,Math.min(13-f,S))},y=Math.max(1,Math.min(12,Math.round(v/m)+1));n({itemId:e,ghostStart:y,ghostSpan:f,cursorX:l.clientX,cursorY:l.clientY});const b=w=>{n({itemId:e,ghostStart:x(w.clientX),ghostSpan:f,cursorX:w.clientX,cursorY:w.clientY})},k=w=>{r(x(w.clientX)),n(null),i.current=null,window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",k)};i.current=()=>{n(null),window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",k)},window.addEventListener("mousemove",b),window.addEventListener("mouseup",k)},[e,t,r,n,a,s])}},xa=({id:e,container:t})=>{const{attributes:r,listeners:n,setNodeRef:a,transform:s,transition:i,isDragging:l}=Kt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{selectedId:c,setSelected:d,getConfig:u,updateConfig:m,removeItem:p,setPositionDrag:f,positionDrag:v,pushSnapshot:h}=xt(),x=u(e),y=Rh(e),b=(y==null?void 0:y.icon)||O.Type,k=c===e,w=x.tamanho||6,N=(v==null?void 0:v.itemId)===e,[S,A]=j.useState(!1),C="var(--t-primary, hsl(var(--primary)))",E=k?C:S?`color-mix(in srgb, ${C} 60%, transparent)`:`color-mix(in srgb, ${C} 25%, transparent)`,$=k?`0 0 0 2px color-mix(in srgb, ${C} 30%, transparent)`:void 0,{resizeRef:I,resizing:L,resizePreview:D,handleResizeStart:z}=Px({id:e,currentTamanho:w,inicioColuna:x.inicioColuna,onResize:U=>m(e,{tamanho:U}),pushSnapshot:h}),{handlePositionMouseDown:H}=HS({id:e,elementRef:I,onPositionApply:U=>m(e,{inicioColuna:U}),setPositionDrag:f,setSelected:d,pushSnapshot:h});return o.jsxs("div",{ref:U=>{a(U),I.current=U},onClick:U=>{U.stopPropagation(),d(e)},"data-field-id":e,onMouseEnter:()=>A(!0),onMouseLeave:()=>A(!1),className:Ut("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",L&&"ring-2 ring-blue-400/50",N&&"opacity-0 pointer-events-none"),style:{gridColumn:x.inicioColuna?`${x.inicioColuna} / span ${w}`:`span ${w}`,transform:ra.CSS.Transform.toString(s),transition:i,opacity:l?0:1,borderColor:E,boxShadow:$},children:[o.jsx("div",{onMouseDown:H,onClick:U=>U.stopPropagation(),className:"cursor-ew-resize shrink-0 p-0.5 rounded hover:bg-primary/20 transition-colors",title:"Arrastar para mudar coluna",children:o.jsx(O.ArrowLeftRight,{className:"h-3 w-3 text-primary/60"})}),o.jsx("div",{...n,...r,className:"cursor-grab shrink-0",onClick:U=>U.stopPropagation(),children:o.jsx(O.GripVertical,{className:"h-3 w-3 text-primary"})}),o.jsx(b,{className:"h-3.5 w-3.5 text-primary shrink-0"}),o.jsx("span",{className:"font-medium truncate flex-1",children:x.label}),x.condition&&o.jsx(O.Zap,{className:"h-3 w-3 text-amber-500 shrink-0"}),x.required&&o.jsx("span",{className:"text-destructive font-bold",children:"*"}),o.jsxs("span",{className:"text-[9px] text-muted-foreground shrink-0",children:[D??w,"/12"]}),o.jsx("button",{onClick:U=>{U.stopPropagation(),p(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:S?1:0},children:o.jsx(O.Trash2,{className:"h-3 w-3 text-destructive"})}),o.jsx("div",{className:"absolute left-2 -bottom-0.5 font-mono truncate max-w-[90%] pointer-events-none text-[8px] text-muted-foreground/30",children:e}),o.jsx("div",{"data-resize":!0,onMouseDown:z,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-primary/20 transition-colors flex items-center justify-center",children:o.jsx(O.GripHorizontal,{className:"h-3 w-3 text-primary/40 rotate-90"})})]})},WS=({id:e,container:t})=>{var r;const{attributes:n,listeners:a,setNodeRef:s,transform:i,transition:l,isDragging:c}=Kt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{setNodeRef:d,isOver:u}=Xt.useDroppable({id:`zone-${e}`}),{selectedId:m,setSelected:p,getConfig:f,removeItem:v,moveItem:h,containers:x}=xt(),y=f(e),b=(((r=x[e])==null?void 0:r.children)??[]).filter(N=>qe(N)==="field"),k=m===e,w=y.tamanho||12;return o.jsxs("div",{ref:s,onClick:N=>{N.stopPropagation(),p(e)},className:Ut("group/fa relative rounded-lg border overflow-hidden transition-all",c&&"opacity-0 pointer-events-none",k?"border-amber-500 ring-2 ring-amber-500/20 shadow-lg":"border-amber-500/30 hover:border-amber-500/55"),style:{gridColumn:y.inicioColuna?`${y.inicioColuna} / span ${w}`:`span ${w}`,transform:ra.CSS.Transform.toString(i),transition:l},children:[o.jsxs("div",{className:Ut("flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",k?"bg-amber-500/15 border-amber-500/30":"bg-amber-500/10 border-amber-500/20"),children:[o.jsx("div",{...a,...n,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-amber-500/20 transition-colors",onClick:N=>N.stopPropagation(),children:o.jsx(O.GripVertical,{className:"h-3.5 w-3.5 text-amber-500"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:N=>{N.stopPropagation(),h(e,"up")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(O.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})}),o.jsx("button",{onClick:N=>{N.stopPropagation(),h(e,"down")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(O.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})})]}),o.jsx(O.List,{className:"h-3.5 w-3.5 text-amber-500 shrink-0"}),o.jsx("span",{className:"text-xs font-semibold truncate flex-1 text-amber-700 dark:text-amber-300",children:y.label}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-amber-500/10 px-1.5 rounded",children:[y.itemLabel||"Item"," · ",b.length," campo",b.length!==1?"s":""]}),o.jsx("button",{onClick:N=>{N.stopPropagation(),v(e)},className:"opacity-0 group-hover/fa:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",children:o.jsx(O.Trash2,{className:"h-3 w-3 text-destructive"})})]}),o.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),o.jsxs("div",{ref:d,className:Ut("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",u?"bg-amber-500/10 ring-2 ring-inset ring-amber-500/40":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[b.length===0&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),o.jsx(Kt.SortableContext,{items:b,strategy:Kt.rectSortingStrategy,children:b.map(N=>o.jsx(xa,{id:N,container:e},N))})]})]})},su=5,qS=({id:e,elementRef:t,tamanho:r,inicioColuna:n,onPositionApply:a,setPositionDrag:s,setSelected:i,reorderStrategy:l})=>{const c=j.useRef({inicioColuna:n,tamanho:r});c.current={inicioColuna:n,tamanho:r};const d=j.useRef(null);return j.useEffect(()=>()=>{var u;(u=d.current)==null||u.call(d)},[]),{handleGripMouseDown:j.useCallback(u=>{u.preventDefault(),u.stopPropagation(),i(e);const m=u.clientX,p=u.clientY;let f=!1;const v=()=>{d.current=null,window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",x)},h=k=>{const w=Math.abs(k.clientX-m),N=Math.abs(k.clientY-p);w<su&&N<su||(f=!0,v(),w>=N?y(k):b(k))},x=()=>{f||v()};window.addEventListener("mousemove",h),window.addEventListener("mouseup",x),d.current=v;const y=k=>{const w=t.current;if(!w)return;const N=w.parentElement;if(!N)return;const S=N.getBoundingClientRect(),A=S.width/12,{tamanho:C}=c.current,E=w.getBoundingClientRect(),$=E.left-S.left,I=Math.max(1,Math.min(12,Math.round($/A)+1)),L=E.left;s({itemId:e,ghostStart:I,ghostSpan:C,cursorX:k.clientX,cursorY:k.clientY});const D=U=>{const Z=U-L,V=Math.round(Z/A)+1;return Math.max(1,Math.min(13-C,V))};s({itemId:e,ghostStart:D(k.clientX),ghostSpan:C,cursorX:k.clientX,cursorY:k.clientY});const z=U=>{s({itemId:e,ghostStart:D(U.clientX),ghostSpan:C,cursorX:U.clientX,cursorY:U.clientY})},H=U=>{a(D(U.clientX)),s(null),d.current=null,window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",H)};window.addEventListener("mousemove",z),window.addEventListener("mouseup",H),d.current=()=>{s(null),window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",H)}},b=k=>{const w=l,N=t.current;if(!N)return;const S=N.parentElement;if(!S)return;const A=w.dataAttribute||"data-container-id";w.pushSnapshot(),w.setReorderDrag({draggingId:e});let C=k.clientY;const E=I=>{const L=Array.from(S.children).filter(D=>D!==N&&D.getAttribute(A));for(const D of L){const z=D.getBoundingClientRect(),H=z.top+z.height/2;if(I.clientY<H&&I.clientY>z.top&&I.clientY<C){w.moveItemNoSnapshot(e,"up"),C=I.clientY;break}else if(I.clientY>H&&I.clientY<z.bottom&&I.clientY>C){w.moveItemNoSnapshot(e,"down"),C=I.clientY;break}}},$=()=>{w.setReorderDrag(null),d.current=null,window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",$)};window.addEventListener("mousemove",E),window.addEventListener("mouseup",$),d.current=()=>{w.setReorderDrag(null),window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",$)}}},[e,t,a,s,i,l])}},Ul=({showGuides:e,positionDrag:t})=>!e&&!t?null:o.jsxs(o.Fragment,{children:[e&&o.jsx("div",{className:"absolute inset-0 pointer-events-none z-10",style:{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",padding:"inherit",gap:"inherit"},children:Array.from({length:12},(r,n)=>o.jsx("div",{className:"border border-dashed border-muted-foreground/20 rounded-sm flex items-end justify-center pb-1",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/40 font-mono",children:n+1})},n))}),t&&o.jsx("div",{className:"absolute pointer-events-none z-20 rounded-lg border-2 border-dashed border-destructive/60 bg-destructive/10",style:{top:"12px",bottom:"12px",left:`calc(${(t.ghostStart-1)/12*100}% + 12px)`,width:`calc(${t.ghostSpan/12*100}% - 8px)`,transition:"left 0.1s ease-out, width 0.1s ease-out"},children:o.jsxs("div",{className:"absolute -top-5 left-1/2 -translate-x-1/2 bg-destructive text-destructive-foreground text-[10px] font-bold px-2 py-0.5 rounded whitespace-nowrap",children:[t.ghostStart," →"," ",t.ghostStart+t.ghostSpan-1]})})]}),Hl=({id:e,container:t})=>{var r;const{setNodeRef:n,isOver:a}=Xt.useDroppable({id:`zone-${e}`}),{selectedId:s,setSelected:i,getConfig:l,updateConfig:c,removeItem:d,moveItem:u,moveItemNoSnapshot:m,setPositionDrag:p,positionDrag:f,reorderDrag:v,setReorderDrag:h,pushSnapshot:x,containers:y}=xt(),b=l(e),k=((r=y[e])==null?void 0:r.children)??[],w=k.filter(G=>qe(G)==="field"),N=s===e,S=b.tamanho||12,A=(f==null?void 0:f.itemId)===e,C=(v==null?void 0:v.draggingId)===e,E=f&&k.includes(f.itemId),$=s&&k.includes(s)&&qe(s)==="field",[I,L]=j.useState(!1),D="var(--t-primary, hsl(var(--primary)))",z=N?D:I?"rgba(59,130,246,0.55)":"rgba(59,130,246,0.3)",H=N?`color-mix(in srgb, ${D} 15%, transparent)`:I?"rgba(59,130,246,0.12)":"rgba(59,130,246,0.07)",U=N?`color-mix(in srgb, ${D} 30%, transparent)`:I?"rgba(59,130,246,0.28)":"rgba(59,130,246,0.18)",Z=N?`0 0 0 3px color-mix(in srgb, ${D} 20%, transparent)`:I?"0 0 0 2px rgba(59,130,246,0.25)":void 0,{resizeRef:V,resizing:M,resizePreview:R,handleResizeStart:oe}=Px({id:e,currentTamanho:S,inicioColuna:b.inicioColuna,onResize:G=>c(e,{tamanho:G}),pushSnapshot:x}),ge=j.useMemo(()=>({kind:"custom",moveItemNoSnapshot:m,pushSnapshot:x,setReorderDrag:h,dataAttribute:"data-container-id"}),[m,x,h]),{handleGripMouseDown:q}=qS({id:e,elementRef:V,tamanho:S,inicioColuna:b.inicioColuna||1,onPositionApply:G=>c(e,{inicioColuna:G}),setPositionDrag:p,setSelected:i,reorderStrategy:ge});return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:G=>{V.current=G},onClick:G=>{G.stopPropagation(),i(e)},onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),className:Ut("relative rounded-lg border overflow-hidden transition-all",M&&"ring-2 ring-blue-400/50",A&&"opacity-0 pointer-events-none",C&&"opacity-50"),"data-container-id":e,style:{gridColumn:b.inicioColuna?`${b.inicioColuna} / span ${S}`:`span ${S}`,minWidth:"80px",borderColor:z,boxShadow:Z},children:[o.jsxs("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",style:{backgroundColor:H,borderColor:U},children:[o.jsx("div",{"data-grip":!0,onMouseDown:q,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-primary/20 transition-colors",children:o.jsx(O.GripVertical,{className:"h-3.5 w-3.5 text-blue-500"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:G=>{G.stopPropagation(),u(e,"up")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(O.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})}),o.jsx("button",{onClick:G=>{G.stopPropagation(),u(e,"down")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(O.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})})]}),o.jsx(O.BoxSelect,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"}),o.jsx("span",{className:Ut("text-xs font-semibold truncate flex-1",b.showLabel===!1?"text-blue-500/50 italic":"text-blue-700 dark:text-blue-300"),children:b.label}),b.showAsCard&&o.jsx(O.SquareStack,{className:"h-3 w-3 text-blue-400 shrink-0"}),b.showLabel===!1&&o.jsx(O.EyeOff,{className:"h-3 w-3 text-muted-foreground/50 shrink-0"}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-blue-500/10 px-1.5 rounded",children:[R??S,"/12"]}),o.jsx("button",{onClick:G=>{G.stopPropagation(),d(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:I?1:0},children:o.jsx(O.Trash2,{className:"h-3 w-3 text-destructive"})})]}),o.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),o.jsxs("div",{ref:n,className:Ut("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",a?"bg-primary/15 ring-2 ring-inset ring-primary/50":(E||$)&&"bg-muted/30"),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[o.jsx(Ul,{showGuides:!!E||!!$,positionDrag:E?f:null}),k.length===0&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),o.jsx(Kt.SortableContext,{items:w,strategy:Kt.rectSortingStrategy,children:k.filter(G=>qe(G)==="field").map(G=>l(G).fieldType==="field_array"?o.jsx(WS,{id:G,container:e},G):o.jsx(xa,{id:G,container:e},G))})]}),o.jsx("div",{onMouseDown:oe,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-blue-500/20 transition-colors flex items-center justify-center",children:o.jsx(O.GripHorizontal,{className:"h-3 w-3 text-blue-500/40 rotate-90"})})]}),A&&f&&yi.createPortal(o.jsxs("div",{style:{position:"fixed",left:f.cursorX+14,top:f.cursorY-18,zIndex:9999,pointerEvents:"none"},className:"flex items-center gap-1 bg-foreground text-background text-[10px] font-mono px-2 py-0.5 rounded shadow-xl border border-border/20",children:[o.jsx(O.BoxSelect,{className:"h-2.5 w-2.5"}),"col ",f.ghostStart,"–",f.ghostStart+f.ghostSpan-1]}),document.body)," "]})},_x=({id:e,container:t,index:r})=>{var n;const{attributes:a,listeners:s,setNodeRef:i,transform:l,transition:c,isDragging:d}=Kt.useSortable({id:e,data:{isCanvasItem:!0,type:"step",id:e}}),{setNodeRef:u,isOver:m}=Xt.useDroppable({id:`zone-${e}`}),{selectedId:p,setSelected:f,getConfig:v,removeItem:h,containers:x,positionDrag:y}=xt(),b=v(e),k=((n=x[e])==null?void 0:n.children)??[],w=p===e,N=y&&k.includes(y.itemId),[S,A]=j.useState(!1),C="var(--t-primary, hsl(var(--primary)))",E=w?C:S?`color-mix(in srgb, ${C} 60%, transparent)`:`color-mix(in srgb, ${C} 25%, transparent)`,$=w?`color-mix(in srgb, ${C} 14%, transparent)`:S?`color-mix(in srgb, ${C} 10%, transparent)`:`color-mix(in srgb, ${C} 6%, transparent)`,I=w?`color-mix(in srgb, ${C} 28%, transparent)`:`color-mix(in srgb, ${C} 15%, transparent)`,L=w?`0 0 0 3px color-mix(in srgb, ${C} 20%, transparent)`:void 0,D={transform:ra.CSS.Transform.toString(l),transition:c,opacity:d?0:1};return o.jsxs("div",{ref:i,style:{...D,borderWidth:"2px",borderStyle:"solid",borderColor:E,boxShadow:L},onMouseEnter:()=>A(!0),onMouseLeave:()=>A(!1),onClick:z=>{z.stopPropagation(),f(e)},className:"group/step rounded-xl overflow-hidden transition-all",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2",style:{backgroundColor:$,borderColor:I},children:[o.jsx("div",{...s,...a,className:"cursor-grab shrink-0",onClick:z=>z.stopPropagation(),children:o.jsx(O.GripVertical,{className:"h-3.5 w-3.5 text-primary"})}),o.jsx(O.Layers,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{className:"text-sm font-bold truncate flex-1 text-primary",children:["Step ",r+1," — ",b.label]}),b.description&&o.jsx("span",{className:"text-[10px] text-muted-foreground truncate hidden md:block",children:b.description}),o.jsx("button",{onClick:z=>{z.stopPropagation(),h(e)},className:"transition-opacity shrink-0 p-1 rounded hover:bg-destructive/10",style:{opacity:S?1:0},children:o.jsx(O.Trash2,{className:"h-3.5 w-3.5 text-destructive"})})]}),o.jsxs("div",{ref:u,className:Ut("relative p-3 min-h-[80px] gap-2 items-start transition-all duration-150",m?"bg-blue-500/20 ring-2 ring-inset ring-blue-400/70 shadow-[inset_0_0_0_2px_theme(colors.blue.400/50%)]":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content",backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.15) 1px, transparent 1px)",backgroundSize:"16px 16px"},children:[o.jsx(Ul,{showGuides:!!N,positionDrag:N?y:null}),k.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground/50 text-center py-6 italic w-full",style:{gridColumn:"span 12"},children:"Arraste containers aqui"}),k.map(z=>qe(z)==="container"?o.jsx(Hl,{id:z,container:e},z):o.jsx(xa,{id:z,container:e},z))]})]})},GS=()=>{var e;const{containers:t,setSelected:r}=xt(),n=((e=t.root)==null?void 0:e.children)??[],a=n.filter(l=>qe(l)==="step"),{setNodeRef:s,isOver:i}=Xt.useDroppable({id:"root"});return o.jsxs("div",{ref:s,onClick:()=>r(null),className:`min-h-[500px] rounded-xl border p-4 space-y-4 transition-all duration-150 ${i?"bg-primary/10 border-primary/60 ring-2 ring-primary/30 shadow-[0_0_0_4px_theme(colors.primary/10%)]":"border-border/40"}`,style:{backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.12) 1px, transparent 1px)",backgroundSize:"20px 20px",backgroundColor:i?void 0:"hsl(var(--muted) / 0.3)"},children:[n.length===0&&o.jsx("div",{className:"flex items-center justify-center h-[400px]",children:o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx(O.Layers,{className:"h-10 w-10 text-muted-foreground/30 mx-auto"}),o.jsxs("p",{className:"text-sm text-muted-foreground/50",children:["Arraste ",o.jsx("strong",{children:"Steps"})," da paleta para cá"]})]})}),o.jsx(Kt.SortableContext,{items:a,strategy:Kt.verticalListSortingStrategy,children:n.map((l,c)=>{const d=qe(l);return d==="step"?o.jsx(_x,{id:l,container:"root",index:c},l):d==="container"?o.jsx(Hl,{id:l,container:"root"},l):o.jsx(xa,{id:l,container:"root"},l)})})]})},XS={personal:"Pessoal",address:"Endereço",health:"Saúde",event:"Evento",payment:"Pagamento",emergency:"Emergência"},ZS={texto:"Texto",selecao:"Seleção",range:"Numérico / Visual",data:"Data e Hora",contato:"Contato / Endereço",outros:"Arquivo / Outros"},KS=()=>{const e=Ir.reduce((t,r)=>{const n=r.group??"outros";return t[n]||(t[n]=[]),t[n].push(r),t},{});return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Estrutura"}),kl.map(t=>o.jsx(iu,{component:t.component,label:t.label,icon:t.icon,color:t.color},t.component))]}),Object.entries(e).map(([t,r])=>o.jsx(Vs,{label:ZS[t]??t,children:r.map(n=>o.jsx(iu,{component:n.component,label:n.label,icon:n.icon,color:"border-border"},n.component))},t)),o.jsx(Vs,{label:"Blocos pré-configurados",defaultOpen:!1,children:lo.map(t=>o.jsx(YS,{block:t},t.id))}),o.jsx(Vs,{label:"Blocos de steps",defaultOpen:!1,children:Si.map(t=>o.jsx(JS,{block:t},t.id))})]})},Vs=({label:e,children:t,defaultOpen:r=!0})=>{const[n,a]=j.useState(r);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("button",{type:"button",onClick:()=>a(s=>!s),className:"flex w-full items-center justify-between text-xs font-semibold text-muted-foreground uppercase tracking-wide hover:text-foreground transition-colors",children:[e,o.jsx(O.ChevronDown,{className:`h-3.5 w-3.5 transition-transform ${n?"":"-rotate-90"}`})]}),n&&o.jsx("div",{className:"space-y-1.5",children:t})]})},iu=({component:e,label:t,icon:r,color:n})=>{const{attributes:a,listeners:s,setNodeRef:i,transform:l,isDragging:c}=Xt.useDraggable({id:`palette-${e}`,data:{isPaletteItem:!0,componentType:e}});return o.jsxs("div",{ref:i,...s,...a,className:`cursor-grab flex items-center gap-2 rounded-lg border px-3 py-2 select-none hover:bg-accent transition-colors ${n} ${c?"opacity-50":""}`,style:{transform:c?void 0:ra.CSS.Translate.toString(l)},children:[o.jsx(O.GripVertical,{className:"h-4 w-4 text-muted-foreground"}),o.jsx(r,{className:"h-4 w-4"}),o.jsx("span",{className:"text-sm font-medium",children:t})]})},YS=({block:e})=>{const{attributes:t,listeners:r,setNodeRef:n,transform:a,isDragging:s}=Xt.useDraggable({id:`preset-${e.id}`,data:{isPalettePreset:!0,presetId:e.id}}),i=e.icon?Pt[e.icon]:void 0,l=XS[e.category]??e.category;return o.jsxs("div",{ref:n,...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:ra.CSS.Translate.toString(a)},title:e.description,children:[o.jsx(O.GripVertical,{className:"h-4 w-4 text-muted-foreground shrink-0"}),i?o.jsx(i,{className:"h-4 w-4 text-primary shrink-0"}):o.jsx(Pt.Blocks,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:l})]})]})},JS=({block:e})=>{const{addPresetStepBlock:t}=xt(),r=e.icon?Pt[e.icon]:void 0;return o.jsxs("button",{type:"button",onClick:()=>t(e),className:"w-full flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 cursor-pointer select-none hover:bg-amber-500/15 transition-colors text-left",title:e.description,children:[r?o.jsx(r,{className:"h-4 w-4 text-amber-400 shrink-0"}):o.jsx(Pt.Layers,{className:"h-4 w-4 text-amber-400 shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.steps.length," steps"]})]}),o.jsxs("span",{className:"text-[10px] text-amber-400 border border-amber-500/30 rounded px-1.5 py-0.5 shrink-0",children:["+",e.steps.length," steps"]})]})},QS=[...kl,...Ir],Ix=({data:e})=>{const{getConfig:t}=xt();if(!e)return null;const r=e;if(r.isPalettePreset){const n=Ni(r.presetId);return o.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[o.jsx(Pt.Blocks,{className:"h-3.5 w-3.5 shrink-0"}),(n==null?void 0:n.name)??"Bloco"]})}if(r.isPaletteItem){const n=QS.find(s=>s.component===r.componentType),a=n==null?void 0:n.icon;return o.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[a&&o.jsx(a,{className:"h-3.5 w-3.5 shrink-0"}),(n==null?void 0:n.label)??r.componentType]})}if(r.isCanvasItem){const{type:n,id:a}=r,s=t(a),i={step:"border-primary/80 bg-primary text-primary-foreground",container:"border-blue-600 bg-blue-600 text-white",field:"border-primary/80 bg-primary text-primary-foreground"},l={step:"Step",container:"Container",field:"Campo"};return o.jsxs("div",{className:Ut("flex items-center gap-2 rounded-full px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none min-w-[100px] max-w-[200px]",i[n]??"border-border bg-card"),children:[o.jsx(O.GripVertical,{className:"h-3 w-3 opacity-60 shrink-0"}),o.jsxs("span",{className:"opacity-70 shrink-0",children:[l[n]??n,":"]}),o.jsx("span",{className:"truncate",children:s.label||a})]})}return null},Ox=({schema:e,children:t,uploadTermsPdf:r,deleteTermsPdf:n})=>{var a;const s=j.useMemo(()=>{var i;return(i=e==null?void 0:e.steps)!=null&&i.length?Ih(e):null},[e]);return o.jsx(D1,{children:o.jsx(zh,{initialConfigs:s==null?void 0:s.configs,initialContainers:(a=s==null?void 0:s.dndState)==null?void 0:a.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:n,children:t})})},Fx=({children:e,onError:t})=>{const{containers:r,addItem:n,addPresetBlock:a,moveCanvasItem:s,reorderInContainer:i}=xt(),l=Xt.useSensors(Xt.useSensor(Xt.PointerSensor,{activationConstraint:{distance:5}})),[c,d]=j.useState(null);return o.jsxs(Xt.DndContext,{sensors:l,onDragStart:u=>{d({data:u.active.data.current})},onDragEnd:u=>{var m,p,f,v,h;d(null);const{active:x,over:y}=u;if(!y)return;const b=x.data.current,k=String(y.id);if(b!=null&&b.isPalettePreset){const{presetId:w}=b,N=Ni(w);if(!N)return;if(k.startsWith("zone-")){const S=k.slice(5);a(N,S)}else k==="root"&&(t==null||t("Arraste o bloco sobre um step existente."));return}if(b!=null&&b.isPaletteItem){const{componentType:w}=b;k==="root"?n(w,"root"):k.startsWith("zone-")&&n(w,k.slice(5));return}if(b!=null&&b.isCanvasItem){const{type:w,id:N}=b;if(w==="step"){const S=((m=r.root)==null?void 0:m.children)??[],A=S.indexOf(N),C=S.indexOf(k);A!==-1&&C!==-1&&A!==C&&i("root",Kt.arrayMove(S,A,C));return}if(w==="field"){const S=b.fromContainer;let A=S,C=null;if(k.startsWith("zone-"))A=k.slice(5);else{const E=Nl(k,r);E&&(A=E,C=k)}if(A===S&&C){const E=((p=r[S])==null?void 0:p.children)??[],$=E.indexOf(N),I=E.indexOf(C);$!==-1&&I!==-1&&$!==I&&i(S,Kt.arrayMove(E,$,I))}else if(A!==S){const E=C?(((f=r[A])==null?void 0:f.children)??[]).indexOf(C):-1;s(N,S,A,E>=0?E:((h=(v=r[A])==null?void 0:v.children)==null?void 0:h.length)??0)}}}},children:[e,o.jsx(Xt.DragOverlay,{dropAnimation:null,children:c?o.jsx(Ix,{data:c.data}):null})]})},e$=({schema:e,children:t,onError:r,uploadTermsPdf:n,deleteTermsPdf:a})=>o.jsx(Ox,{schema:e,uploadTermsPdf:n,deleteTermsPdf:a,children:o.jsx(Fx,{onError:r,children:t})});exports.BuilderDndContext=Fx;exports.BuilderProvider=zh;exports.BuilderShell=e$;exports.BuilderWrapper=Ox;exports.CEP_REGEX=mu;exports.CPF_REGEX=du;exports.Canvas=GS;exports.ConfigPanel=oN;exports.ContainerRenderer=$h;exports.DFCepField=wl;exports.DFCheckbox=Ho;exports.DFCheckboxGroup=fl;exports.DFDateField=Tn;exports.DFFieldArray=vh;exports.DFFileUpload=yl;exports.DFHidden=qo;exports.DFMaskedInput=_r;exports.DFParticipationType=bh;exports.DFPaymentMethod=kh;exports.DFRadioGroup=hl;exports.DFSelect=Uo;exports.DFTerms=jh;exports.DFTextField=Tt;exports.DFTextarea=Bo;exports.DefaultStepIndicator=Dh;exports.DragGhost=Ix;exports.DroppedContainer=Hl;exports.DroppedField=xa;exports.DroppedStep=_x;exports.EMAIL_REGEX=pu;exports.EVENT_VARIABLES=jl;exports.FIELD_TYPES=Ir;exports.FIELD_TYPE_ICONS=Zx;exports.FIELD_TYPE_LABELS=Xx;exports.FieldType=P;exports.FormRenderer=Hj;exports.FormSchemaStatus=ki;exports.FormSpy=Wj;exports.GridOverlay=Ul;exports.LivePreview=US;exports.MaskType=lu;exports.OPCOES_POR_DIA=yh;exports.OPCOES_TODOS_OS_DIAS=wh;exports.PRESET_BLOCKS=lo;exports.PRESET_STEP_BLOCKS=Si;exports.Palette=KS;exports.RendererContext=Za;exports.STRUCTURE_TYPES=kl;exports.StepRenderer=Eh;exports.TELEFONE_REGEX=uu;exports.TEMPLATE_REGISTRY=Zr;exports.TemplateProvider=Yn;exports.builderToFormSchema=Cl;exports.evaluateFieldCondition=Se;exports.findParentContainer=Nl;exports.formSchemaToBuilder=Ih;exports.generateId=cu;exports.getAllTemplates=mg;exports.getFieldMeta=qj;exports.getFieldMetaById=Rh;exports.getItemType=qe;exports.getPresetById=Ni;exports.getPresetStepBlockById=gg;exports.getPresetsByCategory=xg;exports.getTemplateConfig=io;exports.interpolate=ht;exports.interpolateContainer=Vo;exports.interpolateField=ch;exports.interpolateStep=dh;exports.isDarkTemplate=hu;exports.isGlassmorphism=pg;exports.isValidCpfDigits=fu;exports.makeStepResolver=ih;exports.makeStepWarnComputer=lh;exports.stripHiddenFields=ji;exports.useBuilder=xt;exports.useBuilderExport=Xj;exports.useField=Lj;exports.useFieldApi=zj;exports.useFormApi=Fj;exports.useFormState=Th;exports.useRendererContext=Cr;exports.useTemplate=na;exports.v4Fallback=Nt;exports.validateBuilderIntegrity=Oh;exports.validateStepData=Ci;