@schema-forms-data/builder 0.3.18 → 0.3.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +752 -746
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),_=require("react"),k=require("lucide-react"),de=require("@schema-forms-data/core"),So=require("react-dom"),Ye=require("@schema-forms-data/templates"),Fe=require("@dnd-kit/sortable"),Mt=require("@dnd-kit/utilities"),jt=require("@dnd-kit/core");function Po(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 u=Po(_),Lt=Po(k),fr=Po(So),at=[{component:"texto",label:"Texto",icon:k.Type,group:"texto"},{component:"textarea",label:"Área de texto",icon:k.AlignLeft,group:"texto"},{component:"number",label:"Número",icon:k.Hash,group:"texto"},{component:"email",label:"E-mail",icon:k.Mail,group:"texto"},{component:"password",label:"Senha",icon:k.Lock,group:"texto"},{component:"select",label:"Seleção",icon:k.ChevronDown,group:"selecao"},{component:"autocomplete",label:"Autocomplete",icon:k.Search,group:"selecao"},{component:"radio",label:"Radio",icon:k.CircleDot,group:"selecao"},{component:"checkbox",label:"Checkbox",icon:k.CheckSquare,group:"selecao"},{component:"checkbox_group",label:"Grupo de checkboxes",icon:k.ListChecks,group:"selecao"},{component:"switch",label:"Switch (toggle)",icon:k.ToggleLeft,group:"selecao"},{component:"slider",label:"Slider",icon:k.SlidersHorizontal,group:"range"},{component:"rating",label:"Avaliação (estrelas)",icon:k.Star,group:"range"},{component:"color",label:"Cor",icon:k.Palette,group:"range"},{component:"date",label:"Data",icon:k.Calendar,group:"data"},{component:"datetime",label:"Data e hora",icon:k.Clock,group:"data"},{component:"time",label:"Horário",icon:k.Timer,group:"data"},{component:"date_range",label:"Período",icon:k.CalendarRange,group:"data"},{component:"telefone",label:"Telefone",icon:k.Phone,group:"contato"},{component:"cpf",label:"CPF",icon:k.CreditCard,group:"contato"},{component:"cep",label:"CEP",icon:k.MapPin,group:"contato"},{component:"file",label:"Arquivo",icon:k.Upload,group:"outros"},{component:"hidden",label:"Oculto",icon:k.EyeOff,group:"outros"},{component:"field_array",label:"Lista de itens",icon:k.List,group:"outros"},{component:"terms",label:"Termos e condições",icon:k.ScrollText,group:"outros"},{component:"sub_form",label:"Sub-formulário",icon:k.LayoutList,group:"outros"}],ss=[{component:"step",label:"Step",icon:k.Layers,color:"border-primary/40 bg-primary/5"},{component:"container",label:"Container",icon:k.BoxSelect,color:"border-blue-500/40 bg-blue-500/5"}],Ro=[{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"}],me=e=>e.startsWith("step-")||e==="step"?"step":e.startsWith("container-")||e==="container"?"container":"field",zl=e=>at.find(t=>t.component===e),as=e=>{const t=at.map(n=>n.component).filter(n=>n.includes("_"));for(const n of t)if(e.startsWith(n))return at.find(s=>s.component===n);const r=e.split("-")[0];return at.find(n=>n.component===r)},is=_.createContext(null),Vl=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]},Wr=(e,t)=>{const r=t||Vl(e),n=r==="step",s=r==="container",a=r==="field_array";return{label:n?"Novo Step":s?"Novo Container":a?"Lista de itens":r||e,name:e,fieldType:r||"texto",required:!1,columns:2,tamanho:s||a?12:n?void 0:6,showLabel:s?!0:void 0,itemLabel:a?"Item":void 0}},Hr=e=>({containers:JSON.parse(JSON.stringify(e.containers)),configs:JSON.parse(JSON.stringify(e.configs))}),ls=(e,t)=>{const r=[e],n=t[e];if(n!=null&&n.children)for(const s of n.children)r.push(...ls(s,t));return r},cs=(e,t)=>{for(const[r,n]of Object.entries(t))if(n.children.includes(e))return r;return null},Bl=({children:e,initialConfigs:t,initialContainers:r,initialTemplateId:n,schemaId:s,uploadTermsPdf:a})=>{const[i,l]=_.useState({selectedId:null,configs:t||{},showPreview:!1,containers:r??{root:{children:[]}},previewTemplateId:n||"moderno"}),[c,d]=_.useState(null),[m,p]=_.useState(null),f=_.useRef([]),x=_.useRef([]),g=A=>{f.current=[...f.current.slice(-49),Hr(A)],x.current=[]},h=_.useCallback(()=>{l(A=>(g(A),{...A}))},[]),v=_.useCallback(()=>{f.current.length!==0&&l(A=>{x.current=[...x.current,Hr(A)];const T=f.current.pop();return{...A,containers:T.containers,configs:T.configs}})},[]),b=_.useCallback(()=>{x.current.length!==0&&l(A=>{f.current=[...f.current,Hr(A)];const T=x.current.pop();return{...A,containers:T.containers,configs:T.configs}})},[]);_.useEffect(()=>{const A=T=>{const R=T.metaKey||T.ctrlKey;R&&T.key==="z"&&!T.shiftKey&&(T.preventDefault(),v()),R&&T.key==="z"&&T.shiftKey&&(T.preventDefault(),b()),R&&T.key==="y"&&(T.preventDefault(),b())};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[v,b]);const w=_.useCallback(A=>i.configs[A]??Wr(A),[i.configs]),N=_.useCallback(()=>{const A=[],T=R=>{var O;const V=((O=i.containers[R])==null?void 0:O.children)??[];for(const q of V)me(q)==="field"?A.push(q):i.containers[q]&&T(q)};return T("root"),A},[i.containers]),C=_.useCallback(A=>{l(T=>({...T,selectedId:A}))},[]),j=_.useCallback(A=>{l(T=>({...T,showPreview:A}))},[]),S=_.useCallback(A=>{l(T=>({...T,previewTemplateId:A}))},[]),P=_.useCallback((A,T)=>{l(R=>({...R,configs:{...R.configs,[A]:{...R.configs[A]??Wr(A),...T}}}))},[]),y=_.useCallback((A,T,R)=>{const V=`${A}-${de.v4Fallback()}`,O=me(V);return l(q=>{var X;g(q);const se={...q.containers};(O==="step"||O==="container"||A==="field_array")&&(se[V]={children:[]});const ie=[...((X=se[T])==null?void 0:X.children)??[]];return R!==void 0&&R>=0?ie.splice(R,0,V):ie.push(V),se[T]={children:ie},{...q,containers:se,configs:{...q.configs,[V]:Wr(V,A)},selectedId:V}}),V},[]),E=_.useCallback((A,T)=>{const R=`container-${de.v4Fallback()}`;return l(V=>{var X,ne,ae;g(V);const O={...V.containers},q={...V.configs},se=[];for(const F of A.containerTemplate.campos){const oe=F.locked?F.id:`${String(F.tipo).toLowerCase()}-${de.v4Fallback()}`;if(se.push(oe),q[oe]={label:F.label,name:F.locked?F.id:F.nome,fieldType:F.tipo,required:F.obrigatorio||!1,placeholder:F.placeholder,hint:F.hint,tamanho:F.tamanho||6,inicioColuna:F.inicioColuna,defaultValue:F.defaultValue!=null?String(F.defaultValue):void 0,locked:F.locked||!1,options:(X=F.opcoes)==null?void 0:X.map(K=>({value:K.valor,label:K.label})),...F.tipo==="field_array"&&{itemLabel:F.itemLabel,minItems:F.minItems,maxItems:F.maxItems,addLabel:F.addLabel}},F.tipo==="field_array"){const K=[];for(const J of F.subFields??[]){const G=`${String(J.tipo).toLowerCase()}-${de.v4Fallback()}`;K.push(G),q[G]={label:J.label,name:J.nome,fieldType:J.tipo,required:J.obrigatorio||!1,placeholder:J.placeholder,hint:J.hint,tamanho:J.tamanho||6,inicioColuna:J.inicioColuna,options:(ne=J.opcoes)==null?void 0:ne.map(ee=>({value:ee.valor,label:ee.label}))}}O[oe]={children:K}}}O[R]={children:se},q[R]={label:A.containerTemplate.titulo||A.name,description:A.containerTemplate.descricao,icone:A.containerTemplate.icone,tamanho:A.containerTemplate.tamanho||12,inicioColuna:A.containerTemplate.inicioColuna,showLabel:!0};const ie=[...((ae=O[T])==null?void 0:ae.children)??[]];return ie.push(R),O[T]={children:ie},{...V,containers:O,configs:q,selectedId:R}}),R},[]),I=_.useCallback(A=>{const T=[];return l(R=>{var q,se,ie;g(R);const V={...R.containers},O={...R.configs};for(const X of A.steps){const ne=`step-${de.v4Fallback()}`;T.push(ne);const ae=[];for(const oe of X.containers){const K=`container-${de.v4Fallback()}`;ae.push(K);const J=[];for(const G of oe.campos){const ee=G.locked?G.id:`${String(G.tipo).toLowerCase()}-${de.v4Fallback()}`;if(J.push(ee),O[ee]={label:G.label,name:G.locked?G.id:G.nome,fieldType:G.tipo,required:G.obrigatorio||!1,placeholder:G.placeholder,hint:G.hint,tamanho:G.tamanho||12,inicioColuna:G.inicioColuna,defaultValue:G.defaultValue!=null?String(G.defaultValue):void 0,locked:G.locked||!1,options:(q=G.opcoes)==null?void 0:q.map(ue=>({value:ue.valor,label:ue.label})),...G.tipo==="field_array"&&{itemLabel:G.itemLabel,minItems:G.minItems,maxItems:G.maxItems,addLabel:G.addLabel}},G.tipo==="field_array"){const ue=[];for(const ce of G.subFields??[]){const He=`${String(ce.tipo).toLowerCase()}-${de.v4Fallback()}`;ue.push(He),O[He]={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:(se=ce.opcoes)==null?void 0:se.map(Ue=>({value:Ue.valor,label:Ue.label}))}}V[ee]={children:ue}}}V[K]={children:J},O[K]={label:oe.titulo,description:oe.descricao,icone:oe.icone,tamanho:oe.tamanho||12,showLabel:!0}}V[ne]={children:ae},O[ne]={label:X.titulo,description:X.descricao,icone:X.icone};const F=[...((ie=V.root)==null?void 0:ie.children)??[],ne];V.root={children:F}}return{...R,containers:V,configs:O,selectedId:T[0]??R.selectedId}}),T},[]),L=_.useCallback((A,T,R,V)=>{l(O=>{var ne,ae;g(O);const q={...O.containers},se=(((ne=q[T])==null?void 0:ne.children)??[]).filter(F=>F!==A);q[T]={children:se};const ie=[...(((ae=q[R])==null?void 0:ae.children)??[]).filter(F=>F!==A)],X=Math.max(0,Math.min(V,ie.length));return ie.splice(X,0,A),q[R]={children:ie},{...O,containers:q}})},[]),D=_.useCallback((A,T)=>{l(R=>({...R,containers:{...R.containers,[A]:{children:T}}}))},[]),z=_.useCallback(A=>{l(T=>{g(T);const R=ls(A,T.containers),V={};for(const[q,se]of Object.entries(T.containers))R.includes(q)||(V[q]={children:se.children.filter(ie=>ie!==A)});const O={...T.configs};for(const q of R)delete O[q];return{...T,containers:V,configs:O,selectedId:R.includes(T.selectedId??"")?null:T.selectedId}})},[]),M=_.useCallback((A,T)=>{l(R=>{const V=cs(A,R.containers);if(!V)return R;const O=[...R.containers[V].children],q=O.indexOf(A),se=T==="up"?q-1:q+1;return se<0||se>=O.length?R:([O[q],O[se]]=[O[se],O[q]],{...R,containers:{...R.containers,[V]:{children:O}}})})},[]),$=_.useCallback((A,T)=>{h(),M(A,T)},[M,h]);return o.jsx(is.Provider,{value:{selectedId:i.selectedId,configs:i.configs,showPreview:i.showPreview,containers:i.containers,positionDrag:c,reorderDrag:m,canUndo:f.current.length>0,canRedo:x.current.length>0,schemaId:s,uploadTermsPdf:a,previewTemplateId:i.previewTemplateId,setPreviewTemplateId:S,getConfig:w,getAllFieldIds:N,setSelected:C,updateConfig:P,setShowPreview:j,addItem:y,addPresetBlock:E,addPresetStepBlock:I,moveCanvasItem:L,reorderInContainer:D,removeItem:z,moveItem:$,moveItemNoSnapshot:M,setPositionDrag:d,setReorderDrag:p,undo:v,redo:b,pushSnapshot:h},children:e})},ke=()=>{const e=_.useContext(is);if(!e)throw new Error("useBuilder must be inside BuilderProvider");return e};function pn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Eo(...e){return t=>{let r=!1;const n=e.map(s=>{const a=pn(s,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let s=0;s<n.length;s++){const a=n[s];typeof a=="function"?a():pn(e[s],null)}}}}function re(...e){return u.useCallback(Eo(...e),e)}var Wl=Symbol.for("react.lazy"),tr=u[" use ".trim().toString()];function Hl(e){return typeof e=="object"&&e!==null&&"then"in e}function ds(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Wl&&"_payload"in e&&Hl(e._payload)}function us(e){const t=Gl(e),r=u.forwardRef((n,s)=>{let{children:a,...i}=n;ds(a)&&typeof tr=="function"&&(a=tr(a._payload));const l=u.Children.toArray(a),c=l.find(Xl);if(c){const d=c.props.children,m=l.map(p=>p===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:p);return o.jsx(t,{...i,ref:s,children:u.isValidElement(d)?u.cloneElement(d,void 0,m):null})}return o.jsx(t,{...i,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}var Ul=us("Slot");function Gl(e){const t=u.forwardRef((r,n)=>{let{children:s,...a}=r;if(ds(s)&&typeof tr=="function"&&(s=tr(s._payload)),u.isValidElement(s)){const i=Zl(s),l=Yl(a,s.props);return s.type!==u.Fragment&&(l.ref=n?Eo(n,i):i),u.cloneElement(s,l)}return u.Children.count(s)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ql=Symbol("radix.slottable");function Xl(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ql}function Yl(e,t){const r={...t};for(const n in t){const s=e[n],a=t[n];/^on[A-Z]/.test(n)?s&&a?r[n]=(...l)=>{const c=a(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...a}:n==="className"&&(r[n]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function Zl(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Kl=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],hr=Kl.reduce((e,t)=>{const r=us(`Primitive.${t}`),n=u.forwardRef((s,a)=>{const{asChild:i,...l}=s,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Jl="Separator",fn="horizontal",Ql=["horizontal","vertical"],ms=u.forwardRef((e,t)=>{const{decorative:r,orientation:n=fn,...s}=e,a=ec(n)?n:fn,l=r?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return o.jsx(hr.div,{"data-orientation":a,...l,...s,ref:t})});ms.displayName=Jl;function ec(e){return Ql.includes(e)}var ps=ms;function fs(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=fs(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function hs(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=fs(e))&&(n&&(n+=" "),n+=t);return n}const tc=(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},rc=(e,t)=>({classGroupId:e,validator:t}),xs=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),rr="-",hn=[],oc="arbitrary..",nc=e=>{const t=ac(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return sc(i);const l=i.split(rr),c=l[0]===""&&l.length>1?1:0;return gs(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=n[i],d=r[i];return c?d?tc(d,c):c:d||hn}return r[i]||hn}}},gs=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],a=r.nextPart.get(s);if(a){const d=gs(e,t+1,a);if(d)return d}const i=r.validators;if(i===null)return;const l=t===0?e.join(rr):e.slice(t).join(rr),c=i.length;for(let d=0;d<c;d++){const m=i[d];if(m.validator(l))return m.classGroupId}},sc=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?oc+n:void 0})(),ac=e=>{const{theme:t,classGroups:r}=e;return ic(r,t)},ic=(e,t)=>{const r=xs();for(const n in e){const s=e[n];Ao(s,r,n,t)}return r},Ao=(e,t,r,n)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];lc(i,t,r,n)}},lc=(e,t,r,n)=>{if(typeof e=="string"){cc(e,t,r);return}if(typeof e=="function"){dc(e,t,r,n);return}uc(e,t,r,n)},cc=(e,t,r)=>{const n=e===""?t:vs(t,e);n.classGroupId=r},dc=(e,t,r,n)=>{if(mc(e)){Ao(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(rc(r,e))},uc=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[l,c]=s[i];Ao(c,vs(t,l),r,n)}},vs=(e,t)=>{let r=e;const n=t.split(rr),s=n.length;for(let a=0;a<s;a++){const i=n[a];let l=r.nextPart.get(i);l||(l=xs(),r.nextPart.set(i,l)),r=l}return r},mc=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,pc=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const s=(a,i)=>{r[a]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let i=r[a];if(i!==void 0)return i;if((i=n[a])!==void 0)return s(a,i),i},set(a,i){a in r?r[a]=i:s(a,i)}}},no="!",xn=":",fc=[],gn=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),hc=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let i=0,l=0,c=0,d;const m=s.length;for(let h=0;h<m;h++){const v=s[h];if(i===0&&l===0){if(v===xn){a.push(s.slice(c,h)),c=h+1;continue}if(v==="/"){d=h;continue}}v==="["?i++:v==="]"?i--:v==="("?l++:v===")"&&l--}const p=a.length===0?s:s.slice(c);let f=p,x=!1;p.endsWith(no)?(f=p.slice(0,-1),x=!0):p.startsWith(no)&&(f=p.slice(1),x=!0);const g=d&&d>c?d-c:void 0;return gn(a,x,f,g)};if(t){const s=t+xn,a=n;n=i=>i.startsWith(s)?a(i.slice(s.length)):gn(fc,!1,i,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},xc=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let a=0;a<r.length;a++){const i=r[a],l=i[0]==="[",c=t.has(i);l||c?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(i)):s.push(i)}return s.length>0&&(s.sort(),n.push(...s)),n}},gc=e=>({cache:pc(e.cacheSize),parseClassName:hc(e),sortModifiers:xc(e),...nc(e)}),vc=/\s+/,bc=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],l=e.trim().split(vc);let c="";for(let d=l.length-1;d>=0;d-=1){const m=l[d],{isExternal:p,modifiers:f,hasImportantModifier:x,baseClassName:g,maybePostfixModifierPosition:h}=r(m);if(p){c=m+(c.length>0?" "+c:c);continue}let v=!!h,b=n(v?g.substring(0,h):g);if(!b){if(!v){c=m+(c.length>0?" "+c:c);continue}if(b=n(g),!b){c=m+(c.length>0?" "+c:c);continue}v=!1}const w=f.length===0?"":f.length===1?f[0]:a(f).join(":"),N=x?w+no:w,C=N+b;if(i.indexOf(C)>-1)continue;i.push(C);const j=s(b,v);for(let S=0;S<j.length;++S){const P=j[S];i.push(N+P)}c=m+(c.length>0?" "+c:c)}return c},yc=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=bs(r))&&(s&&(s+=" "),s+=n);return s},bs=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=bs(e[n]))&&(r&&(r+=" "),r+=t);return r},wc=(e,...t)=>{let r,n,s,a;const i=c=>{const d=t.reduce((m,p)=>p(m),e());return r=gc(d),n=r.cache.get,s=r.cache.set,a=l,l(c)},l=c=>{const d=n(c);if(d)return d;const m=bc(c,r);return s(c,m),m};return a=i,(...c)=>a(yc(...c))},Nc=[],fe=e=>{const t=r=>r[e]||Nc;return t.isThemeGetter=!0,t},ys=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ws=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Cc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,jc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Sc=/\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$/,Pc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Rc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ec=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ge=e=>Cc.test(e),te=e=>!!e&&!Number.isNaN(Number(e)),qe=e=>!!e&&Number.isInteger(Number(e)),Ur=e=>e.endsWith("%")&&te(e.slice(0,-1)),Me=e=>jc.test(e),Ns=()=>!0,Ac=e=>Sc.test(e)&&!Pc.test(e),ko=()=>!1,kc=e=>Rc.test(e),Tc=e=>Ec.test(e),Ic=e=>!W(e)&&!H(e),Lc=e=>et(e,Ss,ko),W=e=>ys.test(e),nt=e=>et(e,Ps,Ac),vn=e=>et(e,Vc,te),Oc=e=>et(e,Es,Ns),_c=e=>et(e,Rs,ko),bn=e=>et(e,Cs,ko),Dc=e=>et(e,js,Tc),Ht=e=>et(e,As,kc),H=e=>ws.test(e),Tt=e=>mt(e,Ps),Mc=e=>mt(e,Rs),yn=e=>mt(e,Cs),$c=e=>mt(e,Ss),Fc=e=>mt(e,js),Ut=e=>mt(e,As,!0),zc=e=>mt(e,Es,!0),et=(e,t,r)=>{const n=ys.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},mt=(e,t,r=!1)=>{const n=ws.exec(e);return n?n[1]?t(n[1]):r:!1},Cs=e=>e==="position"||e==="percentage",js=e=>e==="image"||e==="url",Ss=e=>e==="length"||e==="size"||e==="bg-size",Ps=e=>e==="length",Vc=e=>e==="number",Rs=e=>e==="family-name",Es=e=>e==="number"||e==="weight",As=e=>e==="shadow",Bc=()=>{const e=fe("color"),t=fe("font"),r=fe("text"),n=fe("font-weight"),s=fe("tracking"),a=fe("leading"),i=fe("breakpoint"),l=fe("container"),c=fe("spacing"),d=fe("radius"),m=fe("shadow"),p=fe("inset-shadow"),f=fe("text-shadow"),x=fe("drop-shadow"),g=fe("blur"),h=fe("perspective"),v=fe("aspect"),b=fe("ease"),w=fe("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...C(),H,W],S=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],y=()=>[H,W,c],E=()=>[Ge,"full","auto",...y()],I=()=>[qe,"none","subgrid",H,W],L=()=>["auto",{span:["full",qe,H,W]},qe,H,W],D=()=>[qe,"auto",H,W],z=()=>["auto","min","max","fr",H,W],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...y()],T=()=>[Ge,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...y()],R=()=>[Ge,"screen","full","dvw","lvw","svw","min","max","fit",...y()],V=()=>[Ge,"screen","full","lh","dvh","lvh","svh","min","max","fit",...y()],O=()=>[e,H,W],q=()=>[...C(),yn,bn,{position:[H,W]}],se=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ie=()=>["auto","cover","contain",$c,Lc,{size:[H,W]}],X=()=>[Ur,Tt,nt],ne=()=>["","none","full",d,H,W],ae=()=>["",te,Tt,nt],F=()=>["solid","dashed","dotted","double"],oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[te,Ur,yn,bn],J=()=>["","none",g,H,W],G=()=>["none",te,H,W],ee=()=>["none",te,H,W],ue=()=>[te,H,W],ce=()=>[Ge,"full",...y()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Me],breakpoint:[Me],color:[Ns],container:[Me],"drop-shadow":[Me],ease:["in","out","in-out"],font:[Ic],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Me],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Me],shadow:[Me],spacing:["px",te],text:[Me],"text-shadow":[Me],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ge,W,H,v]}],container:["container"],columns:[{columns:[te,W,H,l]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"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:j()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],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:[qe,"auto",H,W]}],basis:[{basis:[Ge,"full","auto",l,...y()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[te,Ge,"auto","initial","none",W]}],grow:[{grow:["",te,H,W]}],shrink:[{shrink:["",te,H,W]}],order:[{order:[qe,"first","last","none",H,W]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:y()}],"gap-x":[{"gap-x":y()}],"gap-y":[{"gap-y":y()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:y()}],px:[{px:y()}],py:[{py:y()}],ps:[{ps:y()}],pe:[{pe:y()}],pbs:[{pbs:y()}],pbe:[{pbe:y()}],pt:[{pt:y()}],pr:[{pr:y()}],pb:[{pb:y()}],pl:[{pl:y()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":y()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":y()}],"space-y-reverse":["space-y-reverse"],size:[{size:T()}],"inline-size":[{inline:["auto",...R()]}],"min-inline-size":[{"min-inline":["auto",...R()]}],"max-inline-size":[{"max-inline":["none",...R()]}],"block-size":[{block:["auto",...V()]}],"min-block-size":[{"min-block":["auto",...V()]}],"max-block-size":[{"max-block":["none",...V()]}],w:[{w:[l,"screen",...T()]}],"min-w":[{"min-w":[l,"screen","none",...T()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...T()]}],h:[{h:["screen","lh",...T()]}],"min-h":[{"min-h":["screen","lh","none",...T()]}],"max-h":[{"max-h":["screen","lh",...T()]}],"font-size":[{text:["base",r,Tt,nt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,zc,Oc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ur,W]}],"font-family":[{font:[Mc,_c,t]}],"font-features":[{"font-features":[W]}],"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:[s,H,W]}],"line-clamp":[{"line-clamp":[te,"none",H,vn]}],leading:[{leading:[a,...y()]}],"list-image":[{"list-image":["none",H,W]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",H,W]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...F(),"wavy"]}],"text-decoration-thickness":[{decoration:[te,"from-font","auto",H,nt]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[te,"auto",H,W]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:y()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",H,W]}],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",H,W]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:se()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qe,H,W],radial:["",H,W],conic:[qe,H,W]},Fc,Dc]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:X()}],"gradient-via-pos":[{via:X()}],"gradient-to-pos":[{to:X()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],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:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...F(),"hidden","none"]}],"divide-style":[{divide:[...F(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-bs":[{"border-bs":O()}],"border-color-be":[{"border-be":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...F(),"none","hidden"]}],"outline-offset":[{"outline-offset":[te,H,W]}],"outline-w":[{outline:["",te,Tt,nt]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",m,Ut,Ht]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",p,Ut,Ht]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[te,nt]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",f,Ut,Ht]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[te,H,W]}],"mix-blend":[{"mix-blend":[...oe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":oe()}],"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":[te]}],"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":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"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":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"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":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"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":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"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":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"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":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"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":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[H,W]}],"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":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"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":C()}],"mask-image-conic-pos":[{"mask-conic":[te]}],"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":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:se()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",H,W]}],filter:[{filter:["","none",H,W]}],blur:[{blur:J()}],brightness:[{brightness:[te,H,W]}],contrast:[{contrast:[te,H,W]}],"drop-shadow":[{"drop-shadow":["","none",x,Ut,Ht]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",te,H,W]}],"hue-rotate":[{"hue-rotate":[te,H,W]}],invert:[{invert:["",te,H,W]}],saturate:[{saturate:[te,H,W]}],sepia:[{sepia:["",te,H,W]}],"backdrop-filter":[{"backdrop-filter":["","none",H,W]}],"backdrop-blur":[{"backdrop-blur":J()}],"backdrop-brightness":[{"backdrop-brightness":[te,H,W]}],"backdrop-contrast":[{"backdrop-contrast":[te,H,W]}],"backdrop-grayscale":[{"backdrop-grayscale":["",te,H,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[te,H,W]}],"backdrop-invert":[{"backdrop-invert":["",te,H,W]}],"backdrop-opacity":[{"backdrop-opacity":[te,H,W]}],"backdrop-saturate":[{"backdrop-saturate":[te,H,W]}],"backdrop-sepia":[{"backdrop-sepia":["",te,H,W]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":y()}],"border-spacing-x":[{"border-spacing-x":y()}],"border-spacing-y":[{"border-spacing-y":y()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",H,W]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[te,"initial",H,W]}],ease:[{ease:["linear","initial",b,H,W]}],delay:[{delay:[te,H,W]}],animate:[{animate:["none",w,H,W]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,H,W]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:G()}],"rotate-x":[{"rotate-x":G()}],"rotate-y":[{"rotate-y":G()}],"rotate-z":[{"rotate-z":G()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[H,W,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":["translate-none"],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"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",H,W]}],"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":y()}],"scroll-mx":[{"scroll-mx":y()}],"scroll-my":[{"scroll-my":y()}],"scroll-ms":[{"scroll-ms":y()}],"scroll-me":[{"scroll-me":y()}],"scroll-mbs":[{"scroll-mbs":y()}],"scroll-mbe":[{"scroll-mbe":y()}],"scroll-mt":[{"scroll-mt":y()}],"scroll-mr":[{"scroll-mr":y()}],"scroll-mb":[{"scroll-mb":y()}],"scroll-ml":[{"scroll-ml":y()}],"scroll-p":[{"scroll-p":y()}],"scroll-px":[{"scroll-px":y()}],"scroll-py":[{"scroll-py":y()}],"scroll-ps":[{"scroll-ps":y()}],"scroll-pe":[{"scroll-pe":y()}],"scroll-pbs":[{"scroll-pbs":y()}],"scroll-pbe":[{"scroll-pbe":y()}],"scroll-pt":[{"scroll-pt":y()}],"scroll-pr":[{"scroll-pr":y()}],"scroll-pb":[{"scroll-pb":y()}],"scroll-pl":[{"scroll-pl":y()}],"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",H,W]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[te,Tt,nt,vn]}],stroke:[{stroke:["none",...O()]}],"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"]}},Wc=wc(Bc);function U(...e){return Wc(hs(e))}const Ne=u.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>o.jsx(ps,{ref:s,decorative:r,orientation:t,className:U("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Ne.displayName=ps.displayName;const Y=u.forwardRef(({className:e,type:t,...r},n)=>o.jsx("input",{type:t,className:U("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}));Y.displayName="Input";var Hc="Label",ks=u.forwardRef((e,t)=>o.jsx(hr.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));ks.displayName=Hc;var Ts=ks;const wn=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Nn=hs,To=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return Nn(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(d=>{const m=r==null?void 0:r[d],p=a==null?void 0:a[d];if(m===null)return null;const f=wn(m)||wn(p);return s[d][f]}),l=r&&Object.entries(r).reduce((d,m)=>{let[p,f]=m;return f===void 0||(d[p]=f),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,m)=>{let{class:p,className:f,...x}=m;return Object.entries(x).every(g=>{let[h,v]=g;return Array.isArray(v)?v.includes({...a,...l}[h]):{...a,...l}[h]===v})?[...d,p,f]:d},[]);return Nn(e,i,c,r==null?void 0:r.class,r==null?void 0:r.className)},Uc=To("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),B=u.forwardRef(({className:e,...t},r)=>o.jsx(Ts,{ref:r,className:U(Uc(),e),...t}));B.displayName=Ts.displayName;function Gc(e,t){const r=u.createContext(t),n=a=>{const{children:i,...l}=a,c=u.useMemo(()=>l,Object.values(l));return o.jsx(r.Provider,{value:c,children:i})};n.displayName=e+"Provider";function s(a){const i=u.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[n,s]}function Be(e,t=[]){let r=[];function n(a,i){const l=u.createContext(i),c=r.length;r=[...r,i];const d=p=>{var b;const{scope:f,children:x,...g}=p,h=((b=f==null?void 0:f[e])==null?void 0:b[c])||l,v=u.useMemo(()=>g,Object.values(g));return o.jsx(h.Provider,{value:v,children:x})};d.displayName=a+"Provider";function m(p,f){var h;const x=((h=f==null?void 0:f[e])==null?void 0:h[c])||l,g=u.useContext(x);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[d,m]}const s=()=>{const a=r.map(i=>u.createContext(i));return function(l){const c=(l==null?void 0:l[e])||a;return u.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,qc(s,...t)]}function qc(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const i=n.reduce((l,{useScope:c,scopeName:d})=>{const p=c(a)[`__scope${d}`];return{...l,...p}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}function Z(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e==null||e(s),r===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}var he=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},Xc=u[" useInsertionEffect ".trim().toString()]||he;function it({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,a,i]=Yc({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:s;{const m=u.useRef(e!==void 0);u.useEffect(()=>{const p=m.current;p!==l&&console.warn(`${n} is changing from ${p?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),m.current=l},[l,n])}const d=u.useCallback(m=>{var p;if(l){const f=Zc(m)?m(e):m;f!==e&&((p=i.current)==null||p.call(i,f))}else a(m)},[l,e,a,i]);return[c,d]}function Yc({defaultProp:e,onChange:t}){const[r,n]=u.useState(e),s=u.useRef(r),a=u.useRef(t);return Xc(()=>{a.current=t},[t]),u.useEffect(()=>{var i;s.current!==r&&((i=a.current)==null||i.call(a,r),s.current=r)},[r,s]),[r,n,a]}function Zc(e){return typeof e=="function"}function Io(e){const t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Lo(e){const[t,r]=u.useState(void 0);return he(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let i,l;if("borderBoxSize"in a){const c=a.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 Kc(e,t){return u.useReducer((r,n)=>t[r][n]??r,e)}var Se=e=>{const{present:t,children:r}=e,n=Jc(t),s=typeof r=="function"?r({present:n.isPresent}):u.Children.only(r),a=re(n.ref,Qc(s));return typeof r=="function"||n.isPresent?u.cloneElement(s,{ref:a}):null};Se.displayName="Presence";function Jc(e){const[t,r]=u.useState(),n=u.useRef(null),s=u.useRef(e),a=u.useRef("none"),i=e?"mounted":"unmounted",[l,c]=Kc(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=Gt(n.current);a.current=l==="mounted"?d:"none"},[l]),he(()=>{const d=n.current,m=s.current;if(m!==e){const f=a.current,x=Gt(d);e?c("MOUNT"):x==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(m&&f!==x?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),he(()=>{if(t){let d;const m=t.ownerDocument.defaultView??window,p=x=>{const h=Gt(n.current).includes(CSS.escape(x.animationName));if(x.target===t&&h&&(c("ANIMATION_END"),!s.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",d=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},f=x=>{x.target===t&&(a.current=Gt(n.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{m.clearTimeout(d),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:u.useCallback(d=>{n.current=d?getComputedStyle(d):null,r(d)},[])}}function Gt(e){return(e==null?void 0:e.animationName)||"none"}function Qc(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function bt(e){const t=ed(e),r=u.forwardRef((n,s)=>{const{children:a,...i}=n,l=u.Children.toArray(a),c=l.find(rd);if(c){const d=c.props.children,m=l.map(p=>p===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:p);return o.jsx(t,{...i,ref:s,children:u.isValidElement(d)?u.cloneElement(d,void 0,m):null})}return o.jsx(t,{...i,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function ed(e){const t=u.forwardRef((r,n)=>{const{children:s,...a}=r;if(u.isValidElement(s)){const i=nd(s),l=od(a,s.props);return s.type!==u.Fragment&&(l.ref=n?Eo(n,i):i),u.cloneElement(s,l)}return u.Children.count(s)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Is=Symbol("radix.slottable");function td(e){const t=({children:r})=>o.jsx(o.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Is,t}function rd(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Is}function od(e,t){const r={...t};for(const n in t){const s=e[n],a=t[n];/^on[A-Z]/.test(n)?s&&a?r[n]=(...l)=>{const c=a(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...a}:n==="className"&&(r[n]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function nd(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var sd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Q=sd.reduce((e,t)=>{const r=bt(`Primitive.${t}`),n=u.forwardRef((s,a)=>{const{asChild:i,...l}=s,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function ad(e,t){e&&fr.flushSync(()=>e.dispatchEvent(t))}var xr="Checkbox",[id]=Be(xr),[ld,Oo]=id(xr);function cd(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:s,disabled:a,form:i,name:l,onCheckedChange:c,required:d,value:m="on",internal_do_not_use_render:p}=e,[f,x]=it({prop:r,defaultProp:s??!1,onChange:c,caller:xr}),[g,h]=u.useState(null),[v,b]=u.useState(null),w=u.useRef(!1),N=g?!!i||!!g.closest("form"):!0,C={checked:f,disabled:a,setChecked:x,control:g,setControl:h,name:l,form:i,value:m,hasConsumerStoppedPropagationRef:w,required:d,defaultChecked:Ze(s)?!1:s,isFormControl:N,bubbleInput:v,setBubbleInput:b};return o.jsx(ld,{scope:t,...C,children:dd(p)?p(C):n})}var Ls="CheckboxTrigger",Os=u.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},s)=>{const{control:a,value:i,disabled:l,checked:c,required:d,setControl:m,setChecked:p,hasConsumerStoppedPropagationRef:f,isFormControl:x,bubbleInput:g}=Oo(Ls,e),h=re(s,m),v=u.useRef(c);return u.useEffect(()=>{const b=a==null?void 0:a.form;if(b){const w=()=>p(v.current);return b.addEventListener("reset",w),()=>b.removeEventListener("reset",w)}},[a,p]),o.jsx(Q.button,{type:"button",role:"checkbox","aria-checked":Ze(c)?"mixed":c,"aria-required":d,"data-state":Fs(c),"data-disabled":l?"":void 0,disabled:l,value:i,...n,ref:h,onKeyDown:Z(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:Z(r,b=>{p(w=>Ze(w)?!0:!w),g&&x&&(f.current=b.isPropagationStopped(),f.current||b.stopPropagation())})})});Os.displayName=Ls;var _o=u.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:a,required:i,disabled:l,value:c,onCheckedChange:d,form:m,...p}=e;return o.jsx(cd,{__scopeCheckbox:r,checked:s,defaultChecked:a,disabled:l,required:i,onCheckedChange:d,name:n,form:m,value:c,internal_do_not_use_render:({isFormControl:f})=>o.jsxs(o.Fragment,{children:[o.jsx(Os,{...p,ref:t,__scopeCheckbox:r}),f&&o.jsx($s,{__scopeCheckbox:r})]})})});_o.displayName=xr;var _s="CheckboxIndicator",Ds=u.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...s}=e,a=Oo(_s,r);return o.jsx(Se,{present:n||Ze(a.checked)||a.checked===!0,children:o.jsx(Q.span,{"data-state":Fs(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});Ds.displayName=_s;var Ms="CheckboxBubbleInput",$s=u.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:s,checked:a,defaultChecked:i,required:l,disabled:c,name:d,value:m,form:p,bubbleInput:f,setBubbleInput:x}=Oo(Ms,e),g=re(r,x),h=Io(a),v=Lo(n);u.useEffect(()=>{const w=f;if(!w)return;const N=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(N,"checked").set,S=!s.current;if(h!==a&&j){const P=new Event("click",{bubbles:S});w.indeterminate=Ze(a),j.call(w,Ze(a)?!1:a),w.dispatchEvent(P)}},[f,h,a,s]);const b=u.useRef(Ze(a)?!1:a);return o.jsx(Q.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??b.current,required:l,disabled:c,name:d,value:m,form:p,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});$s.displayName=Ms;function dd(e){return typeof e=="function"}function Ze(e){return e==="indeterminate"}function Fs(e){return Ze(e)?"indeterminate":e?"checked":"unchecked"}const xe=u.forwardRef(({className:e,...t},r)=>o.jsx(_o,{ref:r,className:U("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(Ds,{className:U("flex items-center justify-center text-current"),children:o.jsx(k.Check,{className:"h-4 w-4"})})}));xe.displayName=_o.displayName;const ud=To("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"}}),le=u.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},a)=>{const i=n?Ul:"button";return o.jsx(i,{className:U(ud({variant:t,size:r,className:e})),ref:a,...s})});le.displayName="Button";function ge(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}var md=u.createContext(void 0);function Do(e){const t=u.useContext(md);return e||t||"ltr"}function Ot(e,[t,r]){return Math.min(r,Math.max(t,e))}function pd(e,t){return u.useReducer((r,n)=>t[r][n]??r,e)}var Mo="ScrollArea",[zs]=Be(Mo),[fd,Pe]=zs(Mo),Vs=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:a=600,...i}=e,[l,c]=u.useState(null),[d,m]=u.useState(null),[p,f]=u.useState(null),[x,g]=u.useState(null),[h,v]=u.useState(null),[b,w]=u.useState(0),[N,C]=u.useState(0),[j,S]=u.useState(!1),[P,y]=u.useState(!1),E=re(t,L=>c(L)),I=Do(s);return o.jsx(fd,{scope:r,type:n,dir:I,scrollHideDelay:a,scrollArea:l,viewport:d,onViewportChange:m,content:p,onContentChange:f,scrollbarX:x,onScrollbarXChange:g,scrollbarXEnabled:j,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:v,scrollbarYEnabled:P,onScrollbarYEnabledChange:y,onCornerWidthChange:w,onCornerHeightChange:C,children:o.jsx(Q.div,{dir:I,...i,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":N+"px",...e.style}})})});Vs.displayName=Mo;var Bs="ScrollAreaViewport",Ws=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...a}=e,i=Pe(Bs,r),l=u.useRef(null),c=re(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:s}),o.jsx(Q.div,{"data-radix-scroll-area-viewport":"",...a,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})})]})});Ws.displayName=Bs;var _e="ScrollAreaScrollbar",$o=u.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Pe(_e,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:i}=s,l=e.orientation==="horizontal";return u.useEffect(()=>(l?a(!0):i(!0),()=>{l?a(!1):i(!1)}),[l,a,i]),s.type==="hover"?o.jsx(hd,{...n,ref:t,forceMount:r}):s.type==="scroll"?o.jsx(xd,{...n,ref:t,forceMount:r}):s.type==="auto"?o.jsx(Hs,{...n,ref:t,forceMount:r}):s.type==="always"?o.jsx(Fo,{...n,ref:t}):null});$o.displayName=_e;var hd=u.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Pe(_e,e.__scopeScrollArea),[a,i]=u.useState(!1);return u.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),i(!0)},m=()=>{c=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",m),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",m)}}},[s.scrollArea,s.scrollHideDelay]),o.jsx(Se,{present:r||a,children:o.jsx(Hs,{"data-state":a?"visible":"hidden",...n,ref:t})})}),xd=u.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Pe(_e,e.__scopeScrollArea),a=e.orientation==="horizontal",i=vr(()=>c("SCROLL_END"),100),[l,c]=pd("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 u.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,s.scrollHideDelay,c]),u.useEffect(()=>{const d=s.viewport,m=a?"scrollLeft":"scrollTop";if(d){let p=d[m];const f=()=>{const x=d[m];p!==x&&(c("SCROLL"),i()),p=x};return d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[s.viewport,a,c,i]),o.jsx(Se,{present:r||l!=="hidden",children:o.jsx(Fo,{"data-state":l==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:Z(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Z(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Hs=u.forwardRef((e,t)=>{const r=Pe(_e,e.__scopeScrollArea),{forceMount:n,...s}=e,[a,i]=u.useState(!1),l=e.orientation==="horizontal",c=vr(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,m=r.viewport.offsetHeight<r.viewport.scrollHeight;i(l?d:m)}},10);return yt(r.viewport,c),yt(r.content,c),o.jsx(Se,{present:n||a,children:o.jsx(Fo,{"data-state":a?"visible":"hidden",...s,ref:t})})}),Fo=u.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,s=Pe(_e,e.__scopeScrollArea),a=u.useRef(null),i=u.useRef(0),[l,c]=u.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Ys(l.viewport,l.content),m={...n,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:f=>a.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function p(f,x){return Nd(f,i.current,l,x)}return r==="horizontal"?o.jsx(gd,{...m,ref:t,onThumbPositionChange:()=>{if(s.viewport&&a.current){const f=s.viewport.scrollLeft,x=Cn(f,l,s.dir);a.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollLeft=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollLeft=p(f,s.dir))}}):r==="vertical"?o.jsx(vd,{...m,ref:t,onThumbPositionChange:()=>{if(s.viewport&&a.current){const f=s.viewport.scrollTop,x=Cn(f,l);a.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollTop=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollTop=p(f))}}):null}),gd=u.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,a=Pe(_e,e.__scopeScrollArea),[i,l]=u.useState(),c=u.useRef(null),d=re(t,c,a.onScrollbarXChange);return u.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Gs,{"data-orientation":"horizontal",...s,ref:d,sizes:r,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":gr(r)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(a.viewport){const f=a.viewport.scrollLeft+m.deltaX;e.onWheelScroll(f),Ks(f,p)&&m.preventDefault()}},onResize:()=>{c.current&&a.viewport&&i&&n({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:nr(i.paddingLeft),paddingEnd:nr(i.paddingRight)}})}})}),vd=u.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,a=Pe(_e,e.__scopeScrollArea),[i,l]=u.useState(),c=u.useRef(null),d=re(t,c,a.onScrollbarYChange);return u.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Gs,{"data-orientation":"vertical",...s,ref:d,sizes:r,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":gr(r)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(a.viewport){const f=a.viewport.scrollTop+m.deltaY;e.onWheelScroll(f),Ks(f,p)&&m.preventDefault()}},onResize:()=>{c.current&&a.viewport&&i&&n({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:nr(i.paddingTop),paddingEnd:nr(i.paddingBottom)}})}})}),[bd,Us]=zs(_e),Gs=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:a,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:m,onResize:p,...f}=e,x=Pe(_e,r),[g,h]=u.useState(null),v=re(t,E=>h(E)),b=u.useRef(null),w=u.useRef(""),N=x.viewport,C=n.content-n.viewport,j=ge(m),S=ge(c),P=vr(p,10);function y(E){if(b.current){const I=E.clientX-b.current.left,L=E.clientY-b.current.top;d({x:I,y:L})}}return u.useEffect(()=>{const E=I=>{const L=I.target;(g==null?void 0:g.contains(L))&&j(I,C)};return document.addEventListener("wheel",E,{passive:!1}),()=>document.removeEventListener("wheel",E,{passive:!1})},[N,g,C,j]),u.useEffect(S,[n,S]),yt(g,P),yt(x.content,P),o.jsx(bd,{scope:r,scrollbar:g,hasThumb:s,onThumbChange:ge(a),onThumbPointerUp:ge(i),onThumbPositionChange:S,onThumbPointerDown:ge(l),children:o.jsx(Q.div,{...f,ref:v,style:{position:"absolute",...f.style},onPointerDown:Z(e.onPointerDown,E=>{E.button===0&&(E.target.setPointerCapture(E.pointerId),b.current=g.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),y(E))}),onPointerMove:Z(e.onPointerMove,y),onPointerUp:Z(e.onPointerUp,E=>{const I=E.target;I.hasPointerCapture(E.pointerId)&&I.releasePointerCapture(E.pointerId),document.body.style.webkitUserSelect=w.current,x.viewport&&(x.viewport.style.scrollBehavior=""),b.current=null})})})}),or="ScrollAreaThumb",qs=u.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Us(or,e.__scopeScrollArea);return o.jsx(Se,{present:r||s.hasThumb,children:o.jsx(yd,{ref:t,...n})})}),yd=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,a=Pe(or,r),i=Us(or,r),{onThumbPositionChange:l}=i,c=re(t,p=>i.onThumbChange(p)),d=u.useRef(void 0),m=vr(()=>{d.current&&(d.current(),d.current=void 0)},100);return u.useEffect(()=>{const p=a.viewport;if(p){const f=()=>{if(m(),!d.current){const x=Cd(p,l);d.current=x,l()}};return l(),p.addEventListener("scroll",f),()=>p.removeEventListener("scroll",f)}},[a.viewport,m,l]),o.jsx(Q.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Z(e.onPointerDownCapture,p=>{const x=p.target.getBoundingClientRect(),g=p.clientX-x.left,h=p.clientY-x.top;i.onThumbPointerDown({x:g,y:h})}),onPointerUp:Z(e.onPointerUp,i.onThumbPointerUp)})});qs.displayName=or;var zo="ScrollAreaCorner",Xs=u.forwardRef((e,t)=>{const r=Pe(zo,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?o.jsx(wd,{...e,ref:t}):null});Xs.displayName=zo;var wd=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=Pe(zo,r),[a,i]=u.useState(0),[l,c]=u.useState(0),d=!!(a&&l);return yt(s.scrollbarX,()=>{var p;const m=((p=s.scrollbarX)==null?void 0:p.offsetHeight)||0;s.onCornerHeightChange(m),c(m)}),yt(s.scrollbarY,()=>{var p;const m=((p=s.scrollbarY)==null?void 0:p.offsetWidth)||0;s.onCornerWidthChange(m),i(m)}),d?o.jsx(Q.div,{...n,ref:t,style:{width:a,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function nr(e){return e?parseInt(e,10):0}function Ys(e,t){const r=e/t;return isNaN(r)?0:r}function gr(e){const t=Ys(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Nd(e,t,r,n="ltr"){const s=gr(r),a=s/2,i=t||a,l=s-i,c=r.scrollbar.paddingStart+i,d=r.scrollbar.size-r.scrollbar.paddingEnd-l,m=r.content-r.viewport,p=n==="ltr"?[0,m]:[m*-1,0];return Zs([c,d],p)(e)}function Cn(e,t,r="ltr"){const n=gr(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-s,i=t.content-t.viewport,l=a-n,c=r==="ltr"?[0,i]:[i*-1,0],d=Ot(e,c);return Zs([0,i],[0,l])(d)}function Zs(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 Ks(e,t){return e>0&&e<t}var Cd=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return(function s(){const a={left:e.scrollLeft,top:e.scrollTop},i=r.left!==a.left,l=r.top!==a.top;(i||l)&&t(),r=a,n=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(n)};function vr(e,t){const r=ge(e),n=u.useRef(0);return u.useEffect(()=>()=>window.clearTimeout(n.current),[]),u.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function yt(e,t){const r=ge(t);he(()=>{let n=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(n),s.unobserve(e)}}},[e,r])}var Js=Vs,jd=Ws,Sd=Xs;const br=u.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Js,{ref:n,className:U("relative overflow-hidden",e),...r,children:[o.jsx(jd,{className:"h-full w-full rounded-[inherit]",children:t}),o.jsx(Qs,{}),o.jsx(Sd,{})]}));br.displayName=Js.displayName;const Qs=u.forwardRef(({className:e,orientation:t="vertical",...r},n)=>o.jsx($o,{ref:n,orientation:t,className:U("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(qs,{className:"relative flex-1 rounded-full bg-border"})}));Qs.displayName=$o.displayName;var Pd=u[" useId ".trim().toString()]||(()=>{}),Rd=0;function Ke(e){const[t,r]=u.useState(Pd());return he(()=>{r(n=>n??String(Rd++))},[e]),t?`radix-${t}`:""}function Ed(e,t=globalThis==null?void 0:globalThis.document){const r=ge(e);u.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Ad="DismissableLayer",so="dismissableLayer.update",kd="dismissableLayer.pointerDownOutside",Td="dismissableLayer.focusOutside",jn,ea=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$t=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:i,onDismiss:l,...c}=e,d=u.useContext(ea),[m,p]=u.useState(null),f=(m==null?void 0:m.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=u.useState({}),g=re(t,P=>p(P)),h=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=h.indexOf(v),w=m?h.indexOf(m):-1,N=d.layersWithOutsidePointerEventsDisabled.size>0,C=w>=b,j=Od(P=>{const y=P.target,E=[...d.branches].some(I=>I.contains(y));!C||E||(s==null||s(P),i==null||i(P),P.defaultPrevented||l==null||l())},f),S=_d(P=>{const y=P.target;[...d.branches].some(I=>I.contains(y))||(a==null||a(P),i==null||i(P),P.defaultPrevented||l==null||l())},f);return Ed(P=>{w===d.layers.size-1&&(n==null||n(P),!P.defaultPrevented&&l&&(P.preventDefault(),l()))},f),u.useEffect(()=>{if(m)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(jn=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(m)),d.layers.add(m),Sn(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=jn)}},[m,f,r,d]),u.useEffect(()=>()=>{m&&(d.layers.delete(m),d.layersWithOutsidePointerEventsDisabled.delete(m),Sn())},[m,d]),u.useEffect(()=>{const P=()=>x({});return document.addEventListener(so,P),()=>document.removeEventListener(so,P)},[]),o.jsx(Q.div,{...c,ref:g,style:{pointerEvents:N?C?"auto":"none":void 0,...e.style},onFocusCapture:Z(e.onFocusCapture,S.onFocusCapture),onBlurCapture:Z(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Z(e.onPointerDownCapture,j.onPointerDownCapture)})});$t.displayName=Ad;var Id="DismissableLayerBranch",Ld=u.forwardRef((e,t)=>{const r=u.useContext(ea),n=u.useRef(null),s=re(t,n);return u.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),o.jsx(Q.div,{...e,ref:s})});Ld.displayName=Id;function Od(e,t=globalThis==null?void 0:globalThis.document){const r=ge(e),n=u.useRef(!1),s=u.useRef(()=>{});return u.useEffect(()=>{const a=l=>{if(l.target&&!n.current){let c=function(){ta(kd,r,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function _d(e,t=globalThis==null?void 0:globalThis.document){const r=ge(e),n=u.useRef(!1);return u.useEffect(()=>{const s=a=>{a.target&&!n.current&&ta(Td,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Sn(){const e=new CustomEvent(so);document.dispatchEvent(e)}function ta(e,t,r,{discrete:n}){const s=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?ad(s,a):s.dispatchEvent(a)}var Gr="focusScope.autoFocusOnMount",qr="focusScope.autoFocusOnUnmount",Pn={bubbles:!1,cancelable:!0},Dd="FocusScope",yr=u.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...i}=e,[l,c]=u.useState(null),d=ge(s),m=ge(a),p=u.useRef(null),f=re(t,h=>c(h)),x=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(n){let h=function(N){if(x.paused||!l)return;const C=N.target;l.contains(C)?p.current=C:Xe(p.current,{select:!0})},v=function(N){if(x.paused||!l)return;const C=N.relatedTarget;C!==null&&(l.contains(C)||Xe(p.current,{select:!0}))},b=function(N){if(document.activeElement===document.body)for(const j of N)j.removedNodes.length>0&&Xe(l)};document.addEventListener("focusin",h),document.addEventListener("focusout",v);const w=new MutationObserver(b);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",v),w.disconnect()}}},[n,l,x.paused]),u.useEffect(()=>{if(l){En.add(x);const h=document.activeElement;if(!l.contains(h)){const b=new CustomEvent(Gr,Pn);l.addEventListener(Gr,d),l.dispatchEvent(b),b.defaultPrevented||(Md(Bd(ra(l)),{select:!0}),document.activeElement===h&&Xe(l))}return()=>{l.removeEventListener(Gr,d),setTimeout(()=>{const b=new CustomEvent(qr,Pn);l.addEventListener(qr,m),l.dispatchEvent(b),b.defaultPrevented||Xe(h??document.body,{select:!0}),l.removeEventListener(qr,m),En.remove(x)},0)}}},[l,d,m,x]);const g=u.useCallback(h=>{if(!r&&!n||x.paused)return;const v=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(v&&b){const w=h.currentTarget,[N,C]=$d(w);N&&C?!h.shiftKey&&b===C?(h.preventDefault(),r&&Xe(N,{select:!0})):h.shiftKey&&b===N&&(h.preventDefault(),r&&Xe(C,{select:!0})):b===w&&h.preventDefault()}},[r,n,x.paused]);return o.jsx(Q.div,{tabIndex:-1,...i,ref:f,onKeyDown:g})});yr.displayName=Dd;function Md(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Xe(n,{select:t}),document.activeElement!==r)return}function $d(e){const t=ra(e),r=Rn(t,e),n=Rn(t.reverse(),e);return[r,n]}function ra(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Rn(e,t){for(const r of e)if(!Fd(r,{upTo:t}))return r}function Fd(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 zd(e){return e instanceof HTMLInputElement&&"select"in e}function Xe(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&zd(e)&&t&&e.select()}}var En=Vd();function Vd(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=An(e,t),e.unshift(t)},remove(t){var r;e=An(e,t),(r=e[0])==null||r.resume()}}}function An(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Bd(e){return e.filter(t=>t.tagName!=="A")}var Wd="Portal",wr=u.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[s,a]=u.useState(!1);he(()=>a(!0),[]);const i=r||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return i?So.createPortal(o.jsx(Q.div,{...n,ref:t}),i):null});wr.displayName=Wd;var Xr=0;function Vo(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??kn()),document.body.insertAdjacentElement("beforeend",e[1]??kn()),Xr++,()=>{Xr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Xr--}},[])}function kn(){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 Ie=function(){return Ie=Object.assign||function(t){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Ie.apply(this,arguments)};function oa(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 s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}function Hd(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var Jt="right-scroll-bar-position",Qt="width-before-scroll-bar",Ud="with-scroll-bars-hidden",Gd="--removed-body-scroll-bar-size";function Yr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function qd(e,t){var r=_.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=t,r.facade}var Xd=typeof window<"u"?u.useLayoutEffect:u.useEffect,Tn=new WeakMap;function Yd(e,t){var r=qd(null,function(n){return e.forEach(function(s){return Yr(s,n)})});return Xd(function(){var n=Tn.get(r);if(n){var s=new Set(n),a=new Set(e),i=r.current;s.forEach(function(l){a.has(l)||Yr(l,null)}),a.forEach(function(l){s.has(l)||Yr(l,i)})}Tn.set(r,e)},[e]),r}function Zd(e){return e}function Kd(e,t){t===void 0&&(t=Zd);var r=[],n=!1,s={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(a){var i=t(a,n);return r.push(i),function(){r=r.filter(function(l){return l!==i})}},assignSyncMedium:function(a){for(n=!0;r.length;){var i=r;r=[],i.forEach(a)}r={push:function(l){return a(l)},filter:function(){return r}}},assignMedium:function(a){n=!0;var i=[];if(r.length){var l=r;r=[],l.forEach(a),i=r}var c=function(){var m=i;i=[],m.forEach(a)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(m){i.push(m),d()},filter:function(m){return i=i.filter(m),r}}}};return s}function Jd(e){e===void 0&&(e={});var t=Kd(null);return t.options=Ie({async:!0,ssr:!1},e),t}var na=function(e){var t=e.sideCar,r=oa(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 u.createElement(n,Ie({},r))};na.isSideCarExport=!0;function Qd(e,t){return e.useMedium(t),na}var sa=Jd(),Zr=function(){},Nr=u.forwardRef(function(e,t){var r=u.useRef(null),n=u.useState({onScrollCapture:Zr,onWheelCapture:Zr,onTouchMoveCapture:Zr}),s=n[0],a=n[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,m=e.enabled,p=e.shards,f=e.sideCar,x=e.noRelative,g=e.noIsolation,h=e.inert,v=e.allowPinchZoom,b=e.as,w=b===void 0?"div":b,N=e.gapMode,C=oa(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=f,S=Yd([r,t]),P=Ie(Ie({},C),s);return u.createElement(u.Fragment,null,m&&u.createElement(j,{sideCar:sa,removeScrollBar:d,shards:p,noRelative:x,noIsolation:g,inert:h,setCallbacks:a,allowPinchZoom:!!v,lockRef:r,gapMode:N}),i?u.cloneElement(u.Children.only(l),Ie(Ie({},P),{ref:S})):u.createElement(w,Ie({},P,{className:c,ref:S}),l))});Nr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Nr.classNames={fullWidth:Qt,zeroRight:Jt};var eu=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function tu(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=eu();return t&&e.setAttribute("nonce",t),e}function ru(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ou(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var nu=function(){var e=0,t=null;return{add:function(r){e==0&&(t=tu())&&(ru(t,r),ou(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},su=function(){var e=nu();return function(t,r){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},aa=function(){var e=su(),t=function(r){var n=r.styles,s=r.dynamic;return e(n,s),null};return t},au={left:0,top:0,right:0,gap:0},Kr=function(e){return parseInt(e||"",10)||0},iu=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Kr(r),Kr(n),Kr(s)]},lu=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return au;var t=iu(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])}},cu=aa(),gt="data-scroll-locked",du=function(e,t,r,n){var s=e.left,a=e.top,i=e.right,l=e.gap;return r===void 0&&(r="margin"),`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),_=require("react"),k=require("lucide-react"),de=require("@schema-forms-data/core"),So=require("react-dom"),Ye=require("@schema-forms-data/templates"),Fe=require("@dnd-kit/sortable"),Mt=require("@dnd-kit/utilities"),jt=require("@dnd-kit/core");function Po(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 u=Po(_),Lt=Po(k),fr=Po(So),at=[{component:"texto",label:"Texto",icon:k.Type,group:"texto"},{component:"textarea",label:"Área de texto",icon:k.AlignLeft,group:"texto"},{component:"number",label:"Número",icon:k.Hash,group:"texto"},{component:"email",label:"E-mail",icon:k.Mail,group:"texto"},{component:"password",label:"Senha",icon:k.Lock,group:"texto"},{component:"select",label:"Seleção",icon:k.ChevronDown,group:"selecao"},{component:"autocomplete",label:"Autocomplete",icon:k.Search,group:"selecao"},{component:"radio",label:"Radio",icon:k.CircleDot,group:"selecao"},{component:"checkbox",label:"Checkbox",icon:k.CheckSquare,group:"selecao"},{component:"checkbox_group",label:"Grupo de checkboxes",icon:k.ListChecks,group:"selecao"},{component:"switch",label:"Switch (toggle)",icon:k.ToggleLeft,group:"selecao"},{component:"slider",label:"Slider",icon:k.SlidersHorizontal,group:"range"},{component:"rating",label:"Avaliação (estrelas)",icon:k.Star,group:"range"},{component:"color",label:"Cor",icon:k.Palette,group:"range"},{component:"date",label:"Data",icon:k.Calendar,group:"data"},{component:"datetime",label:"Data e hora",icon:k.Clock,group:"data"},{component:"time",label:"Horário",icon:k.Timer,group:"data"},{component:"date_range",label:"Período",icon:k.CalendarRange,group:"data"},{component:"telefone",label:"Telefone",icon:k.Phone,group:"contato"},{component:"cpf",label:"CPF",icon:k.CreditCard,group:"contato"},{component:"cep",label:"CEP",icon:k.MapPin,group:"contato"},{component:"file",label:"Arquivo",icon:k.Upload,group:"outros"},{component:"hidden",label:"Oculto",icon:k.EyeOff,group:"outros"},{component:"field_array",label:"Lista de itens",icon:k.List,group:"outros"},{component:"terms",label:"Termos e condições",icon:k.ScrollText,group:"outros"},{component:"sub_form",label:"Sub-formulário",icon:k.LayoutList,group:"outros"}],ss=[{component:"step",label:"Step",icon:k.Layers,color:"border-primary/40 bg-primary/5"},{component:"container",label:"Container",icon:k.BoxSelect,color:"border-blue-500/40 bg-blue-500/5"}],Ro=[{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"}],me=e=>e.startsWith("step-")||e==="step"?"step":e.startsWith("container-")||e==="container"?"container":"field",zl=e=>at.find(t=>t.component===e),as=e=>{const t=at.map(n=>n.component).filter(n=>n.includes("_"));for(const n of t)if(e.startsWith(n))return at.find(s=>s.component===n);const r=e.split("-")[0];return at.find(n=>n.component===r)},is=_.createContext(null),Vl=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]},Wr=(e,t)=>{const r=t||Vl(e),n=r==="step",s=r==="container",a=r==="field_array";return{label:n?"Novo Step":s?"Novo Container":a?"Lista de itens":r||e,name:e,fieldType:r||"texto",required:!1,columns:2,tamanho:s||a?12:n?void 0:6,showLabel:s?!0:void 0,itemLabel:a?"Item":void 0}},Hr=e=>({containers:JSON.parse(JSON.stringify(e.containers)),configs:JSON.parse(JSON.stringify(e.configs))}),ls=(e,t)=>{const r=[e],n=t[e];if(n!=null&&n.children)for(const s of n.children)r.push(...ls(s,t));return r},cs=(e,t)=>{for(const[r,n]of Object.entries(t))if(n.children.includes(e))return r;return null},Bl=({children:e,initialConfigs:t,initialContainers:r,initialTemplateId:n,schemaId:s,uploadTermsPdf:a})=>{const[i,l]=_.useState({selectedId:null,configs:t||{},showPreview:!1,containers:r??{root:{children:[]}},previewTemplateId:n||"moderno"}),[c,d]=_.useState(null),[m,p]=_.useState(null),f=_.useRef([]),x=_.useRef([]),g=R=>{f.current=[...f.current.slice(-49),Hr(R)],x.current=[]},h=_.useCallback(()=>{l(R=>(g(R),{...R}))},[]),v=_.useCallback(()=>{f.current.length!==0&&l(R=>{x.current=[...x.current,Hr(R)];const T=f.current.pop();return{...R,containers:T.containers,configs:T.configs}})},[]),b=_.useCallback(()=>{x.current.length!==0&&l(R=>{f.current=[...f.current,Hr(R)];const T=x.current.pop();return{...R,containers:T.containers,configs:T.configs}})},[]);_.useEffect(()=>{const R=T=>{const E=T.metaKey||T.ctrlKey;E&&T.key==="z"&&!T.shiftKey&&(T.preventDefault(),v()),E&&T.key==="z"&&T.shiftKey&&(T.preventDefault(),b()),E&&T.key==="y"&&(T.preventDefault(),b())};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[v,b]);const w=_.useCallback(R=>i.configs[R]??Wr(R),[i.configs]),C=_.useCallback(()=>{const R=[],T=E=>{var O;const z=((O=i.containers[E])==null?void 0:O.children)??[];for(const q of z)me(q)==="field"?R.push(q):i.containers[q]&&T(q)};return T("root"),R},[i.containers]),N=_.useCallback(R=>{l(T=>({...T,selectedId:R}))},[]),j=_.useCallback(R=>{l(T=>({...T,showPreview:R}))},[]),S=_.useCallback(R=>{l(T=>({...T,previewTemplateId:R}))},[]),P=_.useCallback((R,T)=>{l(E=>({...E,configs:{...E.configs,[R]:{...E.configs[R]??Wr(R),...T}}}))},[]),y=_.useCallback((R,T,E)=>{const z=`${R}-${de.v4Fallback()}`,O=me(z);return l(q=>{var X;g(q);const se={...q.containers};(O==="step"||O==="container"||R==="field_array")&&(se[z]={children:[]});const ie=[...((X=se[T])==null?void 0:X.children)??[]];return E!==void 0&&E>=0?ie.splice(E,0,z):ie.push(z),se[T]={children:ie},{...q,containers:se,configs:{...q.configs,[z]:Wr(z,R)},selectedId:z}}),z},[]),A=_.useCallback((R,T)=>{const E=`container-${de.v4Fallback()}`;return l(z=>{var X,ne,ae;g(z);const O={...z.containers},q={...z.configs},se=[];for(const $ of R.containerTemplate.campos){const oe=$.locked?$.id:`${String($.tipo).toLowerCase()}-${de.v4Fallback()}`;if(se.push(oe),q[oe]={label:$.label,name:$.locked?$.id:$.nome,fieldType:$.tipo,required:$.obrigatorio||!1,placeholder:$.placeholder,hint:$.hint,tamanho:$.tamanho||6,inicioColuna:$.inicioColuna,defaultValue:$.defaultValue!=null?String($.defaultValue):void 0,locked:$.locked||!1,options:(X=$.opcoes)==null?void 0:X.map(K=>({value:K.valor,label:K.label})),...$.tipo==="field_array"&&{itemLabel:$.itemLabel,minItems:$.minItems,maxItems:$.maxItems,addLabel:$.addLabel}},$.tipo==="field_array"){const K=[];for(const J of $.subFields??[]){const G=`${String(J.tipo).toLowerCase()}-${de.v4Fallback()}`;K.push(G),q[G]={label:J.label,name:J.nome,fieldType:J.tipo,required:J.obrigatorio||!1,placeholder:J.placeholder,hint:J.hint,tamanho:J.tamanho||6,inicioColuna:J.inicioColuna,options:(ne=J.opcoes)==null?void 0:ne.map(ee=>({value:ee.valor,label:ee.label}))}}O[oe]={children:K}}}O[E]={children:se},q[E]={label:R.containerTemplate.titulo||R.name,description:R.containerTemplate.descricao,icone:R.containerTemplate.icone,tamanho:R.containerTemplate.tamanho||12,inicioColuna:R.containerTemplate.inicioColuna,showLabel:!0};const ie=[...((ae=O[T])==null?void 0:ae.children)??[]];return ie.push(E),O[T]={children:ie},{...z,containers:O,configs:q,selectedId:E}}),E},[]),I=_.useCallback(R=>{const T=[];return l(E=>{var q,se,ie;g(E);const z={...E.containers},O={...E.configs};for(const X of R.steps){const ne=`step-${de.v4Fallback()}`;T.push(ne);const ae=[];for(const oe of X.containers){const K=`container-${de.v4Fallback()}`;ae.push(K);const J=[];for(const G of oe.campos){const ee=G.locked?G.id:`${String(G.tipo).toLowerCase()}-${de.v4Fallback()}`;if(J.push(ee),O[ee]={label:G.label,name:G.locked?G.id:G.nome,fieldType:G.tipo,required:G.obrigatorio||!1,placeholder:G.placeholder,hint:G.hint,tamanho:G.tamanho||12,inicioColuna:G.inicioColuna,defaultValue:G.defaultValue!=null?String(G.defaultValue):void 0,locked:G.locked||!1,options:(q=G.opcoes)==null?void 0:q.map(ue=>({value:ue.valor,label:ue.label})),...G.tipo==="field_array"&&{itemLabel:G.itemLabel,minItems:G.minItems,maxItems:G.maxItems,addLabel:G.addLabel}},G.tipo==="field_array"){const ue=[];for(const ce of G.subFields??[]){const He=`${String(ce.tipo).toLowerCase()}-${de.v4Fallback()}`;ue.push(He),O[He]={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:(se=ce.opcoes)==null?void 0:se.map(Ue=>({value:Ue.valor,label:Ue.label}))}}z[ee]={children:ue}}}z[K]={children:J},O[K]={label:oe.titulo,description:oe.descricao,icone:oe.icone,tamanho:oe.tamanho||12,showLabel:!0}}z[ne]={children:ae},O[ne]={label:X.titulo,description:X.descricao,icone:X.icone};const $=[...((ie=z.root)==null?void 0:ie.children)??[],ne];z.root={children:$}}return{...E,containers:z,configs:O,selectedId:T[0]??E.selectedId}}),T},[]),L=_.useCallback((R,T,E,z)=>{l(O=>{var ne,ae;g(O);const q={...O.containers},se=(((ne=q[T])==null?void 0:ne.children)??[]).filter($=>$!==R);q[T]={children:se};const ie=[...(((ae=q[E])==null?void 0:ae.children)??[]).filter($=>$!==R)],X=Math.max(0,Math.min(z,ie.length));return ie.splice(X,0,R),q[E]={children:ie},{...O,containers:q}})},[]),D=_.useCallback((R,T)=>{l(E=>(g(E),{...E,containers:{...E.containers,[R]:{children:T}}}))},[]),F=_.useCallback(R=>{l(T=>{g(T);const E=ls(R,T.containers),z={};for(const[q,se]of Object.entries(T.containers))E.includes(q)||(z[q]={children:se.children.filter(ie=>ie!==R)});const O={...T.configs};for(const q of E)delete O[q];return{...T,containers:z,configs:O,selectedId:E.includes(T.selectedId??"")?null:T.selectedId}})},[]),M=_.useCallback((R,T)=>{l(E=>{const z=cs(R,E.containers);if(!z)return E;const O=[...E.containers[z].children],q=O.indexOf(R),se=T==="up"?q-1:q+1;return se<0||se>=O.length?E:([O[q],O[se]]=[O[se],O[q]],{...E,containers:{...E.containers,[z]:{children:O}}})})},[]),V=_.useCallback((R,T)=>{h(),M(R,T)},[M,h]);return o.jsx(is.Provider,{value:{selectedId:i.selectedId,configs:i.configs,showPreview:i.showPreview,containers:i.containers,positionDrag:c,reorderDrag:m,canUndo:f.current.length>0,canRedo:x.current.length>0,schemaId:s,uploadTermsPdf:a,previewTemplateId:i.previewTemplateId,setPreviewTemplateId:S,getConfig:w,getAllFieldIds:C,setSelected:N,updateConfig:P,setShowPreview:j,addItem:y,addPresetBlock:A,addPresetStepBlock:I,moveCanvasItem:L,reorderInContainer:D,removeItem:F,moveItem:V,moveItemNoSnapshot:M,setPositionDrag:d,setReorderDrag:p,undo:v,redo:b,pushSnapshot:h},children:e})},ke=()=>{const e=_.useContext(is);if(!e)throw new Error("useBuilder must be inside BuilderProvider");return e};function pn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Eo(...e){return t=>{let r=!1;const n=e.map(s=>{const a=pn(s,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let s=0;s<n.length;s++){const a=n[s];typeof a=="function"?a():pn(e[s],null)}}}}function re(...e){return u.useCallback(Eo(...e),e)}var Wl=Symbol.for("react.lazy"),tr=u[" use ".trim().toString()];function Hl(e){return typeof e=="object"&&e!==null&&"then"in e}function ds(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Wl&&"_payload"in e&&Hl(e._payload)}function us(e){const t=Gl(e),r=u.forwardRef((n,s)=>{let{children:a,...i}=n;ds(a)&&typeof tr=="function"&&(a=tr(a._payload));const l=u.Children.toArray(a),c=l.find(Xl);if(c){const d=c.props.children,m=l.map(p=>p===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:p);return o.jsx(t,{...i,ref:s,children:u.isValidElement(d)?u.cloneElement(d,void 0,m):null})}return o.jsx(t,{...i,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}var Ul=us("Slot");function Gl(e){const t=u.forwardRef((r,n)=>{let{children:s,...a}=r;if(ds(s)&&typeof tr=="function"&&(s=tr(s._payload)),u.isValidElement(s)){const i=Zl(s),l=Yl(a,s.props);return s.type!==u.Fragment&&(l.ref=n?Eo(n,i):i),u.cloneElement(s,l)}return u.Children.count(s)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ql=Symbol("radix.slottable");function Xl(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ql}function Yl(e,t){const r={...t};for(const n in t){const s=e[n],a=t[n];/^on[A-Z]/.test(n)?s&&a?r[n]=(...l)=>{const c=a(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...a}:n==="className"&&(r[n]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function Zl(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Kl=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],hr=Kl.reduce((e,t)=>{const r=us(`Primitive.${t}`),n=u.forwardRef((s,a)=>{const{asChild:i,...l}=s,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Jl="Separator",fn="horizontal",Ql=["horizontal","vertical"],ms=u.forwardRef((e,t)=>{const{decorative:r,orientation:n=fn,...s}=e,a=ec(n)?n:fn,l=r?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return o.jsx(hr.div,{"data-orientation":a,...l,...s,ref:t})});ms.displayName=Jl;function ec(e){return Ql.includes(e)}var ps=ms;function fs(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=fs(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function hs(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=fs(e))&&(n&&(n+=" "),n+=t);return n}const tc=(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},rc=(e,t)=>({classGroupId:e,validator:t}),xs=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),rr="-",hn=[],oc="arbitrary..",nc=e=>{const t=ac(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return sc(i);const l=i.split(rr),c=l[0]===""&&l.length>1?1:0;return gs(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=n[i],d=r[i];return c?d?tc(d,c):c:d||hn}return r[i]||hn}}},gs=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const s=e[t],a=r.nextPart.get(s);if(a){const d=gs(e,t+1,a);if(d)return d}const i=r.validators;if(i===null)return;const l=t===0?e.join(rr):e.slice(t).join(rr),c=i.length;for(let d=0;d<c;d++){const m=i[d];if(m.validator(l))return m.classGroupId}},sc=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?oc+n:void 0})(),ac=e=>{const{theme:t,classGroups:r}=e;return ic(r,t)},ic=(e,t)=>{const r=xs();for(const n in e){const s=e[n];Ao(s,r,n,t)}return r},Ao=(e,t,r,n)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];lc(i,t,r,n)}},lc=(e,t,r,n)=>{if(typeof e=="string"){cc(e,t,r);return}if(typeof e=="function"){dc(e,t,r,n);return}uc(e,t,r,n)},cc=(e,t,r)=>{const n=e===""?t:vs(t,e);n.classGroupId=r},dc=(e,t,r,n)=>{if(mc(e)){Ao(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(rc(r,e))},uc=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[l,c]=s[i];Ao(c,vs(t,l),r,n)}},vs=(e,t)=>{let r=e;const n=t.split(rr),s=n.length;for(let a=0;a<s;a++){const i=n[a];let l=r.nextPart.get(i);l||(l=xs(),r.nextPart.set(i,l)),r=l}return r},mc=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,pc=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const s=(a,i)=>{r[a]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let i=r[a];if(i!==void 0)return i;if((i=n[a])!==void 0)return s(a,i),i},set(a,i){a in r?r[a]=i:s(a,i)}}},no="!",xn=":",fc=[],gn=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),hc=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let i=0,l=0,c=0,d;const m=s.length;for(let h=0;h<m;h++){const v=s[h];if(i===0&&l===0){if(v===xn){a.push(s.slice(c,h)),c=h+1;continue}if(v==="/"){d=h;continue}}v==="["?i++:v==="]"?i--:v==="("?l++:v===")"&&l--}const p=a.length===0?s:s.slice(c);let f=p,x=!1;p.endsWith(no)?(f=p.slice(0,-1),x=!0):p.startsWith(no)&&(f=p.slice(1),x=!0);const g=d&&d>c?d-c:void 0;return gn(a,x,f,g)};if(t){const s=t+xn,a=n;n=i=>i.startsWith(s)?a(i.slice(s.length)):gn(fc,!1,i,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},xc=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let a=0;a<r.length;a++){const i=r[a],l=i[0]==="[",c=t.has(i);l||c?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(i)):s.push(i)}return s.length>0&&(s.sort(),n.push(...s)),n}},gc=e=>({cache:pc(e.cacheSize),parseClassName:hc(e),sortModifiers:xc(e),...nc(e)}),vc=/\s+/,bc=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],l=e.trim().split(vc);let c="";for(let d=l.length-1;d>=0;d-=1){const m=l[d],{isExternal:p,modifiers:f,hasImportantModifier:x,baseClassName:g,maybePostfixModifierPosition:h}=r(m);if(p){c=m+(c.length>0?" "+c:c);continue}let v=!!h,b=n(v?g.substring(0,h):g);if(!b){if(!v){c=m+(c.length>0?" "+c:c);continue}if(b=n(g),!b){c=m+(c.length>0?" "+c:c);continue}v=!1}const w=f.length===0?"":f.length===1?f[0]:a(f).join(":"),C=x?w+no:w,N=C+b;if(i.indexOf(N)>-1)continue;i.push(N);const j=s(b,v);for(let S=0;S<j.length;++S){const P=j[S];i.push(C+P)}c=m+(c.length>0?" "+c:c)}return c},yc=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=bs(r))&&(s&&(s+=" "),s+=n);return s},bs=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=bs(e[n]))&&(r&&(r+=" "),r+=t);return r},wc=(e,...t)=>{let r,n,s,a;const i=c=>{const d=t.reduce((m,p)=>p(m),e());return r=gc(d),n=r.cache.get,s=r.cache.set,a=l,l(c)},l=c=>{const d=n(c);if(d)return d;const m=bc(c,r);return s(c,m),m};return a=i,(...c)=>a(yc(...c))},Nc=[],fe=e=>{const t=r=>r[e]||Nc;return t.isThemeGetter=!0,t},ys=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ws=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Cc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,jc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Sc=/\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$/,Pc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Rc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ec=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ge=e=>Cc.test(e),te=e=>!!e&&!Number.isNaN(Number(e)),qe=e=>!!e&&Number.isInteger(Number(e)),Ur=e=>e.endsWith("%")&&te(e.slice(0,-1)),Me=e=>jc.test(e),Ns=()=>!0,Ac=e=>Sc.test(e)&&!Pc.test(e),ko=()=>!1,kc=e=>Rc.test(e),Tc=e=>Ec.test(e),Ic=e=>!W(e)&&!H(e),Lc=e=>et(e,Ss,ko),W=e=>ys.test(e),nt=e=>et(e,Ps,Ac),vn=e=>et(e,Vc,te),Oc=e=>et(e,Es,Ns),_c=e=>et(e,Rs,ko),bn=e=>et(e,Cs,ko),Dc=e=>et(e,js,Tc),Ht=e=>et(e,As,kc),H=e=>ws.test(e),Tt=e=>mt(e,Ps),Mc=e=>mt(e,Rs),yn=e=>mt(e,Cs),$c=e=>mt(e,Ss),Fc=e=>mt(e,js),Ut=e=>mt(e,As,!0),zc=e=>mt(e,Es,!0),et=(e,t,r)=>{const n=ys.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},mt=(e,t,r=!1)=>{const n=ws.exec(e);return n?n[1]?t(n[1]):r:!1},Cs=e=>e==="position"||e==="percentage",js=e=>e==="image"||e==="url",Ss=e=>e==="length"||e==="size"||e==="bg-size",Ps=e=>e==="length",Vc=e=>e==="number",Rs=e=>e==="family-name",Es=e=>e==="number"||e==="weight",As=e=>e==="shadow",Bc=()=>{const e=fe("color"),t=fe("font"),r=fe("text"),n=fe("font-weight"),s=fe("tracking"),a=fe("leading"),i=fe("breakpoint"),l=fe("container"),c=fe("spacing"),d=fe("radius"),m=fe("shadow"),p=fe("inset-shadow"),f=fe("text-shadow"),x=fe("drop-shadow"),g=fe("blur"),h=fe("perspective"),v=fe("aspect"),b=fe("ease"),w=fe("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...N(),H,W],S=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],y=()=>[H,W,c],A=()=>[Ge,"full","auto",...y()],I=()=>[qe,"none","subgrid",H,W],L=()=>["auto",{span:["full",qe,H,W]},qe,H,W],D=()=>[qe,"auto",H,W],F=()=>["auto","min","max","fr",H,W],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],R=()=>["auto",...y()],T=()=>[Ge,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...y()],E=()=>[Ge,"screen","full","dvw","lvw","svw","min","max","fit",...y()],z=()=>[Ge,"screen","full","lh","dvh","lvh","svh","min","max","fit",...y()],O=()=>[e,H,W],q=()=>[...N(),yn,bn,{position:[H,W]}],se=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ie=()=>["auto","cover","contain",$c,Lc,{size:[H,W]}],X=()=>[Ur,Tt,nt],ne=()=>["","none","full",d,H,W],ae=()=>["",te,Tt,nt],$=()=>["solid","dashed","dotted","double"],oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[te,Ur,yn,bn],J=()=>["","none",g,H,W],G=()=>["none",te,H,W],ee=()=>["none",te,H,W],ue=()=>[te,H,W],ce=()=>[Ge,"full",...y()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Me],breakpoint:[Me],color:[Ns],container:[Me],"drop-shadow":[Me],ease:["in","out","in-out"],font:[Ic],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Me],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Me],shadow:[Me],spacing:["px",te],text:[Me],"text-shadow":[Me],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ge,W,H,v]}],container:["container"],columns:[{columns:[te,W,H,l]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"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:j()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{"inset-s":A(),start:A()}],end:[{"inset-e":A(),end:A()}],"inset-bs":[{"inset-bs":A()}],"inset-be":[{"inset-be":A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[qe,"auto",H,W]}],basis:[{basis:[Ge,"full","auto",l,...y()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[te,Ge,"auto","initial","none",W]}],grow:[{grow:["",te,H,W]}],shrink:[{shrink:["",te,H,W]}],order:[{order:[qe,"first","last","none",H,W]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:y()}],"gap-x":[{"gap-x":y()}],"gap-y":[{"gap-y":y()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:y()}],px:[{px:y()}],py:[{py:y()}],ps:[{ps:y()}],pe:[{pe:y()}],pbs:[{pbs:y()}],pbe:[{pbe:y()}],pt:[{pt:y()}],pr:[{pr:y()}],pb:[{pb:y()}],pl:[{pl:y()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mbs:[{mbs:R()}],mbe:[{mbe:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":y()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":y()}],"space-y-reverse":["space-y-reverse"],size:[{size:T()}],"inline-size":[{inline:["auto",...E()]}],"min-inline-size":[{"min-inline":["auto",...E()]}],"max-inline-size":[{"max-inline":["none",...E()]}],"block-size":[{block:["auto",...z()]}],"min-block-size":[{"min-block":["auto",...z()]}],"max-block-size":[{"max-block":["none",...z()]}],w:[{w:[l,"screen",...T()]}],"min-w":[{"min-w":[l,"screen","none",...T()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...T()]}],h:[{h:["screen","lh",...T()]}],"min-h":[{"min-h":["screen","lh","none",...T()]}],"max-h":[{"max-h":["screen","lh",...T()]}],"font-size":[{text:["base",r,Tt,nt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,zc,Oc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ur,W]}],"font-family":[{font:[Mc,_c,t]}],"font-features":[{"font-features":[W]}],"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:[s,H,W]}],"line-clamp":[{"line-clamp":[te,"none",H,vn]}],leading:[{leading:[a,...y()]}],"list-image":[{"list-image":["none",H,W]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",H,W]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:[te,"from-font","auto",H,nt]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[te,"auto",H,W]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:y()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",H,W]}],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",H,W]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:se()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qe,H,W],radial:["",H,W],conic:[qe,H,W]},Fc,Dc]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:X()}],"gradient-via-pos":[{via:X()}],"gradient-to-pos":[{to:X()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],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:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...$(),"hidden","none"]}],"divide-style":[{divide:[...$(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-bs":[{"border-bs":O()}],"border-color-be":[{"border-be":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...$(),"none","hidden"]}],"outline-offset":[{"outline-offset":[te,H,W]}],"outline-w":[{outline:["",te,Tt,nt]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",m,Ut,Ht]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",p,Ut,Ht]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[te,nt]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",f,Ut,Ht]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[te,H,W]}],"mix-blend":[{"mix-blend":[...oe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":oe()}],"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":[te]}],"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":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"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":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"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":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"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":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"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":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"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":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"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":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[H,W]}],"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":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[te]}],"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":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:se()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",H,W]}],filter:[{filter:["","none",H,W]}],blur:[{blur:J()}],brightness:[{brightness:[te,H,W]}],contrast:[{contrast:[te,H,W]}],"drop-shadow":[{"drop-shadow":["","none",x,Ut,Ht]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",te,H,W]}],"hue-rotate":[{"hue-rotate":[te,H,W]}],invert:[{invert:["",te,H,W]}],saturate:[{saturate:[te,H,W]}],sepia:[{sepia:["",te,H,W]}],"backdrop-filter":[{"backdrop-filter":["","none",H,W]}],"backdrop-blur":[{"backdrop-blur":J()}],"backdrop-brightness":[{"backdrop-brightness":[te,H,W]}],"backdrop-contrast":[{"backdrop-contrast":[te,H,W]}],"backdrop-grayscale":[{"backdrop-grayscale":["",te,H,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[te,H,W]}],"backdrop-invert":[{"backdrop-invert":["",te,H,W]}],"backdrop-opacity":[{"backdrop-opacity":[te,H,W]}],"backdrop-saturate":[{"backdrop-saturate":[te,H,W]}],"backdrop-sepia":[{"backdrop-sepia":["",te,H,W]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":y()}],"border-spacing-x":[{"border-spacing-x":y()}],"border-spacing-y":[{"border-spacing-y":y()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",H,W]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[te,"initial",H,W]}],ease:[{ease:["linear","initial",b,H,W]}],delay:[{delay:[te,H,W]}],animate:[{animate:["none",w,H,W]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,H,W]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:G()}],"rotate-x":[{"rotate-x":G()}],"rotate-y":[{"rotate-y":G()}],"rotate-z":[{"rotate-z":G()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[H,W,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":["translate-none"],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"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",H,W]}],"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":y()}],"scroll-mx":[{"scroll-mx":y()}],"scroll-my":[{"scroll-my":y()}],"scroll-ms":[{"scroll-ms":y()}],"scroll-me":[{"scroll-me":y()}],"scroll-mbs":[{"scroll-mbs":y()}],"scroll-mbe":[{"scroll-mbe":y()}],"scroll-mt":[{"scroll-mt":y()}],"scroll-mr":[{"scroll-mr":y()}],"scroll-mb":[{"scroll-mb":y()}],"scroll-ml":[{"scroll-ml":y()}],"scroll-p":[{"scroll-p":y()}],"scroll-px":[{"scroll-px":y()}],"scroll-py":[{"scroll-py":y()}],"scroll-ps":[{"scroll-ps":y()}],"scroll-pe":[{"scroll-pe":y()}],"scroll-pbs":[{"scroll-pbs":y()}],"scroll-pbe":[{"scroll-pbe":y()}],"scroll-pt":[{"scroll-pt":y()}],"scroll-pr":[{"scroll-pr":y()}],"scroll-pb":[{"scroll-pb":y()}],"scroll-pl":[{"scroll-pl":y()}],"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",H,W]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[te,Tt,nt,vn]}],stroke:[{stroke:["none",...O()]}],"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"]}},Wc=wc(Bc);function U(...e){return Wc(hs(e))}const Ne=u.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>o.jsx(ps,{ref:s,decorative:r,orientation:t,className:U("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Ne.displayName=ps.displayName;const Y=u.forwardRef(({className:e,type:t,...r},n)=>o.jsx("input",{type:t,className:U("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}));Y.displayName="Input";var Hc="Label",ks=u.forwardRef((e,t)=>o.jsx(hr.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));ks.displayName=Hc;var Ts=ks;const wn=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Nn=hs,To=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return Nn(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(d=>{const m=r==null?void 0:r[d],p=a==null?void 0:a[d];if(m===null)return null;const f=wn(m)||wn(p);return s[d][f]}),l=r&&Object.entries(r).reduce((d,m)=>{let[p,f]=m;return f===void 0||(d[p]=f),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,m)=>{let{class:p,className:f,...x}=m;return Object.entries(x).every(g=>{let[h,v]=g;return Array.isArray(v)?v.includes({...a,...l}[h]):{...a,...l}[h]===v})?[...d,p,f]:d},[]);return Nn(e,i,c,r==null?void 0:r.class,r==null?void 0:r.className)},Uc=To("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),B=u.forwardRef(({className:e,...t},r)=>o.jsx(Ts,{ref:r,className:U(Uc(),e),...t}));B.displayName=Ts.displayName;function Gc(e,t){const r=u.createContext(t),n=a=>{const{children:i,...l}=a,c=u.useMemo(()=>l,Object.values(l));return o.jsx(r.Provider,{value:c,children:i})};n.displayName=e+"Provider";function s(a){const i=u.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[n,s]}function Be(e,t=[]){let r=[];function n(a,i){const l=u.createContext(i),c=r.length;r=[...r,i];const d=p=>{var b;const{scope:f,children:x,...g}=p,h=((b=f==null?void 0:f[e])==null?void 0:b[c])||l,v=u.useMemo(()=>g,Object.values(g));return o.jsx(h.Provider,{value:v,children:x})};d.displayName=a+"Provider";function m(p,f){var h;const x=((h=f==null?void 0:f[e])==null?void 0:h[c])||l,g=u.useContext(x);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[d,m]}const s=()=>{const a=r.map(i=>u.createContext(i));return function(l){const c=(l==null?void 0:l[e])||a;return u.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,qc(s,...t)]}function qc(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const i=n.reduce((l,{useScope:c,scopeName:d})=>{const p=c(a)[`__scope${d}`];return{...l,...p}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}function Z(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e==null||e(s),r===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}var he=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},Xc=u[" useInsertionEffect ".trim().toString()]||he;function it({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,a,i]=Yc({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:s;{const m=u.useRef(e!==void 0);u.useEffect(()=>{const p=m.current;p!==l&&console.warn(`${n} is changing from ${p?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),m.current=l},[l,n])}const d=u.useCallback(m=>{var p;if(l){const f=Zc(m)?m(e):m;f!==e&&((p=i.current)==null||p.call(i,f))}else a(m)},[l,e,a,i]);return[c,d]}function Yc({defaultProp:e,onChange:t}){const[r,n]=u.useState(e),s=u.useRef(r),a=u.useRef(t);return Xc(()=>{a.current=t},[t]),u.useEffect(()=>{var i;s.current!==r&&((i=a.current)==null||i.call(a,r),s.current=r)},[r,s]),[r,n,a]}function Zc(e){return typeof e=="function"}function Io(e){const t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Lo(e){const[t,r]=u.useState(void 0);return he(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let i,l;if("borderBoxSize"in a){const c=a.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 Kc(e,t){return u.useReducer((r,n)=>t[r][n]??r,e)}var Se=e=>{const{present:t,children:r}=e,n=Jc(t),s=typeof r=="function"?r({present:n.isPresent}):u.Children.only(r),a=re(n.ref,Qc(s));return typeof r=="function"||n.isPresent?u.cloneElement(s,{ref:a}):null};Se.displayName="Presence";function Jc(e){const[t,r]=u.useState(),n=u.useRef(null),s=u.useRef(e),a=u.useRef("none"),i=e?"mounted":"unmounted",[l,c]=Kc(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=Gt(n.current);a.current=l==="mounted"?d:"none"},[l]),he(()=>{const d=n.current,m=s.current;if(m!==e){const f=a.current,x=Gt(d);e?c("MOUNT"):x==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(m&&f!==x?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),he(()=>{if(t){let d;const m=t.ownerDocument.defaultView??window,p=x=>{const h=Gt(n.current).includes(CSS.escape(x.animationName));if(x.target===t&&h&&(c("ANIMATION_END"),!s.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",d=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},f=x=>{x.target===t&&(a.current=Gt(n.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{m.clearTimeout(d),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:u.useCallback(d=>{n.current=d?getComputedStyle(d):null,r(d)},[])}}function Gt(e){return(e==null?void 0:e.animationName)||"none"}function Qc(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function bt(e){const t=ed(e),r=u.forwardRef((n,s)=>{const{children:a,...i}=n,l=u.Children.toArray(a),c=l.find(rd);if(c){const d=c.props.children,m=l.map(p=>p===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:p);return o.jsx(t,{...i,ref:s,children:u.isValidElement(d)?u.cloneElement(d,void 0,m):null})}return o.jsx(t,{...i,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function ed(e){const t=u.forwardRef((r,n)=>{const{children:s,...a}=r;if(u.isValidElement(s)){const i=nd(s),l=od(a,s.props);return s.type!==u.Fragment&&(l.ref=n?Eo(n,i):i),u.cloneElement(s,l)}return u.Children.count(s)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Is=Symbol("radix.slottable");function td(e){const t=({children:r})=>o.jsx(o.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Is,t}function rd(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Is}function od(e,t){const r={...t};for(const n in t){const s=e[n],a=t[n];/^on[A-Z]/.test(n)?s&&a?r[n]=(...l)=>{const c=a(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...a}:n==="className"&&(r[n]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function nd(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var sd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Q=sd.reduce((e,t)=>{const r=bt(`Primitive.${t}`),n=u.forwardRef((s,a)=>{const{asChild:i,...l}=s,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function ad(e,t){e&&fr.flushSync(()=>e.dispatchEvent(t))}var xr="Checkbox",[id]=Be(xr),[ld,Oo]=id(xr);function cd(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:s,disabled:a,form:i,name:l,onCheckedChange:c,required:d,value:m="on",internal_do_not_use_render:p}=e,[f,x]=it({prop:r,defaultProp:s??!1,onChange:c,caller:xr}),[g,h]=u.useState(null),[v,b]=u.useState(null),w=u.useRef(!1),C=g?!!i||!!g.closest("form"):!0,N={checked:f,disabled:a,setChecked:x,control:g,setControl:h,name:l,form:i,value:m,hasConsumerStoppedPropagationRef:w,required:d,defaultChecked:Ze(s)?!1:s,isFormControl:C,bubbleInput:v,setBubbleInput:b};return o.jsx(ld,{scope:t,...N,children:dd(p)?p(N):n})}var Ls="CheckboxTrigger",Os=u.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},s)=>{const{control:a,value:i,disabled:l,checked:c,required:d,setControl:m,setChecked:p,hasConsumerStoppedPropagationRef:f,isFormControl:x,bubbleInput:g}=Oo(Ls,e),h=re(s,m),v=u.useRef(c);return u.useEffect(()=>{const b=a==null?void 0:a.form;if(b){const w=()=>p(v.current);return b.addEventListener("reset",w),()=>b.removeEventListener("reset",w)}},[a,p]),o.jsx(Q.button,{type:"button",role:"checkbox","aria-checked":Ze(c)?"mixed":c,"aria-required":d,"data-state":Fs(c),"data-disabled":l?"":void 0,disabled:l,value:i,...n,ref:h,onKeyDown:Z(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:Z(r,b=>{p(w=>Ze(w)?!0:!w),g&&x&&(f.current=b.isPropagationStopped(),f.current||b.stopPropagation())})})});Os.displayName=Ls;var _o=u.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:s,defaultChecked:a,required:i,disabled:l,value:c,onCheckedChange:d,form:m,...p}=e;return o.jsx(cd,{__scopeCheckbox:r,checked:s,defaultChecked:a,disabled:l,required:i,onCheckedChange:d,name:n,form:m,value:c,internal_do_not_use_render:({isFormControl:f})=>o.jsxs(o.Fragment,{children:[o.jsx(Os,{...p,ref:t,__scopeCheckbox:r}),f&&o.jsx($s,{__scopeCheckbox:r})]})})});_o.displayName=xr;var _s="CheckboxIndicator",Ds=u.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...s}=e,a=Oo(_s,r);return o.jsx(Se,{present:n||Ze(a.checked)||a.checked===!0,children:o.jsx(Q.span,{"data-state":Fs(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});Ds.displayName=_s;var Ms="CheckboxBubbleInput",$s=u.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:s,checked:a,defaultChecked:i,required:l,disabled:c,name:d,value:m,form:p,bubbleInput:f,setBubbleInput:x}=Oo(Ms,e),g=re(r,x),h=Io(a),v=Lo(n);u.useEffect(()=>{const w=f;if(!w)return;const C=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(C,"checked").set,S=!s.current;if(h!==a&&j){const P=new Event("click",{bubbles:S});w.indeterminate=Ze(a),j.call(w,Ze(a)?!1:a),w.dispatchEvent(P)}},[f,h,a,s]);const b=u.useRef(Ze(a)?!1:a);return o.jsx(Q.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??b.current,required:l,disabled:c,name:d,value:m,form:p,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});$s.displayName=Ms;function dd(e){return typeof e=="function"}function Ze(e){return e==="indeterminate"}function Fs(e){return Ze(e)?"indeterminate":e?"checked":"unchecked"}const xe=u.forwardRef(({className:e,...t},r)=>o.jsx(_o,{ref:r,className:U("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(Ds,{className:U("flex items-center justify-center text-current"),children:o.jsx(k.Check,{className:"h-4 w-4"})})}));xe.displayName=_o.displayName;const ud=To("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"}}),le=u.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},a)=>{const i=n?Ul:"button";return o.jsx(i,{className:U(ud({variant:t,size:r,className:e})),ref:a,...s})});le.displayName="Button";function ge(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}var md=u.createContext(void 0);function Do(e){const t=u.useContext(md);return e||t||"ltr"}function Ot(e,[t,r]){return Math.min(r,Math.max(t,e))}function pd(e,t){return u.useReducer((r,n)=>t[r][n]??r,e)}var Mo="ScrollArea",[zs]=Be(Mo),[fd,Pe]=zs(Mo),Vs=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:a=600,...i}=e,[l,c]=u.useState(null),[d,m]=u.useState(null),[p,f]=u.useState(null),[x,g]=u.useState(null),[h,v]=u.useState(null),[b,w]=u.useState(0),[C,N]=u.useState(0),[j,S]=u.useState(!1),[P,y]=u.useState(!1),A=re(t,L=>c(L)),I=Do(s);return o.jsx(fd,{scope:r,type:n,dir:I,scrollHideDelay:a,scrollArea:l,viewport:d,onViewportChange:m,content:p,onContentChange:f,scrollbarX:x,onScrollbarXChange:g,scrollbarXEnabled:j,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:v,scrollbarYEnabled:P,onScrollbarYEnabledChange:y,onCornerWidthChange:w,onCornerHeightChange:N,children:o.jsx(Q.div,{dir:I,...i,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})})});Vs.displayName=Mo;var Bs="ScrollAreaViewport",Ws=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...a}=e,i=Pe(Bs,r),l=u.useRef(null),c=re(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:s}),o.jsx(Q.div,{"data-radix-scroll-area-viewport":"",...a,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})})]})});Ws.displayName=Bs;var _e="ScrollAreaScrollbar",$o=u.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Pe(_e,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:i}=s,l=e.orientation==="horizontal";return u.useEffect(()=>(l?a(!0):i(!0),()=>{l?a(!1):i(!1)}),[l,a,i]),s.type==="hover"?o.jsx(hd,{...n,ref:t,forceMount:r}):s.type==="scroll"?o.jsx(xd,{...n,ref:t,forceMount:r}):s.type==="auto"?o.jsx(Hs,{...n,ref:t,forceMount:r}):s.type==="always"?o.jsx(Fo,{...n,ref:t}):null});$o.displayName=_e;var hd=u.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Pe(_e,e.__scopeScrollArea),[a,i]=u.useState(!1);return u.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),i(!0)},m=()=>{c=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",m),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",m)}}},[s.scrollArea,s.scrollHideDelay]),o.jsx(Se,{present:r||a,children:o.jsx(Hs,{"data-state":a?"visible":"hidden",...n,ref:t})})}),xd=u.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Pe(_e,e.__scopeScrollArea),a=e.orientation==="horizontal",i=vr(()=>c("SCROLL_END"),100),[l,c]=pd("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 u.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,s.scrollHideDelay,c]),u.useEffect(()=>{const d=s.viewport,m=a?"scrollLeft":"scrollTop";if(d){let p=d[m];const f=()=>{const x=d[m];p!==x&&(c("SCROLL"),i()),p=x};return d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[s.viewport,a,c,i]),o.jsx(Se,{present:r||l!=="hidden",children:o.jsx(Fo,{"data-state":l==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:Z(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Z(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Hs=u.forwardRef((e,t)=>{const r=Pe(_e,e.__scopeScrollArea),{forceMount:n,...s}=e,[a,i]=u.useState(!1),l=e.orientation==="horizontal",c=vr(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,m=r.viewport.offsetHeight<r.viewport.scrollHeight;i(l?d:m)}},10);return yt(r.viewport,c),yt(r.content,c),o.jsx(Se,{present:n||a,children:o.jsx(Fo,{"data-state":a?"visible":"hidden",...s,ref:t})})}),Fo=u.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,s=Pe(_e,e.__scopeScrollArea),a=u.useRef(null),i=u.useRef(0),[l,c]=u.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Ys(l.viewport,l.content),m={...n,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:f=>a.current=f,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:f=>i.current=f};function p(f,x){return Nd(f,i.current,l,x)}return r==="horizontal"?o.jsx(gd,{...m,ref:t,onThumbPositionChange:()=>{if(s.viewport&&a.current){const f=s.viewport.scrollLeft,x=Cn(f,l,s.dir);a.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollLeft=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollLeft=p(f,s.dir))}}):r==="vertical"?o.jsx(vd,{...m,ref:t,onThumbPositionChange:()=>{if(s.viewport&&a.current){const f=s.viewport.scrollTop,x=Cn(f,l);a.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:f=>{s.viewport&&(s.viewport.scrollTop=f)},onDragScroll:f=>{s.viewport&&(s.viewport.scrollTop=p(f))}}):null}),gd=u.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,a=Pe(_e,e.__scopeScrollArea),[i,l]=u.useState(),c=u.useRef(null),d=re(t,c,a.onScrollbarXChange);return u.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Gs,{"data-orientation":"horizontal",...s,ref:d,sizes:r,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":gr(r)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,p)=>{if(a.viewport){const f=a.viewport.scrollLeft+m.deltaX;e.onWheelScroll(f),Ks(f,p)&&m.preventDefault()}},onResize:()=>{c.current&&a.viewport&&i&&n({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:nr(i.paddingLeft),paddingEnd:nr(i.paddingRight)}})}})}),vd=u.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,a=Pe(_e,e.__scopeScrollArea),[i,l]=u.useState(),c=u.useRef(null),d=re(t,c,a.onScrollbarYChange);return u.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Gs,{"data-orientation":"vertical",...s,ref:d,sizes:r,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":gr(r)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,p)=>{if(a.viewport){const f=a.viewport.scrollTop+m.deltaY;e.onWheelScroll(f),Ks(f,p)&&m.preventDefault()}},onResize:()=>{c.current&&a.viewport&&i&&n({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:nr(i.paddingTop),paddingEnd:nr(i.paddingBottom)}})}})}),[bd,Us]=zs(_e),Gs=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:a,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:m,onResize:p,...f}=e,x=Pe(_e,r),[g,h]=u.useState(null),v=re(t,A=>h(A)),b=u.useRef(null),w=u.useRef(""),C=x.viewport,N=n.content-n.viewport,j=ge(m),S=ge(c),P=vr(p,10);function y(A){if(b.current){const I=A.clientX-b.current.left,L=A.clientY-b.current.top;d({x:I,y:L})}}return u.useEffect(()=>{const A=I=>{const L=I.target;(g==null?void 0:g.contains(L))&&j(I,N)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[C,g,N,j]),u.useEffect(S,[n,S]),yt(g,P),yt(x.content,P),o.jsx(bd,{scope:r,scrollbar:g,hasThumb:s,onThumbChange:ge(a),onThumbPointerUp:ge(i),onThumbPositionChange:S,onThumbPointerDown:ge(l),children:o.jsx(Q.div,{...f,ref:v,style:{position:"absolute",...f.style},onPointerDown:Z(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),b.current=g.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),y(A))}),onPointerMove:Z(e.onPointerMove,y),onPointerUp:Z(e.onPointerUp,A=>{const I=A.target;I.hasPointerCapture(A.pointerId)&&I.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=w.current,x.viewport&&(x.viewport.style.scrollBehavior=""),b.current=null})})})}),or="ScrollAreaThumb",qs=u.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Us(or,e.__scopeScrollArea);return o.jsx(Se,{present:r||s.hasThumb,children:o.jsx(yd,{ref:t,...n})})}),yd=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,a=Pe(or,r),i=Us(or,r),{onThumbPositionChange:l}=i,c=re(t,p=>i.onThumbChange(p)),d=u.useRef(void 0),m=vr(()=>{d.current&&(d.current(),d.current=void 0)},100);return u.useEffect(()=>{const p=a.viewport;if(p){const f=()=>{if(m(),!d.current){const x=Cd(p,l);d.current=x,l()}};return l(),p.addEventListener("scroll",f),()=>p.removeEventListener("scroll",f)}},[a.viewport,m,l]),o.jsx(Q.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Z(e.onPointerDownCapture,p=>{const x=p.target.getBoundingClientRect(),g=p.clientX-x.left,h=p.clientY-x.top;i.onThumbPointerDown({x:g,y:h})}),onPointerUp:Z(e.onPointerUp,i.onThumbPointerUp)})});qs.displayName=or;var zo="ScrollAreaCorner",Xs=u.forwardRef((e,t)=>{const r=Pe(zo,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?o.jsx(wd,{...e,ref:t}):null});Xs.displayName=zo;var wd=u.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=Pe(zo,r),[a,i]=u.useState(0),[l,c]=u.useState(0),d=!!(a&&l);return yt(s.scrollbarX,()=>{var p;const m=((p=s.scrollbarX)==null?void 0:p.offsetHeight)||0;s.onCornerHeightChange(m),c(m)}),yt(s.scrollbarY,()=>{var p;const m=((p=s.scrollbarY)==null?void 0:p.offsetWidth)||0;s.onCornerWidthChange(m),i(m)}),d?o.jsx(Q.div,{...n,ref:t,style:{width:a,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function nr(e){return e?parseInt(e,10):0}function Ys(e,t){const r=e/t;return isNaN(r)?0:r}function gr(e){const t=Ys(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function Nd(e,t,r,n="ltr"){const s=gr(r),a=s/2,i=t||a,l=s-i,c=r.scrollbar.paddingStart+i,d=r.scrollbar.size-r.scrollbar.paddingEnd-l,m=r.content-r.viewport,p=n==="ltr"?[0,m]:[m*-1,0];return Zs([c,d],p)(e)}function Cn(e,t,r="ltr"){const n=gr(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-s,i=t.content-t.viewport,l=a-n,c=r==="ltr"?[0,i]:[i*-1,0],d=Ot(e,c);return Zs([0,i],[0,l])(d)}function Zs(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 Ks(e,t){return e>0&&e<t}var Cd=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return(function s(){const a={left:e.scrollLeft,top:e.scrollTop},i=r.left!==a.left,l=r.top!==a.top;(i||l)&&t(),r=a,n=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(n)};function vr(e,t){const r=ge(e),n=u.useRef(0);return u.useEffect(()=>()=>window.clearTimeout(n.current),[]),u.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function yt(e,t){const r=ge(t);he(()=>{let n=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(n),s.unobserve(e)}}},[e,r])}var Js=Vs,jd=Ws,Sd=Xs;const br=u.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Js,{ref:n,className:U("relative overflow-hidden",e),...r,children:[o.jsx(jd,{className:"h-full w-full rounded-[inherit]",children:t}),o.jsx(Qs,{}),o.jsx(Sd,{})]}));br.displayName=Js.displayName;const Qs=u.forwardRef(({className:e,orientation:t="vertical",...r},n)=>o.jsx($o,{ref:n,orientation:t,className:U("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(qs,{className:"relative flex-1 rounded-full bg-border"})}));Qs.displayName=$o.displayName;var Pd=u[" useId ".trim().toString()]||(()=>{}),Rd=0;function Ke(e){const[t,r]=u.useState(Pd());return he(()=>{r(n=>n??String(Rd++))},[e]),t?`radix-${t}`:""}function Ed(e,t=globalThis==null?void 0:globalThis.document){const r=ge(e);u.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Ad="DismissableLayer",so="dismissableLayer.update",kd="dismissableLayer.pointerDownOutside",Td="dismissableLayer.focusOutside",jn,ea=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$t=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:i,onDismiss:l,...c}=e,d=u.useContext(ea),[m,p]=u.useState(null),f=(m==null?void 0:m.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=u.useState({}),g=re(t,P=>p(P)),h=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=h.indexOf(v),w=m?h.indexOf(m):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,N=w>=b,j=Od(P=>{const y=P.target,A=[...d.branches].some(I=>I.contains(y));!N||A||(s==null||s(P),i==null||i(P),P.defaultPrevented||l==null||l())},f),S=_d(P=>{const y=P.target;[...d.branches].some(I=>I.contains(y))||(a==null||a(P),i==null||i(P),P.defaultPrevented||l==null||l())},f);return Ed(P=>{w===d.layers.size-1&&(n==null||n(P),!P.defaultPrevented&&l&&(P.preventDefault(),l()))},f),u.useEffect(()=>{if(m)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(jn=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(m)),d.layers.add(m),Sn(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=jn)}},[m,f,r,d]),u.useEffect(()=>()=>{m&&(d.layers.delete(m),d.layersWithOutsidePointerEventsDisabled.delete(m),Sn())},[m,d]),u.useEffect(()=>{const P=()=>x({});return document.addEventListener(so,P),()=>document.removeEventListener(so,P)},[]),o.jsx(Q.div,{...c,ref:g,style:{pointerEvents:C?N?"auto":"none":void 0,...e.style},onFocusCapture:Z(e.onFocusCapture,S.onFocusCapture),onBlurCapture:Z(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Z(e.onPointerDownCapture,j.onPointerDownCapture)})});$t.displayName=Ad;var Id="DismissableLayerBranch",Ld=u.forwardRef((e,t)=>{const r=u.useContext(ea),n=u.useRef(null),s=re(t,n);return u.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),o.jsx(Q.div,{...e,ref:s})});Ld.displayName=Id;function Od(e,t=globalThis==null?void 0:globalThis.document){const r=ge(e),n=u.useRef(!1),s=u.useRef(()=>{});return u.useEffect(()=>{const a=l=>{if(l.target&&!n.current){let c=function(){ta(kd,r,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function _d(e,t=globalThis==null?void 0:globalThis.document){const r=ge(e),n=u.useRef(!1);return u.useEffect(()=>{const s=a=>{a.target&&!n.current&&ta(Td,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Sn(){const e=new CustomEvent(so);document.dispatchEvent(e)}function ta(e,t,r,{discrete:n}){const s=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?ad(s,a):s.dispatchEvent(a)}var Gr="focusScope.autoFocusOnMount",qr="focusScope.autoFocusOnUnmount",Pn={bubbles:!1,cancelable:!0},Dd="FocusScope",yr=u.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...i}=e,[l,c]=u.useState(null),d=ge(s),m=ge(a),p=u.useRef(null),f=re(t,h=>c(h)),x=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(n){let h=function(C){if(x.paused||!l)return;const N=C.target;l.contains(N)?p.current=N:Xe(p.current,{select:!0})},v=function(C){if(x.paused||!l)return;const N=C.relatedTarget;N!==null&&(l.contains(N)||Xe(p.current,{select:!0}))},b=function(C){if(document.activeElement===document.body)for(const j of C)j.removedNodes.length>0&&Xe(l)};document.addEventListener("focusin",h),document.addEventListener("focusout",v);const w=new MutationObserver(b);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",v),w.disconnect()}}},[n,l,x.paused]),u.useEffect(()=>{if(l){En.add(x);const h=document.activeElement;if(!l.contains(h)){const b=new CustomEvent(Gr,Pn);l.addEventListener(Gr,d),l.dispatchEvent(b),b.defaultPrevented||(Md(Bd(ra(l)),{select:!0}),document.activeElement===h&&Xe(l))}return()=>{l.removeEventListener(Gr,d),setTimeout(()=>{const b=new CustomEvent(qr,Pn);l.addEventListener(qr,m),l.dispatchEvent(b),b.defaultPrevented||Xe(h??document.body,{select:!0}),l.removeEventListener(qr,m),En.remove(x)},0)}}},[l,d,m,x]);const g=u.useCallback(h=>{if(!r&&!n||x.paused)return;const v=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(v&&b){const w=h.currentTarget,[C,N]=$d(w);C&&N?!h.shiftKey&&b===N?(h.preventDefault(),r&&Xe(C,{select:!0})):h.shiftKey&&b===C&&(h.preventDefault(),r&&Xe(N,{select:!0})):b===w&&h.preventDefault()}},[r,n,x.paused]);return o.jsx(Q.div,{tabIndex:-1,...i,ref:f,onKeyDown:g})});yr.displayName=Dd;function Md(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Xe(n,{select:t}),document.activeElement!==r)return}function $d(e){const t=ra(e),r=Rn(t,e),n=Rn(t.reverse(),e);return[r,n]}function ra(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Rn(e,t){for(const r of e)if(!Fd(r,{upTo:t}))return r}function Fd(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 zd(e){return e instanceof HTMLInputElement&&"select"in e}function Xe(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&zd(e)&&t&&e.select()}}var En=Vd();function Vd(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=An(e,t),e.unshift(t)},remove(t){var r;e=An(e,t),(r=e[0])==null||r.resume()}}}function An(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Bd(e){return e.filter(t=>t.tagName!=="A")}var Wd="Portal",wr=u.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[s,a]=u.useState(!1);he(()=>a(!0),[]);const i=r||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return i?So.createPortal(o.jsx(Q.div,{...n,ref:t}),i):null});wr.displayName=Wd;var Xr=0;function Vo(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??kn()),document.body.insertAdjacentElement("beforeend",e[1]??kn()),Xr++,()=>{Xr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Xr--}},[])}function kn(){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 Ie=function(){return Ie=Object.assign||function(t){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Ie.apply(this,arguments)};function oa(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 s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}function Hd(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var Jt="right-scroll-bar-position",Qt="width-before-scroll-bar",Ud="with-scroll-bars-hidden",Gd="--removed-body-scroll-bar-size";function Yr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function qd(e,t){var r=_.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=t,r.facade}var Xd=typeof window<"u"?u.useLayoutEffect:u.useEffect,Tn=new WeakMap;function Yd(e,t){var r=qd(null,function(n){return e.forEach(function(s){return Yr(s,n)})});return Xd(function(){var n=Tn.get(r);if(n){var s=new Set(n),a=new Set(e),i=r.current;s.forEach(function(l){a.has(l)||Yr(l,null)}),a.forEach(function(l){s.has(l)||Yr(l,i)})}Tn.set(r,e)},[e]),r}function Zd(e){return e}function Kd(e,t){t===void 0&&(t=Zd);var r=[],n=!1,s={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(a){var i=t(a,n);return r.push(i),function(){r=r.filter(function(l){return l!==i})}},assignSyncMedium:function(a){for(n=!0;r.length;){var i=r;r=[],i.forEach(a)}r={push:function(l){return a(l)},filter:function(){return r}}},assignMedium:function(a){n=!0;var i=[];if(r.length){var l=r;r=[],l.forEach(a),i=r}var c=function(){var m=i;i=[],m.forEach(a)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(m){i.push(m),d()},filter:function(m){return i=i.filter(m),r}}}};return s}function Jd(e){e===void 0&&(e={});var t=Kd(null);return t.options=Ie({async:!0,ssr:!1},e),t}var na=function(e){var t=e.sideCar,r=oa(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 u.createElement(n,Ie({},r))};na.isSideCarExport=!0;function Qd(e,t){return e.useMedium(t),na}var sa=Jd(),Zr=function(){},Nr=u.forwardRef(function(e,t){var r=u.useRef(null),n=u.useState({onScrollCapture:Zr,onWheelCapture:Zr,onTouchMoveCapture:Zr}),s=n[0],a=n[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,m=e.enabled,p=e.shards,f=e.sideCar,x=e.noRelative,g=e.noIsolation,h=e.inert,v=e.allowPinchZoom,b=e.as,w=b===void 0?"div":b,C=e.gapMode,N=oa(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=f,S=Yd([r,t]),P=Ie(Ie({},N),s);return u.createElement(u.Fragment,null,m&&u.createElement(j,{sideCar:sa,removeScrollBar:d,shards:p,noRelative:x,noIsolation:g,inert:h,setCallbacks:a,allowPinchZoom:!!v,lockRef:r,gapMode:C}),i?u.cloneElement(u.Children.only(l),Ie(Ie({},P),{ref:S})):u.createElement(w,Ie({},P,{className:c,ref:S}),l))});Nr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Nr.classNames={fullWidth:Qt,zeroRight:Jt};var eu=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function tu(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=eu();return t&&e.setAttribute("nonce",t),e}function ru(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ou(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var nu=function(){var e=0,t=null;return{add:function(r){e==0&&(t=tu())&&(ru(t,r),ou(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},su=function(){var e=nu();return function(t,r){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},aa=function(){var e=su(),t=function(r){var n=r.styles,s=r.dynamic;return e(n,s),null};return t},au={left:0,top:0,right:0,gap:0},Kr=function(e){return parseInt(e||"",10)||0},iu=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Kr(r),Kr(n),Kr(s)]},lu=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return au;var t=iu(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])}},cu=aa(),gt="data-scroll-locked",du=function(e,t,r,n){var s=e.left,a=e.top,i=e.right,l=e.gap;return r===void 0&&(r="margin"),`
|
|
2
2
|
.`.concat(Ud,` {
|
|
3
3
|
overflow: hidden `).concat(n,`;
|
|
4
4
|
padding-right: `).concat(l,"px ").concat(n,`;
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
`)},In=function(){var e=parseInt(document.body.getAttribute(gt)||"0",10);return isFinite(e)?e:0},uu=function(){u.useEffect(function(){return document.body.setAttribute(gt,(In()+1).toString()),function(){var e=In()-1;e<=0?document.body.removeAttribute(gt):document.body.setAttribute(gt,e.toString())}},[])},mu=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;uu();var a=u.useMemo(function(){return lu(s)},[s]);return u.createElement(cu,{styles:du(a,!t,s,r?"":"!important")})},ao=!1;if(typeof window<"u")try{var qt=Object.defineProperty({},"passive",{get:function(){return ao=!0,!0}});window.addEventListener("test",qt,qt),window.removeEventListener("test",qt,qt)}catch{ao=!1}var pt=ao?{passive:!1}:!1,pu=function(e){return e.tagName==="TEXTAREA"},ia=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!pu(e)&&r[t]==="visible")},fu=function(e){return ia(e,"overflowY")},hu=function(e){return ia(e,"overflowX")},Ln=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=la(e,n);if(s){var a=ca(e,n),i=a[1],l=a[2];if(i>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},xu=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},gu=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},la=function(e,t){return e==="v"?fu(t):hu(t)},ca=function(e,t){return e==="v"?xu(t):gu(t)},vu=function(e,t){return e==="h"&&t==="rtl"?-1:1},bu=function(e,t,r,n,s){var a=vu(e,window.getComputedStyle(t).direction),i=a*n,l=r.target,c=t.contains(l),d=!1,m=i>0,p=0,f=0;do{if(!l)break;var x=ca(e,l),g=x[0],h=x[1],v=x[2],b=h-v-a*g;(g||b)&&la(e,l)&&(p+=b,f+=g);var w=l.parentNode;l=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(m&&Math.abs(p)<1||!m&&Math.abs(f)<1)&&(d=!0),d},Xt=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},On=function(e){return[e.deltaX,e.deltaY]},_n=function(e){return e&&"current"in e?e.current:e},yu=function(e,t){return e[0]===t[0]&&e[1]===t[1]},wu=function(e){return`
|
|
39
39
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
40
40
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
41
|
-
`)},Nu=0,ft=[];function Cu(e){var t=u.useRef([]),r=u.useRef([0,0]),n=u.useRef(),s=u.useState(Nu++)[0],a=u.useState(aa)[0],i=u.useRef(e);u.useEffect(function(){i.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var h=Hd([e.lockRef.current],(e.shards||[]).map(_n),!0).filter(Boolean);return h.forEach(function(v){return v.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),h.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=u.useCallback(function(h,v){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var b=Xt(h),w=r.current,
|
|
41
|
+
`)},Nu=0,ft=[];function Cu(e){var t=u.useRef([]),r=u.useRef([0,0]),n=u.useRef(),s=u.useState(Nu++)[0],a=u.useState(aa)[0],i=u.useRef(e);u.useEffect(function(){i.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var h=Hd([e.lockRef.current],(e.shards||[]).map(_n),!0).filter(Boolean);return h.forEach(function(v){return v.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),h.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=u.useCallback(function(h,v){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var b=Xt(h),w=r.current,C="deltaX"in h?h.deltaX:w[0]-b[0],N="deltaY"in h?h.deltaY:w[1]-b[1],j,S=h.target,P=Math.abs(C)>Math.abs(N)?"h":"v";if("touches"in h&&P==="h"&&S.type==="range")return!1;var y=window.getSelection(),A=y&&y.anchorNode,I=A?A===S||A.contains(S):!1;if(I)return!1;var L=Ln(P,S);if(!L)return!0;if(L?j=P:(j=P==="v"?"h":"v",L=Ln(P,S)),!L)return!1;if(!n.current&&"changedTouches"in h&&(C||N)&&(n.current=j),!j)return!0;var D=n.current||j;return bu(D,v,h,D==="h"?C:N)},[]),c=u.useCallback(function(h){var v=h;if(!(!ft.length||ft[ft.length-1]!==a)){var b="deltaY"in v?On(v):Xt(v),w=t.current.filter(function(j){return j.name===v.type&&(j.target===v.target||v.target===j.shadowParent)&&yu(j.delta,b)})[0];if(w&&w.should){v.cancelable&&v.preventDefault();return}if(!w){var C=(i.current.shards||[]).map(_n).filter(Boolean).filter(function(j){return j.contains(v.target)}),N=C.length>0?l(v,C[0]):!i.current.noIsolation;N&&v.cancelable&&v.preventDefault()}}},[]),d=u.useCallback(function(h,v,b,w){var C={name:h,delta:v,target:b,should:w,shadowParent:ju(b)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(N){return N!==C})},1)},[]),m=u.useCallback(function(h){r.current=Xt(h),n.current=void 0},[]),p=u.useCallback(function(h){d(h.type,On(h),h.target,l(h,e.lockRef.current))},[]),f=u.useCallback(function(h){d(h.type,Xt(h),h.target,l(h,e.lockRef.current))},[]);u.useEffect(function(){return ft.push(a),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:f}),document.addEventListener("wheel",c,pt),document.addEventListener("touchmove",c,pt),document.addEventListener("touchstart",m,pt),function(){ft=ft.filter(function(h){return h!==a}),document.removeEventListener("wheel",c,pt),document.removeEventListener("touchmove",c,pt),document.removeEventListener("touchstart",m,pt)}},[]);var x=e.removeScrollBar,g=e.inert;return u.createElement(u.Fragment,null,g?u.createElement(a,{styles:wu(s)}):null,x?u.createElement(mu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ju(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Su=Qd(sa,Cu);var Cr=u.forwardRef(function(e,t){return u.createElement(Nr,Ie({},e,{ref:t,sideCar:Su}))});Cr.classNames=Nr.classNames;var Pu=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ht=new WeakMap,Yt=new WeakMap,Zt={},Jr=0,da=function(e){return e&&(e.host||da(e.parentNode))},Ru=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=da(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})},Eu=function(e,t,r,n){var s=Ru(t,Array.isArray(e)?e:[e]);Zt[r]||(Zt[r]=new WeakMap);var a=Zt[r],i=[],l=new Set,c=new Set(s),d=function(p){!p||l.has(p)||(l.add(p),d(p.parentNode))};s.forEach(d);var m=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(f){if(l.has(f))m(f);else try{var x=f.getAttribute(n),g=x!==null&&x!=="false",h=(ht.get(f)||0)+1,v=(a.get(f)||0)+1;ht.set(f,h),a.set(f,v),i.push(f),h===1&&g&&Yt.set(f,!0),v===1&&f.setAttribute(r,"true"),g||f.setAttribute(n,"true")}catch(b){console.error("aria-hidden: cannot operate on ",f,b)}})};return m(t),l.clear(),Jr++,function(){i.forEach(function(p){var f=ht.get(p)-1,x=a.get(p)-1;ht.set(p,f),a.set(p,x),f||(Yt.has(p)||p.removeAttribute(n),Yt.delete(p)),x||p.removeAttribute(r)}),Jr--,Jr||(ht=new WeakMap,ht=new WeakMap,Yt=new WeakMap,Zt={})}},Bo=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=Pu(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live], script"))),Eu(n,s,r,"aria-hidden")):function(){return null}},jr="Dialog",[ua]=Be(jr),[Au,Te]=ua(jr),ma=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,l=u.useRef(null),c=u.useRef(null),[d,m]=it({prop:n,defaultProp:s??!1,onChange:a,caller:jr});return o.jsx(Au,{scope:t,triggerRef:l,contentRef:c,contentId:Ke(),titleId:Ke(),descriptionId:Ke(),open:d,onOpenChange:m,onOpenToggle:u.useCallback(()=>m(p=>!p),[m]),modal:i,children:r})};ma.displayName=jr;var pa="DialogTrigger",ku=u.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Te(pa,r),a=re(t,s.triggerRef);return o.jsx(Q.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Uo(s.open),...n,ref:a,onClick:Z(e.onClick,s.onOpenToggle)})});ku.displayName=pa;var Wo="DialogPortal",[Tu,fa]=ua(Wo,{forceMount:void 0}),ha=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,a=Te(Wo,t);return o.jsx(Tu,{scope:t,forceMount:r,children:u.Children.map(n,i=>o.jsx(Se,{present:r||a.open,children:o.jsx(wr,{asChild:!0,container:s,children:i})}))})};ha.displayName=Wo;var sr="DialogOverlay",xa=u.forwardRef((e,t)=>{const r=fa(sr,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=Te(sr,e.__scopeDialog);return a.modal?o.jsx(Se,{present:n||a.open,children:o.jsx(Lu,{...s,ref:t})}):null});xa.displayName=sr;var Iu=bt("DialogOverlay.RemoveScroll"),Lu=u.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Te(sr,r);return o.jsx(Cr,{as:Iu,allowPinchZoom:!0,shards:[s.contentRef],children:o.jsx(Q.div,{"data-state":Uo(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),lt="DialogContent",ga=u.forwardRef((e,t)=>{const r=fa(lt,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=Te(lt,e.__scopeDialog);return o.jsx(Se,{present:n||a.open,children:a.modal?o.jsx(Ou,{...s,ref:t}):o.jsx(_u,{...s,ref:t})})});ga.displayName=lt;var Ou=u.forwardRef((e,t)=>{const r=Te(lt,e.__scopeDialog),n=u.useRef(null),s=re(t,r.contentRef,n);return u.useEffect(()=>{const a=n.current;if(a)return Bo(a)},[]),o.jsx(va,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Z(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:Z(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&a.preventDefault()}),onFocusOutside:Z(e.onFocusOutside,a=>a.preventDefault())})}),_u=u.forwardRef((e,t)=>{const r=Te(lt,e.__scopeDialog),n=u.useRef(!1),s=u.useRef(!1);return o.jsx(va,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,a),a.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),a.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:a=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=a.target;((d=r.triggerRef.current)==null?void 0:d.contains(i))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),va=u.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,...i}=e,l=Te(lt,r),c=u.useRef(null),d=re(t,c);return Vo(),o.jsxs(o.Fragment,{children:[o.jsx(yr,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx($t,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Uo(l.open),...i,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(Du,{titleId:l.titleId}),o.jsx($u,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Ho="DialogTitle",ba=u.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Te(Ho,r);return o.jsx(Q.h2,{id:s.titleId,...n,ref:t})});ba.displayName=Ho;var ya="DialogDescription",wa=u.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Te(ya,r);return o.jsx(Q.p,{id:s.descriptionId,...n,ref:t})});wa.displayName=ya;var Na="DialogClose",Ca=u.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=Te(Na,r);return o.jsx(Q.button,{type:"button",...n,ref:t,onClick:Z(e.onClick,()=>s.onOpenChange(!1))})});Ca.displayName=Na;function Uo(e){return e?"open":"closed"}var ja="DialogTitleWarning",[kh,Sa]=Gc(ja,{contentName:lt,titleName:Ho,docsSlug:"dialog"}),Du=({titleId:e})=>{const t=Sa(ja),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
42
42
|
|
|
43
43
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
44
44
|
|
|
45
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return u.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Mu="DialogDescriptionWarning",$u=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Sa(Mu).contentName}}.`;return u.useEffect(()=>{var a;const s=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Fu=ma,zu=ha,Pa=xa,Ra=ga,Ea=ba,Aa=wa,Vu=Ca;const Bu=Fu,Wu=zu,ka=u.forwardRef(({className:e,...t},r)=>o.jsx(Pa,{ref:r,className:U("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}));ka.displayName=Pa.displayName;const Ta=u.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Wu,{children:[o.jsx(ka,{}),o.jsxs(Ra,{ref:n,className:U("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(Vu,{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(k.X,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ta.displayName=Ra.displayName;const Ia=({className:e,...t})=>o.jsx("div",{className:U("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ia.displayName="DialogHeader";const La=u.forwardRef(({className:e,...t},r)=>o.jsx(Ea,{ref:r,className:U("text-lg font-semibold leading-none tracking-tight",e),...t}));La.displayName=Ea.displayName;const Oa=u.forwardRef(({className:e,...t},r)=>o.jsx(Aa,{ref:r,className:U("text-sm text-muted-foreground",e),...t}));Oa.displayName=Aa.displayName;function Hu(e){if(!e)return null;if(e.includes("-")){const t=e.split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");return k.icons[t]??null}return k.icons[e]??null}const Dn=Object.entries(k.icons).map(([e,t])=>({name:e,kebab:e.replace(/([A-Z])/g,(r,n,s)=>s===0?n.toLowerCase():`-${n.toLowerCase()}`),component:t})),_a=({value:e,onChange:t,label:r="Ícone (Lucide)",hideLabel:n=!1,className:s})=>{const[a,i]=_.useState(!1),[l,c]=_.useState(""),d=_.useMemo(()=>Hu(e),[e]),m=_.useMemo(()=>{const x=l.toLowerCase();return x?Dn.filter(g=>g.name.toLowerCase().includes(x)||g.kebab.includes(x)):Dn},[l]),p=x=>{t(x),i(!1)},f=x=>{i(x),x||c("")};return o.jsxs("div",{className:`space-y-1 ${s??""}`,children:[!n&&o.jsx(B,{className:"text-xs",children:r}),o.jsx(le,{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:[_.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(Bu,{open:a,onOpenChange:f,children:o.jsxs(Ta,{className:"max-w-3xl max-h-[85vh] flex flex-col gap-0 p-0",children:[o.jsxs(Ia,{className:"px-4 pt-4 pb-2 border-b",children:[o.jsx(La,{children:"Selecionar ícone"}),o.jsx(Oa,{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(k.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Y,{autoFocus:!0,placeholder:"Buscar ícones…",value:l,onChange:x=>c(x.target.value),className:"pl-8 h-9 text-sm"})]})}),o.jsx(br,{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(le,{type:"button",variant:e?"outline":"secondary",className:"flex flex-col items-center justify-center h-20 gap-1 p-1",onClick:()=>p(void 0),children:[o.jsx("div",{className:"h-6 w-6 rounded border-2 border-dashed border-muted-foreground/30"}),o.jsx("span",{className:"text-[10px] leading-tight text-center",children:"Nenhum"})]}),m.map(({name:x,component:g})=>o.jsxs(le,{type:"button",variant:e===x?"secondary":"outline",className:"flex flex-col items-center justify-center h-20 gap-1 p-1 overflow-hidden",onClick:()=>p(x),children:[_.createElement(g,{size:24}),o.jsx("span",{className:"text-[9px] leading-tight text-center break-all line-clamp-2",children:x})]},x))]})})]})})]})},Uu=["top","right","bottom","left"],Je=Math.min,ve=Math.max,ar=Math.round,Kt=Math.floor,Oe=e=>({x:e,y:e}),Gu={left:"right",right:"left",bottom:"top",top:"bottom"};function io(e,t,r){return ve(e,Je(t,r))}function ze(e,t){return typeof e=="function"?e(t):e}function Ve(e){return e.split("-")[0]}function St(e){return e.split("-")[1]}function Go(e){return e==="x"?"y":"x"}function qo(e){return e==="y"?"height":"width"}function Le(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Xo(e){return Go(Le(e))}function qu(e,t,r){r===void 0&&(r=!1);const n=St(e),s=Xo(e),a=qo(s);let i=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=ir(i)),[i,ir(i)]}function Xu(e){const t=ir(e);return[lo(e),t,lo(t)]}function lo(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Mn=["left","right"],$n=["right","left"],Yu=["top","bottom"],Zu=["bottom","top"];function Ku(e,t,r){switch(e){case"top":case"bottom":return r?t?$n:Mn:t?Mn:$n;case"left":case"right":return t?Yu:Zu;default:return[]}}function Ju(e,t,r,n){const s=St(e);let a=Ku(Ve(e),r==="start",n);return s&&(a=a.map(i=>i+"-"+s),t&&(a=a.concat(a.map(lo)))),a}function ir(e){const t=Ve(e);return Gu[t]+e.slice(t.length)}function Qu(e){return{top:0,right:0,bottom:0,left:0,...e}}function Da(e){return typeof e!="number"?Qu(e):{top:e,right:e,bottom:e,left:e}}function lr(e){const{x:t,y:r,width:n,height:s}=e;return{width:n,height:s,top:r,left:t,right:t+n,bottom:r+s,x:t,y:r}}function Fn(e,t,r){let{reference:n,floating:s}=e;const a=Le(t),i=Xo(t),l=qo(i),c=Ve(t),d=a==="y",m=n.x+n.width/2-s.width/2,p=n.y+n.height/2-s.height/2,f=n[l]/2-s[l]/2;let x;switch(c){case"top":x={x:m,y:n.y-s.height};break;case"bottom":x={x:m,y:n.y+n.height};break;case"right":x={x:n.x+n.width,y:p};break;case"left":x={x:n.x-s.width,y:p};break;default:x={x:n.x,y:n.y}}switch(St(t)){case"start":x[i]-=f*(r&&d?-1:1);break;case"end":x[i]+=f*(r&&d?-1:1);break}return x}async function em(e,t){var r;t===void 0&&(t={});const{x:n,y:s,platform:a,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:m="viewport",elementContext:p="floating",altBoundary:f=!1,padding:x=0}=ze(t,e),g=Da(x),v=l[f?p==="floating"?"reference":"floating":p],b=lr(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(v)))==null||r?v:v.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:d,rootBoundary:m,strategy:c})),w=p==="floating"?{x:n,y:s,width:i.floating.width,height:i.floating.height}:i.reference,N=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),C=await(a.isElement==null?void 0:a.isElement(N))?await(a.getScale==null?void 0:a.getScale(N))||{x:1,y:1}:{x:1,y:1},j=lr(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:N,strategy:c}):w);return{top:(b.top-j.top+g.top)/C.y,bottom:(j.bottom-b.bottom+g.bottom)/C.y,left:(b.left-j.left+g.left)/C.x,right:(j.right-b.right+g.right)/C.x}}const tm=50,rm=async(e,t,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:a=[],platform:i}=r,l=i.detectOverflow?i:{...i,detectOverflow:em},c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:m,y:p}=Fn(d,n,c),f=n,x=0;const g={};for(let h=0;h<a.length;h++){const v=a[h];if(!v)continue;const{name:b,fn:w}=v,{x:N,y:C,data:j,reset:S}=await w({x:m,y:p,initialPlacement:n,placement:f,strategy:s,middlewareData:g,rects:d,platform:l,elements:{reference:e,floating:t}});m=N??m,p=C??p,g[b]={...g[b],...j},S&&x<tm&&(x++,typeof S=="object"&&(S.placement&&(f=S.placement),S.rects&&(d=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):S.rects),{x:m,y:p}=Fn(d,f,c)),h=-1)}return{x:m,y:p,placement:f,strategy:s,middlewareData:g}},om=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:s,rects:a,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:m=0}=ze(e,t)||{};if(d==null)return{};const p=Da(m),f={x:r,y:n},x=Xo(s),g=qo(x),h=await i.getDimensions(d),v=x==="y",b=v?"top":"left",w=v?"bottom":"right",N=v?"clientHeight":"clientWidth",C=a.reference[g]+a.reference[x]-f[x]-a.floating[g],j=f[x]-a.reference[x],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let P=S?S[N]:0;(!P||!await(i.isElement==null?void 0:i.isElement(S)))&&(P=l.floating[N]||a.floating[g]);const y=C/2-j/2,E=P/2-h[g]/2-1,I=Je(p[b],E),L=Je(p[w],E),D=I,z=P-h[g]-L,M=P/2-h[g]/2+y,$=io(D,M,z),A=!c.arrow&&St(s)!=null&&M!==$&&a.reference[g]/2-(M<D?I:L)-h[g]/2<0,T=A?M<D?M-D:M-z:0;return{[x]:f[x]+T,data:{[x]:$,centerOffset:M-$-T,...A&&{alignmentOffset:T}},reset:A}}}),nm=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:s,middlewareData:a,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:m=!0,crossAxis:p=!0,fallbackPlacements:f,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:h=!0,...v}=ze(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const b=Ve(s),w=Le(l),N=Ve(l)===l,C=await(c.isRTL==null?void 0:c.isRTL(d.floating)),j=f||(N||!h?[ir(l)]:Xu(l)),S=g!=="none";!f&&S&&j.push(...Ju(l,h,g,C));const P=[l,...j],y=await c.detectOverflow(t,v),E=[];let I=((n=a.flip)==null?void 0:n.overflows)||[];if(m&&E.push(y[b]),p){const M=qu(s,i,C);E.push(y[M[0]],y[M[1]])}if(I=[...I,{placement:s,overflows:E}],!E.every(M=>M<=0)){var L,D;const M=(((L=a.flip)==null?void 0:L.index)||0)+1,$=P[M];if($&&(!(p==="alignment"?w!==Le($):!1)||I.every(R=>Le(R.placement)===w?R.overflows[0]>0:!0)))return{data:{index:M,overflows:I},reset:{placement:$}};let A=(D=I.filter(T=>T.overflows[0]<=0).sort((T,R)=>T.overflows[1]-R.overflows[1])[0])==null?void 0:D.placement;if(!A)switch(x){case"bestFit":{var z;const T=(z=I.filter(R=>{if(S){const V=Le(R.placement);return V===w||V==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(V=>V>0).reduce((V,O)=>V+O,0)]).sort((R,V)=>R[1]-V[1])[0])==null?void 0:z[0];T&&(A=T);break}case"initialPlacement":A=l;break}if(s!==A)return{reset:{placement:A}}}return{}}}};function zn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Vn(e){return Uu.some(t=>e[t]>=0)}const sm=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:s="referenceHidden",...a}=ze(e,t);switch(s){case"referenceHidden":{const i=await n.detectOverflow(t,{...a,elementContext:"reference"}),l=zn(i,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Vn(l)}}}case"escaped":{const i=await n.detectOverflow(t,{...a,altBoundary:!0}),l=zn(i,r.floating);return{data:{escapedOffsets:l,escaped:Vn(l)}}}default:return{}}}}},Ma=new Set(["left","top"]);async function am(e,t){const{placement:r,platform:n,elements:s}=e,a=await(n.isRTL==null?void 0:n.isRTL(s.floating)),i=Ve(r),l=St(r),c=Le(r)==="y",d=Ma.has(i)?-1:1,m=a&&c?-1:1,p=ze(t,e);let{mainAxis:f,crossAxis:x,alignmentAxis:g}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof g=="number"&&(x=l==="end"?g*-1:g),c?{x:x*m,y:f*d}:{x:f*d,y:x*m}}const im=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:s,y:a,placement:i,middlewareData:l}=t,c=await am(t,e);return i===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:a+c.y,data:{...c,placement:i}}}}},lm=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:s,platform:a}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:w,y:N}=b;return{x:w,y:N}}},...d}=ze(e,t),m={x:r,y:n},p=await a.detectOverflow(t,d),f=Le(Ve(s)),x=Go(f);let g=m[x],h=m[f];if(i){const b=x==="y"?"top":"left",w=x==="y"?"bottom":"right",N=g+p[b],C=g-p[w];g=io(N,g,C)}if(l){const b=f==="y"?"top":"left",w=f==="y"?"bottom":"right",N=h+p[b],C=h-p[w];h=io(N,h,C)}const v=c.fn({...t,[x]:g,[f]:h});return{...v,data:{x:v.x-r,y:v.y-n,enabled:{[x]:i,[f]:l}}}}}},cm=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:s,rects:a,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=ze(e,t),m={x:r,y:n},p=Le(s),f=Go(p);let x=m[f],g=m[p];const h=ze(l,t),v=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const N=f==="y"?"height":"width",C=a.reference[f]-a.floating[N]+v.mainAxis,j=a.reference[f]+a.reference[N]-v.mainAxis;x<C?x=C:x>j&&(x=j)}if(d){var b,w;const N=f==="y"?"width":"height",C=Ma.has(Ve(s)),j=a.reference[p]-a.floating[N]+(C&&((b=i.offset)==null?void 0:b[p])||0)+(C?0:v.crossAxis),S=a.reference[p]+a.reference[N]+(C?0:((w=i.offset)==null?void 0:w[p])||0)-(C?v.crossAxis:0);g<j?g=j:g>S&&(g=S)}return{[f]:x,[p]:g}}}},dm=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:s,rects:a,platform:i,elements:l}=t,{apply:c=()=>{},...d}=ze(e,t),m=await i.detectOverflow(t,d),p=Ve(s),f=St(s),x=Le(s)==="y",{width:g,height:h}=a.floating;let v,b;p==="top"||p==="bottom"?(v=p,b=f===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(b=p,v=f==="end"?"top":"bottom");const w=h-m.top-m.bottom,N=g-m.left-m.right,C=Je(h-m[v],w),j=Je(g-m[b],N),S=!t.middlewareData.shift;let P=C,y=j;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(y=N),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(P=w),S&&!f){const I=ve(m.left,0),L=ve(m.right,0),D=ve(m.top,0),z=ve(m.bottom,0);x?y=g-2*(I!==0||L!==0?I+L:ve(m.left,m.right)):P=h-2*(D!==0||z!==0?D+z:ve(m.top,m.bottom))}await c({...t,availableWidth:y,availableHeight:P});const E=await i.getDimensions(l.floating);return g!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}};function Sr(){return typeof window<"u"}function Pt(e){return $a(e)?(e.nodeName||"").toLowerCase():"#document"}function be(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function De(e){var t;return(t=($a(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $a(e){return Sr()?e instanceof Node||e instanceof be(e).Node:!1}function Ee(e){return Sr()?e instanceof Element||e instanceof be(e).Element:!1}function We(e){return Sr()?e instanceof HTMLElement||e instanceof be(e).HTMLElement:!1}function Bn(e){return!Sr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof be(e).ShadowRoot}function Ft(e){const{overflow:t,overflowX:r,overflowY:n,display:s}=Ae(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&s!=="inline"&&s!=="contents"}function um(e){return/^(table|td|th)$/.test(Pt(e))}function Pr(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const mm=/transform|translate|scale|rotate|perspective|filter/,pm=/paint|layout|strict|content/,st=e=>!!e&&e!=="none";let Qr;function Yo(e){const t=Ee(e)?Ae(e):e;return st(t.transform)||st(t.translate)||st(t.scale)||st(t.rotate)||st(t.perspective)||!Zo()&&(st(t.backdropFilter)||st(t.filter))||mm.test(t.willChange||"")||pm.test(t.contain||"")}function fm(e){let t=Qe(e);for(;We(t)&&!wt(t);){if(Yo(t))return t;if(Pr(t))return null;t=Qe(t)}return null}function Zo(){return Qr==null&&(Qr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Qr}function wt(e){return/^(html|body|#document)$/.test(Pt(e))}function Ae(e){return be(e).getComputedStyle(e)}function Rr(e){return Ee(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qe(e){if(Pt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Bn(e)&&e.host||De(e);return Bn(t)?t.host:t}function Fa(e){const t=Qe(e);return wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:We(t)&&Ft(t)?t:Fa(t)}function _t(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=Fa(e),a=s===((n=e.ownerDocument)==null?void 0:n.body),i=be(s);if(a){const l=co(i);return t.concat(i,i.visualViewport||[],Ft(s)?s:[],l&&r?_t(l):[])}else return t.concat(s,_t(s,[],r))}function co(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function za(e){const t=Ae(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const s=We(e),a=s?e.offsetWidth:r,i=s?e.offsetHeight:n,l=ar(r)!==a||ar(n)!==i;return l&&(r=a,n=i),{width:r,height:n,$:l}}function Ko(e){return Ee(e)?e:e.contextElement}function vt(e){const t=Ko(e);if(!We(t))return Oe(1);const r=t.getBoundingClientRect(),{width:n,height:s,$:a}=za(t);let i=(a?ar(r.width):r.width)/n,l=(a?ar(r.height):r.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const hm=Oe(0);function Va(e){const t=be(e);return!Zo()||!t.visualViewport?hm:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xm(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==be(e)?!1:t}function ct(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),a=Ko(e);let i=Oe(1);t&&(n?Ee(n)&&(i=vt(n)):i=vt(e));const l=xm(a,r,n)?Va(a):Oe(0);let c=(s.left+l.x)/i.x,d=(s.top+l.y)/i.y,m=s.width/i.x,p=s.height/i.y;if(a){const f=be(a),x=n&&Ee(n)?be(n):n;let g=f,h=co(g);for(;h&&n&&x!==g;){const v=vt(h),b=h.getBoundingClientRect(),w=Ae(h),N=b.left+(h.clientLeft+parseFloat(w.paddingLeft))*v.x,C=b.top+(h.clientTop+parseFloat(w.paddingTop))*v.y;c*=v.x,d*=v.y,m*=v.x,p*=v.y,c+=N,d+=C,g=be(h),h=co(g)}}return lr({width:m,height:p,x:c,y:d})}function Er(e,t){const r=Rr(e).scrollLeft;return t?t.left+r:ct(De(e)).left+r}function Ba(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-Er(e,r),s=r.top+t.scrollTop;return{x:n,y:s}}function gm(e){let{elements:t,rect:r,offsetParent:n,strategy:s}=e;const a=s==="fixed",i=De(n),l=t?Pr(t.floating):!1;if(n===i||l&&a)return r;let c={scrollLeft:0,scrollTop:0},d=Oe(1);const m=Oe(0),p=We(n);if((p||!p&&!a)&&((Pt(n)!=="body"||Ft(i))&&(c=Rr(n)),p)){const x=ct(n);d=vt(n),m.x=x.x+n.clientLeft,m.y=x.y+n.clientTop}const f=i&&!p&&!a?Ba(i,c):Oe(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-c.scrollLeft*d.x+m.x+f.x,y:r.y*d.y-c.scrollTop*d.y+m.y+f.y}}function vm(e){return Array.from(e.getClientRects())}function bm(e){const t=De(e),r=Rr(e),n=e.ownerDocument.body,s=ve(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),a=ve(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+Er(e);const l=-r.scrollTop;return Ae(n).direction==="rtl"&&(i+=ve(t.clientWidth,n.clientWidth)-s),{width:s,height:a,x:i,y:l}}const Wn=25;function ym(e,t){const r=be(e),n=De(e),s=r.visualViewport;let a=n.clientWidth,i=n.clientHeight,l=0,c=0;if(s){a=s.width,i=s.height;const m=Zo();(!m||m&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const d=Er(n);if(d<=0){const m=n.ownerDocument,p=m.body,f=getComputedStyle(p),x=m.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,g=Math.abs(n.clientWidth-p.clientWidth-x);g<=Wn&&(a-=g)}else d<=Wn&&(a+=d);return{width:a,height:i,x:l,y:c}}function wm(e,t){const r=ct(e,!0,t==="fixed"),n=r.top+e.clientTop,s=r.left+e.clientLeft,a=We(e)?vt(e):Oe(1),i=e.clientWidth*a.x,l=e.clientHeight*a.y,c=s*a.x,d=n*a.y;return{width:i,height:l,x:c,y:d}}function Hn(e,t,r){let n;if(t==="viewport")n=ym(e,r);else if(t==="document")n=bm(De(e));else if(Ee(t))n=wm(t,r);else{const s=Va(e);n={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return lr(n)}function Wa(e,t){const r=Qe(e);return r===t||!Ee(r)||wt(r)?!1:Ae(r).position==="fixed"||Wa(r,t)}function Nm(e,t){const r=t.get(e);if(r)return r;let n=_t(e,[],!1).filter(l=>Ee(l)&&Pt(l)!=="body"),s=null;const a=Ae(e).position==="fixed";let i=a?Qe(e):e;for(;Ee(i)&&!wt(i);){const l=Ae(i),c=Yo(i);!c&&l.position==="fixed"&&(s=null),(a?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Ft(i)&&!c&&Wa(e,i))?n=n.filter(m=>m!==i):s=l,i=Qe(i)}return t.set(e,n),n}function Cm(e){let{element:t,boundary:r,rootBoundary:n,strategy:s}=e;const i=[...r==="clippingAncestors"?Pr(t)?[]:Nm(t,this._c):[].concat(r),n],l=Hn(t,i[0],s);let c=l.top,d=l.right,m=l.bottom,p=l.left;for(let f=1;f<i.length;f++){const x=Hn(t,i[f],s);c=ve(x.top,c),d=Je(x.right,d),m=Je(x.bottom,m),p=ve(x.left,p)}return{width:d-p,height:m-c,x:p,y:c}}function jm(e){const{width:t,height:r}=za(e);return{width:t,height:r}}function Sm(e,t,r){const n=We(t),s=De(t),a=r==="fixed",i=ct(e,!0,a,t);let l={scrollLeft:0,scrollTop:0};const c=Oe(0);function d(){c.x=Er(s)}if(n||!n&&!a)if((Pt(t)!=="body"||Ft(s))&&(l=Rr(t)),n){const x=ct(t,!0,a,t);c.x=x.x+t.clientLeft,c.y=x.y+t.clientTop}else s&&d();a&&!n&&s&&d();const m=s&&!n&&!a?Ba(s,l):Oe(0),p=i.left+l.scrollLeft-c.x-m.x,f=i.top+l.scrollTop-c.y-m.y;return{x:p,y:f,width:i.width,height:i.height}}function eo(e){return Ae(e).position==="static"}function Un(e,t){if(!We(e)||Ae(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return De(e)===r&&(r=r.ownerDocument.body),r}function Ha(e,t){const r=be(e);if(Pr(e))return r;if(!We(e)){let s=Qe(e);for(;s&&!wt(s);){if(Ee(s)&&!eo(s))return s;s=Qe(s)}return r}let n=Un(e,t);for(;n&&um(n)&&eo(n);)n=Un(n,t);return n&&wt(n)&&eo(n)&&!Yo(n)?r:n||fm(e)||r}const Pm=async function(e){const t=this.getOffsetParent||Ha,r=this.getDimensions,n=await r(e.floating);return{reference:Sm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Rm(e){return Ae(e).direction==="rtl"}const Em={convertOffsetParentRelativeRectToViewportRelativeRect:gm,getDocumentElement:De,getClippingRect:Cm,getOffsetParent:Ha,getElementRects:Pm,getClientRects:vm,getDimensions:jm,getScale:vt,isElement:Ee,isRTL:Rm};function Ua(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Am(e,t){let r=null,n;const s=De(e);function a(){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),a();const d=e.getBoundingClientRect(),{left:m,top:p,width:f,height:x}=d;if(l||t(),!f||!x)return;const g=Kt(p),h=Kt(s.clientWidth-(m+f)),v=Kt(s.clientHeight-(p+x)),b=Kt(m),N={rootMargin:-g+"px "+-h+"px "+-v+"px "+-b+"px",threshold:ve(0,Je(1,c))||1};let C=!0;function j(S){const P=S[0].intersectionRatio;if(P!==c){if(!C)return i();P?i(!1,P):n=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!Ua(d,e.getBoundingClientRect())&&i(),C=!1}try{r=new IntersectionObserver(j,{...N,root:s.ownerDocument})}catch{r=new IntersectionObserver(j,N)}r.observe(e)}return i(!0),a}function km(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,d=Ko(e),m=s||a?[...d?_t(d):[],...t?_t(t):[]]:[];m.forEach(b=>{s&&b.addEventListener("scroll",r,{passive:!0}),a&&b.addEventListener("resize",r)});const p=d&&l?Am(d,r):null;let f=-1,x=null;i&&(x=new ResizeObserver(b=>{let[w]=b;w&&w.target===d&&x&&t&&(x.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var N;(N=x)==null||N.observe(t)})),r()}),d&&!c&&x.observe(d),t&&x.observe(t));let g,h=c?ct(e):null;c&&v();function v(){const b=ct(e);h&&!Ua(h,b)&&r(),h=b,g=requestAnimationFrame(v)}return r(),()=>{var b;m.forEach(w=>{s&&w.removeEventListener("scroll",r),a&&w.removeEventListener("resize",r)}),p==null||p(),(b=x)==null||b.disconnect(),x=null,c&&cancelAnimationFrame(g)}}const Tm=im,Im=lm,Lm=nm,Om=dm,_m=sm,Gn=om,Dm=cm,Mm=(e,t,r)=>{const n=new Map,s={platform:Em,...r},a={...s.platform,_c:n};return rm(e,t,{...s,platform:a})};var $m=typeof document<"u",Fm=function(){},er=$m?_.useLayoutEffect:Fm;function cr(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,s;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(!cr(e[n],t[n]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,s[n]))return!1;for(n=r;n--!==0;){const a=s[n];if(!(a==="_owner"&&e.$$typeof)&&!cr(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function Ga(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qn(e,t){const r=Ga(e);return Math.round(t*r)/r}function to(e){const t=u.useRef(e);return er(()=>{t.current=e}),t}function zm(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:a,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[m,p]=u.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[f,x]=u.useState(n);cr(f,n)||x(n);const[g,h]=u.useState(null),[v,b]=u.useState(null),w=u.useCallback(R=>{R!==S.current&&(S.current=R,h(R))},[]),N=u.useCallback(R=>{R!==P.current&&(P.current=R,b(R))},[]),C=a||g,j=i||v,S=u.useRef(null),P=u.useRef(null),y=u.useRef(m),E=c!=null,I=to(c),L=to(s),D=to(d),z=u.useCallback(()=>{if(!S.current||!P.current)return;const R={placement:t,strategy:r,middleware:f};L.current&&(R.platform=L.current),Mm(S.current,P.current,R).then(V=>{const O={...V,isPositioned:D.current!==!1};M.current&&!cr(y.current,O)&&(y.current=O,fr.flushSync(()=>{p(O)}))})},[f,t,r,L,D]);er(()=>{d===!1&&y.current.isPositioned&&(y.current.isPositioned=!1,p(R=>({...R,isPositioned:!1})))},[d]);const M=u.useRef(!1);er(()=>(M.current=!0,()=>{M.current=!1}),[]),er(()=>{if(C&&(S.current=C),j&&(P.current=j),C&&j){if(I.current)return I.current(C,j,z);z()}},[C,j,z,I,E]);const $=u.useMemo(()=>({reference:S,floating:P,setReference:w,setFloating:N}),[w,N]),A=u.useMemo(()=>({reference:C,floating:j}),[C,j]),T=u.useMemo(()=>{const R={position:r,left:0,top:0};if(!A.floating)return R;const V=qn(A.floating,m.x),O=qn(A.floating,m.y);return l?{...R,transform:"translate("+V+"px, "+O+"px)",...Ga(A.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:V,top:O}},[r,l,A.floating,m.x,m.y]);return u.useMemo(()=>({...m,update:z,refs:$,elements:A,floatingStyles:T}),[m,z,$,A,T])}const Vm=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:s}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?Gn({element:n.current,padding:s}).fn(r):{}:n?Gn({element:n,padding:s}).fn(r):{}}}},Bm=(e,t)=>{const r=Tm(e);return{name:r.name,fn:r.fn,options:[e,t]}},Wm=(e,t)=>{const r=Im(e);return{name:r.name,fn:r.fn,options:[e,t]}},Hm=(e,t)=>({fn:Dm(e).fn,options:[e,t]}),Um=(e,t)=>{const r=Lm(e);return{name:r.name,fn:r.fn,options:[e,t]}},Gm=(e,t)=>{const r=Om(e);return{name:r.name,fn:r.fn,options:[e,t]}},qm=(e,t)=>{const r=_m(e);return{name:r.name,fn:r.fn,options:[e,t]}},Xm=(e,t)=>{const r=Vm(e);return{name:r.name,fn:r.fn,options:[e,t]}};var Ym="Arrow",qa=u.forwardRef((e,t)=>{const{children:r,width:n=10,height:s=5,...a}=e;return o.jsx(Q.svg,{...a,ref:t,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});qa.displayName=Ym;var Zm=qa,Jo="Popper",[Xa,Rt]=Be(Jo),[Km,Ya]=Xa(Jo),Za=e=>{const{__scopePopper:t,children:r}=e,[n,s]=u.useState(null);return o.jsx(Km,{scope:t,anchor:n,onAnchorChange:s,children:r})};Za.displayName=Jo;var Ka="PopperAnchor",Ja=u.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...s}=e,a=Ya(Ka,r),i=u.useRef(null),l=re(t,i),c=u.useRef(null);return u.useEffect(()=>{const d=c.current;c.current=(n==null?void 0:n.current)||i.current,d!==c.current&&a.onAnchorChange(c.current)}),n?null:o.jsx(Q.div,{...s,ref:l})});Ja.displayName=Ka;var Qo="PopperContent",[Jm,Qm]=Xa(Qo),Qa=u.forwardRef((e,t)=>{var F,oe,K,J,G,ee;const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:a="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:m=0,sticky:p="partial",hideWhenDetached:f=!1,updatePositionStrategy:x="optimized",onPlaced:g,...h}=e,v=Ya(Qo,r),[b,w]=u.useState(null),N=re(t,ue=>w(ue)),[C,j]=u.useState(null),S=Lo(C),P=(S==null?void 0:S.width)??0,y=(S==null?void 0:S.height)??0,E=n+(a!=="center"?"-"+a:""),I=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},L=Array.isArray(d)?d:[d],D=L.length>0,z={padding:I,boundary:L.filter(tp),altBoundary:D},{refs:M,floatingStyles:$,placement:A,isPositioned:T,middlewareData:R}=zm({strategy:"fixed",placement:E,whileElementsMounted:(...ue)=>km(...ue,{animationFrame:x==="always"}),elements:{reference:v.anchor},middleware:[Bm({mainAxis:s+y,alignmentAxis:i}),c&&Wm({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Hm():void 0,...z}),c&&Um({...z}),Gm({...z,apply:({elements:ue,rects:ce,availableWidth:He,availableHeight:Ue})=>{const{width:kt,height:Fl}=ce.reference,Wt=ue.floating.style;Wt.setProperty("--radix-popper-available-width",`${He}px`),Wt.setProperty("--radix-popper-available-height",`${Ue}px`),Wt.setProperty("--radix-popper-anchor-width",`${kt}px`),Wt.setProperty("--radix-popper-anchor-height",`${Fl}px`)}}),C&&Xm({element:C,padding:l}),rp({arrowWidth:P,arrowHeight:y}),f&&qm({strategy:"referenceHidden",...z})]}),[V,O]=ri(A),q=ge(g);he(()=>{T&&(q==null||q())},[T,q]);const se=(F=R.arrow)==null?void 0:F.x,ie=(oe=R.arrow)==null?void 0:oe.y,X=((K=R.arrow)==null?void 0:K.centerOffset)!==0,[ne,ae]=u.useState();return he(()=>{b&&ae(window.getComputedStyle(b).zIndex)},[b]),o.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:T?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[(J=R.transformOrigin)==null?void 0:J.x,(G=R.transformOrigin)==null?void 0:G.y].join(" "),...((ee=R.hide)==null?void 0:ee.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(Jm,{scope:r,placedSide:V,onArrowChange:j,arrowX:se,arrowY:ie,shouldHideArrow:X,children:o.jsx(Q.div,{"data-side":V,"data-align":O,...h,ref:N,style:{...h.style,animation:T?void 0:"none"}})})})});Qa.displayName=Qo;var ei="PopperArrow",ep={top:"bottom",right:"left",bottom:"top",left:"right"},ti=u.forwardRef(function(t,r){const{__scopePopper:n,...s}=t,a=Qm(ei,n),i=ep[a.placedSide];return o.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]: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(Zm,{...s,ref:r,style:{...s.style,display:"block"}})})});ti.displayName=ei;function tp(e){return e!==null}var rp=e=>({name:"transformOrigin",options:e,fn(t){var v,b,w;const{placement:r,rects:n,middlewareData:s}=t,i=((v=s.arrow)==null?void 0:v.centerOffset)!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,m]=ri(r),p={start:"0%",center:"50%",end:"100%"}[m],f=(((b=s.arrow)==null?void 0:b.x)??0)+l/2,x=(((w=s.arrow)==null?void 0:w.y)??0)+c/2;let g="",h="";return d==="bottom"?(g=i?p:`${f}px`,h=`${-c}px`):d==="top"?(g=i?p:`${f}px`,h=`${n.floating.height+c}px`):d==="right"?(g=`${-c}px`,h=i?p:`${x}px`):d==="left"&&(g=`${n.floating.width+c}px`,h=i?p:`${x}px`),{data:{x:g,y:h}}}});function ri(e){const[t,r="center"]=e.split("-");return[t,r]}var en=Za,Ar=Ja,tn=Qa,rn=ti,kr="Popover",[oi]=Be(kr,[Rt]),zt=Rt(),[op,tt]=oi(kr),ni=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:s,onOpenChange:a,modal:i=!1}=e,l=zt(t),c=u.useRef(null),[d,m]=u.useState(!1),[p,f]=it({prop:n,defaultProp:s??!1,onChange:a,caller:kr});return o.jsx(en,{...l,children:o.jsx(op,{scope:t,contentId:Ke(),triggerRef:c,open:p,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(x=>!x),[f]),hasCustomAnchor:d,onCustomAnchorAdd:u.useCallback(()=>m(!0),[]),onCustomAnchorRemove:u.useCallback(()=>m(!1),[]),modal:i,children:r})})};ni.displayName=kr;var si="PopoverAnchor",np=u.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=tt(si,r),a=zt(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=s;return u.useEffect(()=>(i(),()=>l()),[i,l]),o.jsx(Ar,{...a,...n,ref:t})});np.displayName=si;var ai="PopoverTrigger",ii=u.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=tt(ai,r),a=zt(r),i=re(t,s.triggerRef),l=o.jsx(Q.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":mi(s.open),...n,ref:i,onClick:Z(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:o.jsx(Ar,{asChild:!0,...a,children:l})});ii.displayName=ai;var on="PopoverPortal",[sp,ap]=oi(on,{forceMount:void 0}),li=e=>{const{__scopePopover:t,forceMount:r,children:n,container:s}=e,a=tt(on,t);return o.jsx(sp,{scope:t,forceMount:r,children:o.jsx(Se,{present:r||a.open,children:o.jsx(wr,{asChild:!0,container:s,children:n})})})};li.displayName=on;var Nt="PopoverContent",ci=u.forwardRef((e,t)=>{const r=ap(Nt,e.__scopePopover),{forceMount:n=r.forceMount,...s}=e,a=tt(Nt,e.__scopePopover);return o.jsx(Se,{present:n||a.open,children:a.modal?o.jsx(lp,{...s,ref:t}):o.jsx(cp,{...s,ref:t})})});ci.displayName=Nt;var ip=bt("PopoverContent.RemoveScroll"),lp=u.forwardRef((e,t)=>{const r=tt(Nt,e.__scopePopover),n=u.useRef(null),s=re(t,n),a=u.useRef(!1);return u.useEffect(()=>{const i=n.current;if(i)return Bo(i)},[]),o.jsx(Cr,{as:ip,allowPinchZoom:!0,children:o.jsx(di,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Z(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),a.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Z(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;a.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Z(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),cp=u.forwardRef((e,t)=>{const r=tt(Nt,e.__scopePopover),n=u.useRef(!1),s=u.useRef(!1);return o.jsx(di,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,a),a.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),a.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:a=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=a.target;((d=r.triggerRef.current)==null?void 0:d.contains(i))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),di=u.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:m,...p}=e,f=tt(Nt,r),x=zt(r);return Vo(),o.jsx(yr,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx($t,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:m,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>f.onOpenChange(!1),children:o.jsx(tn,{"data-state":mi(f.open),role:"dialog",id:f.contentId,...x,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ui="PopoverClose",dp=u.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=tt(ui,r);return o.jsx(Q.button,{type:"button",...n,ref:t,onClick:Z(e.onClick,()=>s.onOpenChange(!1))})});dp.displayName=ui;var up="PopoverArrow",mp=u.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=zt(r);return o.jsx(rn,{...s,...n,ref:t})});mp.displayName=up;function mi(e){return e?"open":"closed"}var pp=ni,fp=ii,hp=li,pi=ci;const Tr=pp,Ir=fp,Vt=u.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>o.jsx(hp,{children:o.jsx(pi,{ref:s,align:t,sideOffset:r,className:U("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})}));Vt.displayName=pi.displayName;const $e=({onInsert:e})=>{const[t,r]=_.useState(null),n=async s=>{const a=`{{${s}}}`;try{await navigator.clipboard.writeText(a)}catch{const i=document.createElement("textarea");i.value=a,i.style.position="fixed",i.style.opacity="0",document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i)}e&&e(a),r(s),setTimeout(()=>r(null),1500)};return o.jsxs(Tr,{children:[o.jsx(Ir,{asChild:!0,children:o.jsx(le,{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(k.Braces,{className:"h-3.5 w-3.5"})})}),o.jsxs(Vt,{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:Ro.map(s=>{const a=t===s.key;return o.jsxs("button",{type:"button",onClick:()=>n(s.key),className:U("w-full flex items-center justify-between px-3 py-1.5 text-left hover:bg-accent transition-colors",a&&"bg-primary/10"),children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xs font-medium truncate",children:s.label}),o.jsx("code",{className:"text-[10px] text-muted-foreground font-mono",children:`{{${s.key}}}`})]}),o.jsx("div",{className:"ml-2 shrink-0",children:a?o.jsx(k.Check,{className:"h-3.5 w-3.5 text-primary"}):o.jsx(k.Braces,{className:"h-3 w-3 text-muted-foreground/50"})})]},s.key)})})]})]})},xp=({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(B,{className:"text-xs",children:"Label"}),o.jsx($e,{})]}),o.jsx(Y,{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(B,{className:"text-xs",children:"Descrição"}),o.jsx($e,{})]}),o.jsx(Y,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do step"})]}),o.jsx(_a,{value:e.icone,onChange:r=>t({icone:r})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{id:"step-show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(B,{htmlFor:"step-show-label",className:"text-xs cursor-pointer",children:"Exibir título no formulário"})]})]});function fi(e){const t=e+"CollectionProvider",[r,n]=Be(t),[s,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:v,children:b}=h,w=_.useRef(null),N=_.useRef(new Map).current;return o.jsx(s,{scope:v,itemMap:N,collectionRef:w,children:b})};i.displayName=t;const l=e+"CollectionSlot",c=bt(l),d=_.forwardRef((h,v)=>{const{scope:b,children:w}=h,N=a(l,b),C=re(v,N.collectionRef);return o.jsx(c,{ref:C,children:w})});d.displayName=l;const m=e+"CollectionItemSlot",p="data-radix-collection-item",f=bt(m),x=_.forwardRef((h,v)=>{const{scope:b,children:w,...N}=h,C=_.useRef(null),j=re(v,C),S=a(m,b);return _.useEffect(()=>(S.itemMap.set(C,{ref:C,...N}),()=>void S.itemMap.delete(C))),o.jsx(f,{[p]:"",ref:j,children:w})});x.displayName=m;function g(h){const v=a(e+"CollectionConsumer",h);return _.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const N=Array.from(w.querySelectorAll(`[${p}]`));return Array.from(v.itemMap.values()).sort((S,P)=>N.indexOf(S.ref.current)-N.indexOf(P.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:d,ItemSlot:x},g,n]}var hi=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"}),gp="VisuallyHidden",xi=u.forwardRef((e,t)=>o.jsx(Q.span,{...e,ref:t,style:{...hi,...e.style}}));xi.displayName=gp;var vp=xi,bp=[" ","Enter","ArrowUp","ArrowDown"],yp=[" ","Enter"],dt="Select",[Lr,Or,wp]=fi(dt),[Et]=Be(dt,[wp,Rt]),_r=Rt(),[Np,rt]=Et(dt),[Cp,jp]=Et(dt),gi=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:a,value:i,defaultValue:l,onValueChange:c,dir:d,name:m,autoComplete:p,disabled:f,required:x,form:g}=e,h=_r(t),[v,b]=u.useState(null),[w,N]=u.useState(null),[C,j]=u.useState(!1),S=Do(d),[P,y]=it({prop:n,defaultProp:s??!1,onChange:a,caller:dt}),[E,I]=it({prop:i,defaultProp:l,onChange:c,caller:dt}),L=u.useRef(null),D=v?g||!!v.closest("form"):!0,[z,M]=u.useState(new Set),$=Array.from(z).map(A=>A.props.value).join(";");return o.jsx(en,{...h,children:o.jsxs(Np,{required:x,scope:t,trigger:v,onTriggerChange:b,valueNode:w,onValueNodeChange:N,valueNodeHasChildren:C,onValueNodeHasChildrenChange:j,contentId:Ke(),value:E,onValueChange:I,open:P,onOpenChange:y,dir:S,triggerPointerDownPosRef:L,disabled:f,children:[o.jsx(Lr.Provider,{scope:t,children:o.jsx(Cp,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(A=>{M(T=>new Set(T).add(A))},[]),onNativeOptionRemove:u.useCallback(A=>{M(T=>{const R=new Set(T);return R.delete(A),R})},[]),children:r})}),D?o.jsxs(Vi,{"aria-hidden":!0,required:x,tabIndex:-1,name:m,autoComplete:p,value:E,onChange:A=>I(A.target.value),disabled:f,form:g,children:[E===void 0?o.jsx("option",{value:""}):null,Array.from(z)]},$):null]})})};gi.displayName=dt;var vi="SelectTrigger",bi=u.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,a=_r(r),i=rt(vi,r),l=i.disabled||n,c=re(t,i.onTriggerChange),d=Or(r),m=u.useRef("touch"),[p,f,x]=Wi(h=>{const v=d().filter(N=>!N.disabled),b=v.find(N=>N.value===i.value),w=Hi(v,h,b);w!==void 0&&i.onValueChange(w.value)}),g=h=>{l||(i.onOpenChange(!0),x()),h&&(i.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return o.jsx(Ar,{asChild:!0,...a,children:o.jsx(Q.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":Bi(i.value)?"":void 0,...s,ref:c,onClick:Z(s.onClick,h=>{h.currentTarget.focus(),m.current!=="mouse"&&g(h)}),onPointerDown:Z(s.onPointerDown,h=>{m.current=h.pointerType;const v=h.target;v.hasPointerCapture(h.pointerId)&&v.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(g(h),h.preventDefault())}),onKeyDown:Z(s.onKeyDown,h=>{const v=p.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(v&&h.key===" ")&&bp.includes(h.key)&&(g(),h.preventDefault())})})})});bi.displayName=vi;var yi="SelectValue",wi=u.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:a,placeholder:i="",...l}=e,c=rt(yi,r),{onValueNodeHasChildrenChange:d}=c,m=a!==void 0,p=re(t,c.onValueNodeChange);return he(()=>{d(m)},[d,m]),o.jsx(Q.span,{...l,ref:p,style:{pointerEvents:"none"},children:Bi(c.value)?o.jsx(o.Fragment,{children:i}):a})});wi.displayName=yi;var Sp="SelectIcon",Ni=u.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return o.jsx(Q.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});Ni.displayName=Sp;var Pp="SelectPortal",Ci=e=>o.jsx(wr,{asChild:!0,...e});Ci.displayName=Pp;var ut="SelectContent",ji=u.forwardRef((e,t)=>{const r=rt(ut,e.__scopeSelect),[n,s]=u.useState();if(he(()=>{s(new DocumentFragment)},[]),!r.open){const a=n;return a?fr.createPortal(o.jsx(Si,{scope:e.__scopeSelect,children:o.jsx(Lr.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),a):null}return o.jsx(Pi,{...e,ref:t})});ji.displayName=ut;var Re=10,[Si,ot]=Et(ut),Rp="SelectContentImpl",Ep=bt("SelectContent.RemoveScroll"),Pi=u.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:m,arrowPadding:p,collisionBoundary:f,collisionPadding:x,sticky:g,hideWhenDetached:h,avoidCollisions:v,...b}=e,w=rt(ut,r),[N,C]=u.useState(null),[j,S]=u.useState(null),P=re(t,F=>C(F)),[y,E]=u.useState(null),[I,L]=u.useState(null),D=Or(r),[z,M]=u.useState(!1),$=u.useRef(!1);u.useEffect(()=>{if(N)return Bo(N)},[N]),Vo();const A=u.useCallback(F=>{const[oe,...K]=D().map(ee=>ee.ref.current),[J]=K.slice(-1),G=document.activeElement;for(const ee of F)if(ee===G||(ee==null||ee.scrollIntoView({block:"nearest"}),ee===oe&&j&&(j.scrollTop=0),ee===J&&j&&(j.scrollTop=j.scrollHeight),ee==null||ee.focus(),document.activeElement!==G))return},[D,j]),T=u.useCallback(()=>A([y,N]),[A,y,N]);u.useEffect(()=>{z&&T()},[z,T]);const{onOpenChange:R,triggerPointerDownPosRef:V}=w;u.useEffect(()=>{if(N){let F={x:0,y:0};const oe=J=>{var G,ee;F={x:Math.abs(Math.round(J.pageX)-(((G=V.current)==null?void 0:G.x)??0)),y:Math.abs(Math.round(J.pageY)-(((ee=V.current)==null?void 0:ee.y)??0))}},K=J=>{F.x<=10&&F.y<=10?J.preventDefault():N.contains(J.target)||R(!1),document.removeEventListener("pointermove",oe),V.current=null};return V.current!==null&&(document.addEventListener("pointermove",oe),document.addEventListener("pointerup",K,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",oe),document.removeEventListener("pointerup",K,{capture:!0})}}},[N,R,V]),u.useEffect(()=>{const F=()=>R(!1);return window.addEventListener("blur",F),window.addEventListener("resize",F),()=>{window.removeEventListener("blur",F),window.removeEventListener("resize",F)}},[R]);const[O,q]=Wi(F=>{const oe=D().filter(G=>!G.disabled),K=oe.find(G=>G.ref.current===document.activeElement),J=Hi(oe,F,K);J&&setTimeout(()=>J.ref.current.focus())}),se=u.useCallback((F,oe,K)=>{const J=!$.current&&!K;(w.value!==void 0&&w.value===oe||J)&&(E(F),J&&($.current=!0))},[w.value]),ie=u.useCallback(()=>N==null?void 0:N.focus(),[N]),X=u.useCallback((F,oe,K)=>{const J=!$.current&&!K;(w.value!==void 0&&w.value===oe||J)&&L(F)},[w.value]),ne=n==="popper"?uo:Ri,ae=ne===uo?{side:l,sideOffset:c,align:d,alignOffset:m,arrowPadding:p,collisionBoundary:f,collisionPadding:x,sticky:g,hideWhenDetached:h,avoidCollisions:v}:{};return o.jsx(Si,{scope:r,content:N,viewport:j,onViewportChange:S,itemRefCallback:se,selectedItem:y,onItemLeave:ie,itemTextRefCallback:X,focusSelectedItem:T,selectedItemText:I,position:n,isPositioned:z,searchRef:O,children:o.jsx(Cr,{as:Ep,allowPinchZoom:!0,children:o.jsx(yr,{asChild:!0,trapped:w.open,onMountAutoFocus:F=>{F.preventDefault()},onUnmountAutoFocus:Z(s,F=>{var oe;(oe=w.trigger)==null||oe.focus({preventScroll:!0}),F.preventDefault()}),children:o.jsx($t,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:F=>F.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:o.jsx(ne,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:F=>F.preventDefault(),...b,...ae,onPlaced:()=>M(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Z(b.onKeyDown,F=>{const oe=F.ctrlKey||F.altKey||F.metaKey;if(F.key==="Tab"&&F.preventDefault(),!oe&&F.key.length===1&&q(F.key),["ArrowUp","ArrowDown","Home","End"].includes(F.key)){let J=D().filter(G=>!G.disabled).map(G=>G.ref.current);if(["ArrowUp","End"].includes(F.key)&&(J=J.slice().reverse()),["ArrowUp","ArrowDown"].includes(F.key)){const G=F.target,ee=J.indexOf(G);J=J.slice(ee+1)}setTimeout(()=>A(J)),F.preventDefault()}})})})})})})});Pi.displayName=Rp;var Ap="SelectItemAlignedPosition",Ri=u.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,a=rt(ut,r),i=ot(ut,r),[l,c]=u.useState(null),[d,m]=u.useState(null),p=re(t,P=>m(P)),f=Or(r),x=u.useRef(!1),g=u.useRef(!0),{viewport:h,selectedItem:v,selectedItemText:b,focusSelectedItem:w}=i,N=u.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&d&&h&&v&&b){const P=a.trigger.getBoundingClientRect(),y=d.getBoundingClientRect(),E=a.valueNode.getBoundingClientRect(),I=b.getBoundingClientRect();if(a.dir!=="rtl"){const G=I.left-y.left,ee=E.left-G,ue=P.left-ee,ce=P.width+ue,He=Math.max(ce,y.width),Ue=window.innerWidth-Re,kt=Ot(ee,[Re,Math.max(Re,Ue-He)]);l.style.minWidth=ce+"px",l.style.left=kt+"px"}else{const G=y.right-I.right,ee=window.innerWidth-E.right-G,ue=window.innerWidth-P.right-ee,ce=P.width+ue,He=Math.max(ce,y.width),Ue=window.innerWidth-Re,kt=Ot(ee,[Re,Math.max(Re,Ue-He)]);l.style.minWidth=ce+"px",l.style.right=kt+"px"}const L=f(),D=window.innerHeight-Re*2,z=h.scrollHeight,M=window.getComputedStyle(d),$=parseInt(M.borderTopWidth,10),A=parseInt(M.paddingTop,10),T=parseInt(M.borderBottomWidth,10),R=parseInt(M.paddingBottom,10),V=$+A+z+R+T,O=Math.min(v.offsetHeight*5,V),q=window.getComputedStyle(h),se=parseInt(q.paddingTop,10),ie=parseInt(q.paddingBottom,10),X=P.top+P.height/2-Re,ne=D-X,ae=v.offsetHeight/2,F=v.offsetTop+ae,oe=$+A+F,K=V-oe;if(oe<=X){const G=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const ee=d.clientHeight-h.offsetTop-h.offsetHeight,ue=Math.max(ne,ae+(G?ie:0)+ee+T),ce=oe+ue;l.style.height=ce+"px"}else{const G=L.length>0&&v===L[0].ref.current;l.style.top="0px";const ue=Math.max(X,$+h.offsetTop+(G?se:0)+ae)+K;l.style.height=ue+"px",h.scrollTop=oe-X+h.offsetTop}l.style.margin=`${Re}px 0`,l.style.minHeight=O+"px",l.style.maxHeight=D+"px",n==null||n(),requestAnimationFrame(()=>x.current=!0)}},[f,a.trigger,a.valueNode,l,d,h,v,b,a.dir,n]);he(()=>N(),[N]);const[C,j]=u.useState();he(()=>{d&&j(window.getComputedStyle(d).zIndex)},[d]);const S=u.useCallback(P=>{P&&g.current===!0&&(N(),w==null||w(),g.current=!1)},[N,w]);return o.jsx(Tp,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:x,onScrollButtonChange:S,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:o.jsx(Q.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Ri.displayName=Ap;var kp="SelectPopperPosition",uo=u.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=Re,...a}=e,i=_r(r);return o.jsx(tn,{...i,...a,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...a.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)"}})});uo.displayName=kp;var[Tp,nn]=Et(ut,{}),mo="SelectViewport",Ei=u.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,a=ot(mo,r),i=nn(mo,r),l=re(t,a.onViewportChange),c=u.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(Lr.Slot,{scope:r,children:o.jsx(Q.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Z(s.onScroll,d=>{const m=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:f}=i;if(f!=null&&f.current&&p){const x=Math.abs(c.current-m.scrollTop);if(x>0){const g=window.innerHeight-Re*2,h=parseFloat(p.style.minHeight),v=parseFloat(p.style.height),b=Math.max(h,v);if(b<g){const w=b+x,N=Math.min(g,w),C=w-N;p.style.height=N+"px",p.style.bottom==="0px"&&(m.scrollTop=C>0?C:0,p.style.justifyContent="flex-end")}}}c.current=m.scrollTop})})})]})});Ei.displayName=mo;var Ai="SelectGroup",[Ip,Lp]=Et(Ai),Op=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Ke();return o.jsx(Ip,{scope:r,id:s,children:o.jsx(Q.div,{role:"group","aria-labelledby":s,...n,ref:t})})});Op.displayName=Ai;var ki="SelectLabel",Ti=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Lp(ki,r);return o.jsx(Q.div,{id:s.id,...n,ref:t})});Ti.displayName=ki;var dr="SelectItem",[_p,Ii]=Et(dr),Li=u.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:a,...i}=e,l=rt(dr,r),c=ot(dr,r),d=l.value===n,[m,p]=u.useState(a??""),[f,x]=u.useState(!1),g=re(t,w=>{var N;return(N=c.itemRefCallback)==null?void 0:N.call(c,w,n,s)}),h=Ke(),v=u.useRef("touch"),b=()=>{s||(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(_p,{scope:r,value:n,disabled:s,textId:h,isSelected:d,onItemTextChange:u.useCallback(w=>{p(N=>N||((w==null?void 0:w.textContent)??"").trim())},[]),children:o.jsx(Lr.ItemSlot,{scope:r,value:n,disabled:s,textValue:m,children:o.jsx(Q.div,{role:"option","aria-labelledby":h,"data-highlighted":f?"":void 0,"aria-selected":d&&f,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:g,onFocus:Z(i.onFocus,()=>x(!0)),onBlur:Z(i.onBlur,()=>x(!1)),onClick:Z(i.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:Z(i.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:Z(i.onPointerDown,w=>{v.current=w.pointerType}),onPointerMove:Z(i.onPointerMove,w=>{var N;v.current=w.pointerType,s?(N=c.onItemLeave)==null||N.call(c):v.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Z(i.onPointerLeave,w=>{var N;w.currentTarget===document.activeElement&&((N=c.onItemLeave)==null||N.call(c))}),onKeyDown:Z(i.onKeyDown,w=>{var C;((C=c.searchRef)==null?void 0:C.current)!==""&&w.key===" "||(yp.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});Li.displayName=dr;var It="SelectItemText",Oi=u.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...a}=e,i=rt(It,r),l=ot(It,r),c=Ii(It,r),d=jp(It,r),[m,p]=u.useState(null),f=re(t,b=>p(b),c.onItemTextChange,b=>{var w;return(w=l.itemTextRefCallback)==null?void 0:w.call(l,b,c.value,c.disabled)}),x=m==null?void 0:m.textContent,g=u.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:x},c.value),[c.disabled,c.value,x]),{onNativeOptionAdd:h,onNativeOptionRemove:v}=d;return he(()=>(h(g),()=>v(g)),[h,v,g]),o.jsxs(o.Fragment,{children:[o.jsx(Q.span,{id:c.textId,...a,ref:f}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?fr.createPortal(a.children,i.valueNode):null]})});Oi.displayName=It;var _i="SelectItemIndicator",Di=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return Ii(_i,r).isSelected?o.jsx(Q.span,{"aria-hidden":!0,...n,ref:t}):null});Di.displayName=_i;var po="SelectScrollUpButton",Mi=u.forwardRef((e,t)=>{const r=ot(po,e.__scopeSelect),n=nn(po,e.__scopeSelect),[s,a]=u.useState(!1),i=re(t,n.onScrollButtonChange);return he(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollTop>0;a(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?o.jsx(Fi,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Mi.displayName=po;var fo="SelectScrollDownButton",$i=u.forwardRef((e,t)=>{const r=ot(fo,e.__scopeSelect),n=nn(fo,e.__scopeSelect),[s,a]=u.useState(!1),i=re(t,n.onScrollButtonChange);return he(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,m=Math.ceil(c.scrollTop)<d;a(m)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?o.jsx(Fi,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});$i.displayName=fo;var Fi=u.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,a=ot("SelectScrollButton",r),i=u.useRef(null),l=Or(r),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),he(()=>{var m;const d=l().find(p=>p.ref.current===document.activeElement);(m=d==null?void 0:d.ref.current)==null||m.scrollIntoView({block:"nearest"})},[l]),o.jsx(Q.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Z(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:Z(s.onPointerMove,()=>{var d;(d=a.onItemLeave)==null||d.call(a),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:Z(s.onPointerLeave,()=>{c()})})}),Dp="SelectSeparator",zi=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return o.jsx(Q.div,{"aria-hidden":!0,...n,ref:t})});zi.displayName=Dp;var ho="SelectArrow",Mp=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=_r(r),a=rt(ho,r),i=ot(ho,r);return a.open&&i.position==="popper"?o.jsx(rn,{...s,...n,ref:t}):null});Mp.displayName=ho;var $p="SelectBubbleInput",Vi=u.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const s=u.useRef(null),a=re(n,s),i=Io(t);return u.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&m){const p=new Event("change",{bubbles:!0});m.call(l,t),l.dispatchEvent(p)}},[i,t]),o.jsx(Q.select,{...r,style:{...hi,...r.style},ref:a,defaultValue:t})});Vi.displayName=$p;function Bi(e){return e===""||e===void 0}function Wi(e){const t=ge(e),r=u.useRef(""),n=u.useRef(0),s=u.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]),a=u.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,a]}function Hi(e,t,r){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let i=Fp(e,Math.max(a,0));s.length===1&&(i=i.filter(d=>d!==r));const c=i.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function Fp(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var zp=gi,Ui=bi,Vp=wi,Bp=Ni,Wp=Ci,Gi=ji,Hp=Ei,qi=Ti,Xi=Li,Up=Oi,Gp=Di,Yi=Mi,Zi=$i,Ki=zi;const Ce=zp,je=Vp,ye=u.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Ui,{ref:n,className:U("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(Bp,{asChild:!0,children:o.jsx(k.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));ye.displayName=Ui.displayName;const Ji=u.forwardRef(({className:e,...t},r)=>o.jsx(Yi,{ref:r,className:U("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(k.ChevronUp,{className:"h-4 w-4"})}));Ji.displayName=Yi.displayName;const Qi=u.forwardRef(({className:e,...t},r)=>o.jsx(Zi,{ref:r,className:U("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(k.ChevronDown,{className:"h-4 w-4"})}));Qi.displayName=Zi.displayName;const we=u.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>o.jsx(Wp,{children:o.jsxs(Gi,{ref:s,className:U("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(Ji,{}),o.jsx(Hp,{className:U("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(Qi,{})]})}));we.displayName=Gi.displayName;const qp=u.forwardRef(({className:e,...t},r)=>o.jsx(qi,{ref:r,className:U("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));qp.displayName=qi.displayName;const pe=u.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Xi,{ref:n,className:U("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(Gp,{children:o.jsx(k.Check,{className:"h-4 w-4"})})}),o.jsx(Up,{children:t})]}));pe.displayName=Xi.displayName;const Xp=u.forwardRef(({className:e,...t},r)=>o.jsx(Ki,{ref:r,className:U("-mx-1 my-1 h-px bg-muted",e),...t}));Xp.displayName=Ki.displayName;var el=["PageUp","PageDown"],tl=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],rl={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},At="Slider",[xo,Yp,Zp]=fi(At),[ol]=Be(At,[Zp]),[Kp,Dr]=ol(At),nl=u.forwardRef((e,t)=>{const{name:r,min:n=0,max:s=100,step:a=1,orientation:i="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[n],value:m,onValueChange:p=()=>{},onValueCommit:f=()=>{},inverted:x=!1,form:g,...h}=e,v=u.useRef(new Set),b=u.useRef(0),N=i==="horizontal"?Jp:Qp,[C=[],j]=it({prop:m,defaultProp:d,onChange:L=>{var z;(z=[...v.current][b.current])==null||z.focus(),p(L)}}),S=u.useRef(C);function P(L){const D=nf(C,L);I(L,D)}function y(L){I(L,b.current)}function E(){const L=S.current[b.current];C[b.current]!==L&&f(C)}function I(L,D,{commit:z}={commit:!1}){const M=cf(a),$=df(Math.round((L-n)/a)*a+n,M),A=Ot($,[n,s]);j((T=[])=>{const R=rf(T,A,D);if(lf(R,c*a)){b.current=R.indexOf(A);const V=String(R)!==String(T);return V&&z&&f(R),V?R:T}else return T})}return o.jsx(Kp,{scope:e.__scopeSlider,name:r,disabled:l,min:n,max:s,valueIndexToChangeRef:b,thumbs:v.current,values:C,orientation:i,form:g,children:o.jsx(xo.Provider,{scope:e.__scopeSlider,children:o.jsx(xo.Slot,{scope:e.__scopeSlider,children:o.jsx(N,{"aria-disabled":l,"data-disabled":l?"":void 0,...h,ref:t,onPointerDown:Z(h.onPointerDown,()=>{l||(S.current=C)}),min:n,max:s,inverted:x,onSlideStart:l?void 0:P,onSlideMove:l?void 0:y,onSlideEnd:l?void 0:E,onHomeKeyDown:()=>!l&&I(n,0,{commit:!0}),onEndKeyDown:()=>!l&&I(s,C.length-1,{commit:!0}),onStepKeyDown:({event:L,direction:D})=>{if(!l){const $=el.includes(L.key)||L.shiftKey&&tl.includes(L.key)?10:1,A=b.current,T=C[A],R=a*$*D;I(T+R,A,{commit:!0})}}})})})})});nl.displayName=At;var[sl,al]=ol(At,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Jp=u.forwardRef((e,t)=>{const{min:r,max:n,dir:s,inverted:a,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...m}=e,[p,f]=u.useState(null),x=re(t,N=>f(N)),g=u.useRef(void 0),h=Do(s),v=h==="ltr",b=v&&!a||!v&&a;function w(N){const C=g.current||p.getBoundingClientRect(),j=[0,C.width],P=sn(j,b?[r,n]:[n,r]);return g.current=C,P(N-C.left)}return o.jsx(sl,{scope:e.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:o.jsx(il,{dir:h,"data-orientation":"horizontal",...m,ref:x,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:N=>{const C=w(N.clientX);i==null||i(C)},onSlideMove:N=>{const C=w(N.clientX);l==null||l(C)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:N=>{const j=rl[b?"from-left":"from-right"].includes(N.key);d==null||d({event:N,direction:j?-1:1})}})})}),Qp=u.forwardRef((e,t)=>{const{min:r,max:n,inverted:s,onSlideStart:a,onSlideMove:i,onSlideEnd:l,onStepKeyDown:c,...d}=e,m=u.useRef(null),p=re(t,m),f=u.useRef(void 0),x=!s;function g(h){const v=f.current||m.current.getBoundingClientRect(),b=[0,v.height],N=sn(b,x?[n,r]:[r,n]);return f.current=v,N(h-v.top)}return o.jsx(sl,{scope:e.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:o.jsx(il,{"data-orientation":"vertical",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{const v=g(h.clientY);a==null||a(v)},onSlideMove:h=>{const v=g(h.clientY);i==null||i(v)},onSlideEnd:()=>{f.current=void 0,l==null||l()},onStepKeyDown:h=>{const b=rl[x?"from-bottom":"from-top"].includes(h.key);c==null||c({event:h,direction:b?-1:1})}})})}),il=u.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:n,onSlideMove:s,onSlideEnd:a,onHomeKeyDown:i,onEndKeyDown:l,onStepKeyDown:c,...d}=e,m=Dr(At,r);return o.jsx(Q.span,{...d,ref:t,onKeyDown:Z(e.onKeyDown,p=>{p.key==="Home"?(i(p),p.preventDefault()):p.key==="End"?(l(p),p.preventDefault()):el.concat(tl).includes(p.key)&&(c(p),p.preventDefault())}),onPointerDown:Z(e.onPointerDown,p=>{const f=p.target;f.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(f)?f.focus():n(p)}),onPointerMove:Z(e.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&s(p)}),onPointerUp:Z(e.onPointerUp,p=>{const f=p.target;f.hasPointerCapture(p.pointerId)&&(f.releasePointerCapture(p.pointerId),a(p))})})}),ll="SliderTrack",cl=u.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,s=Dr(ll,r);return o.jsx(Q.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...n,ref:t})});cl.displayName=ll;var go="SliderRange",dl=u.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,s=Dr(go,r),a=al(go,r),i=u.useRef(null),l=re(t,i),c=s.values.length,d=s.values.map(f=>pl(f,s.min,s.max)),m=c>1?Math.min(...d):0,p=100-Math.max(...d);return o.jsx(Q.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...n,ref:l,style:{...e.style,[a.startEdge]:m+"%",[a.endEdge]:p+"%"}})});dl.displayName=go;var vo="SliderThumb",ul=u.forwardRef((e,t)=>{const r=Yp(e.__scopeSlider),[n,s]=u.useState(null),a=re(t,l=>s(l)),i=u.useMemo(()=>n?r().findIndex(l=>l.ref.current===n):-1,[r,n]);return o.jsx(ef,{...e,ref:a,index:i})}),ef=u.forwardRef((e,t)=>{const{__scopeSlider:r,index:n,name:s,...a}=e,i=Dr(vo,r),l=al(vo,r),[c,d]=u.useState(null),m=re(t,w=>d(w)),p=c?i.form||!!c.closest("form"):!0,f=Lo(c),x=i.values[n],g=x===void 0?0:pl(x,i.min,i.max),h=of(n,i.values.length),v=f==null?void 0:f[l.size],b=v?sf(v,g,l.direction):0;return u.useEffect(()=>{if(c)return i.thumbs.add(c),()=>{i.thumbs.delete(c)}},[c,i.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${g}% + ${b}px)`},children:[o.jsx(xo.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(Q.span,{role:"slider","aria-label":e["aria-label"]||h,"aria-valuemin":i.min,"aria-valuenow":x,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...a,ref:m,style:x===void 0?{display:"none"}:e.style,onFocus:Z(e.onFocus,()=>{i.valueIndexToChangeRef.current=n})})}),p&&o.jsx(ml,{name:s??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:x},n)]})});ul.displayName=vo;var tf="RadioBubbleInput",ml=u.forwardRef(({__scopeSlider:e,value:t,...r},n)=>{const s=u.useRef(null),a=re(s,n),i=Io(t);return u.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&m){const p=new Event("input",{bubbles:!0});m.call(l,t),l.dispatchEvent(p)}},[i,t]),o.jsx(Q.input,{style:{display:"none"},...r,ref:a,defaultValue:t})});ml.displayName=tf;function rf(e=[],t,r){const n=[...e];return n[r]=t,n.sort((s,a)=>s-a)}function pl(e,t,r){const a=100/(r-t)*(e-t);return Ot(a,[0,100])}function of(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function nf(e,t){if(e.length===1)return 0;const r=e.map(s=>Math.abs(s-t)),n=Math.min(...r);return r.indexOf(n)}function sf(e,t,r){const n=e/2,a=sn([0,50],[0,n]);return(n-a(t)*r)*r}function af(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function lf(e,t){if(t>0){const r=af(e);return Math.min(...r)>=t}return!0}function sn(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 cf(e){return(String(e).split(".")[1]||"").length}function df(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var fl=nl,uf=cl,mf=dl,pf=ul;const hl=u.forwardRef(({className:e,...t},r)=>o.jsxs(fl,{ref:r,className:U("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(uf,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:o.jsx(mf,{className:"absolute h-full bg-primary"})}),o.jsx(pf,{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"})]}));hl.displayName=fl.displayName;const ff=({inicioColuna:e,tamanho:t,onSelect:r})=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(B,{className:"text-xs",children:"Posição no grid"}),o.jsx("div",{className:"flex gap-0.5",children:Array.from({length:12},(n,s)=>{const a=s+1,i=a>=e&&a<e+t;return o.jsx("button",{onClick:()=>r(a),className:U("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:a},a)})}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Início: col ",e," · Span: ",t]})]}),xl=({tamanho:e,inicioColuna:t,defaultTamanho:r=6,onTamanhoChange:n,onPositionChange:s})=>{const a=13-t;return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(B,{className:"text-xs",children:["Tamanho (",e,"/12 colunas)"]}),o.jsx(hl,{value:[e],onValueChange:([i])=>{const l=Math.min(i,a);n(l)},min:1,max:a,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(ff,{inicioColuna:t,tamanho:e,onSelect:i=>{const l=13-i,c=Math.min(e,l);s(i),c!==e&&n(c)}})]})},hf=({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(B,{className:"text-xs",children:"Label"}),o.jsx($e,{})]}),o.jsx(Y,{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(B,{className:"text-xs",children:"Descrição"}),o.jsx($e,{})]}),o.jsx(Y,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do container"})]}),o.jsx(_a,{value:e.icone,onChange:r=>t({icone:r})}),o.jsx(xl,{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(B,{className:"text-xs",children:"Colunas internas"}),o.jsxs(Ce,{value:String(e.columns||2),onValueChange:r=>t({columns:Number(r)}),children:[o.jsx(ye,{className:"h-8 text-sm",children:o.jsx(je,{})}),o.jsxs(we,{children:[o.jsx(pe,{value:"1",children:"1 coluna"}),o.jsx(pe,{value:"2",children:"2 colunas"}),o.jsx(pe,{value:"3",children:"3 colunas"}),o.jsx(pe,{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(xe,{id:"show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(B,{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(xe,{id:"show-as-card",checked:e.showAsCard||!1,onCheckedChange:r=>t({showAsCard:r===!0})}),o.jsx(B,{htmlFor:"show-as-card",className:"text-xs cursor-pointer",children:"Exibir como card"})]})]}),Mr=u.forwardRef(({className:e,...t},r)=>o.jsx("textarea",{className:U("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}));Mr.displayName="Textarea";function xf(e,t=[]){let r=[];function n(a,i){const l=u.createContext(i);l.displayName=a+"Context";const c=r.length;r=[...r,i];const d=p=>{var b;const{scope:f,children:x,...g}=p,h=((b=f==null?void 0:f[e])==null?void 0:b[c])||l,v=u.useMemo(()=>g,Object.values(g));return o.jsx(h.Provider,{value:v,children:x})};d.displayName=a+"Provider";function m(p,f){var h;const x=((h=f==null?void 0:f[e])==null?void 0:h[c])||l,g=u.useContext(x);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[d,m]}const s=()=>{const a=r.map(i=>u.createContext(i));return function(l){const c=(l==null?void 0:l[e])||a;return u.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,gf(s,...t)]}function gf(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const i=n.reduce((l,{useScope:c,scopeName:d})=>{const p=c(a)[`__scope${d}`];return{...l,...p}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}var an="Progress",ln=100,[vf]=xf(an),[bf,yf]=vf(an),gl=u.forwardRef((e,t)=>{const{__scopeProgress:r,value:n=null,max:s,getValueLabel:a=wf,...i}=e;(s||s===0)&&!Xn(s)&&console.error(Nf(`${s}`,"Progress"));const l=Xn(s)?s:ln;n!==null&&!Yn(n,l)&&console.error(Cf(`${n}`,"Progress"));const c=Yn(n,l)?n:null,d=ur(c)?a(c,l):void 0;return o.jsx(bf,{scope:r,value:c,max:l,children:o.jsx(hr.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":ur(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":yl(c,l),"data-value":c??void 0,"data-max":l,...i,ref:t})})});gl.displayName=an;var vl="ProgressIndicator",bl=u.forwardRef((e,t)=>{const{__scopeProgress:r,...n}=e,s=yf(vl,r);return o.jsx(hr.div,{"data-state":yl(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...n,ref:t})});bl.displayName=vl;function wf(e,t){return`${Math.round(e/t*100)}%`}function yl(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function ur(e){return typeof e=="number"}function Xn(e){return ur(e)&&!isNaN(e)&&e>0}function Yn(e,t){return ur(e)&&!isNaN(e)&&e<=t&&e>=0}function Nf(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${ln}\`.`}function Cf(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
45
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return u.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Mu="DialogDescriptionWarning",$u=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Sa(Mu).contentName}}.`;return u.useEffect(()=>{var a;const s=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Fu=ma,zu=ha,Pa=xa,Ra=ga,Ea=ba,Aa=wa,Vu=Ca;const Bu=Fu,Wu=zu,ka=u.forwardRef(({className:e,...t},r)=>o.jsx(Pa,{ref:r,className:U("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}));ka.displayName=Pa.displayName;const Ta=u.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Wu,{children:[o.jsx(ka,{}),o.jsxs(Ra,{ref:n,className:U("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(Vu,{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(k.X,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ta.displayName=Ra.displayName;const Ia=({className:e,...t})=>o.jsx("div",{className:U("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ia.displayName="DialogHeader";const La=u.forwardRef(({className:e,...t},r)=>o.jsx(Ea,{ref:r,className:U("text-lg font-semibold leading-none tracking-tight",e),...t}));La.displayName=Ea.displayName;const Oa=u.forwardRef(({className:e,...t},r)=>o.jsx(Aa,{ref:r,className:U("text-sm text-muted-foreground",e),...t}));Oa.displayName=Aa.displayName;function Hu(e){if(!e)return null;if(e.includes("-")){const t=e.split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");return k.icons[t]??null}return k.icons[e]??null}const Dn=Object.entries(k.icons).map(([e,t])=>({name:e,kebab:e.replace(/([A-Z])/g,(r,n,s)=>s===0?n.toLowerCase():`-${n.toLowerCase()}`),component:t})),_a=({value:e,onChange:t,label:r="Ícone (Lucide)",hideLabel:n=!1,className:s})=>{const[a,i]=_.useState(!1),[l,c]=_.useState(""),d=_.useMemo(()=>Hu(e),[e]),m=_.useMemo(()=>{const x=l.toLowerCase();return x?Dn.filter(g=>g.name.toLowerCase().includes(x)||g.kebab.includes(x)):Dn},[l]),p=x=>{t(x),i(!1)},f=x=>{i(x),x||c("")};return o.jsxs("div",{className:`space-y-1 ${s??""}`,children:[!n&&o.jsx(B,{className:"text-xs",children:r}),o.jsx(le,{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:[_.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(Bu,{open:a,onOpenChange:f,children:o.jsxs(Ta,{className:"max-w-3xl max-h-[85vh] flex flex-col gap-0 p-0",children:[o.jsxs(Ia,{className:"px-4 pt-4 pb-2 border-b",children:[o.jsx(La,{children:"Selecionar ícone"}),o.jsx(Oa,{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(k.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Y,{autoFocus:!0,placeholder:"Buscar ícones…",value:l,onChange:x=>c(x.target.value),className:"pl-8 h-9 text-sm"})]})}),o.jsx(br,{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(le,{type:"button",variant:e?"outline":"secondary",className:"flex flex-col items-center justify-center h-20 gap-1 p-1",onClick:()=>p(void 0),children:[o.jsx("div",{className:"h-6 w-6 rounded border-2 border-dashed border-muted-foreground/30"}),o.jsx("span",{className:"text-[10px] leading-tight text-center",children:"Nenhum"})]}),m.map(({name:x,component:g})=>o.jsxs(le,{type:"button",variant:e===x?"secondary":"outline",className:"flex flex-col items-center justify-center h-20 gap-1 p-1 overflow-hidden",onClick:()=>p(x),children:[_.createElement(g,{size:24}),o.jsx("span",{className:"text-[9px] leading-tight text-center break-all line-clamp-2",children:x})]},x))]})})]})})]})},Uu=["top","right","bottom","left"],Je=Math.min,ve=Math.max,ar=Math.round,Kt=Math.floor,Oe=e=>({x:e,y:e}),Gu={left:"right",right:"left",bottom:"top",top:"bottom"};function io(e,t,r){return ve(e,Je(t,r))}function ze(e,t){return typeof e=="function"?e(t):e}function Ve(e){return e.split("-")[0]}function St(e){return e.split("-")[1]}function Go(e){return e==="x"?"y":"x"}function qo(e){return e==="y"?"height":"width"}function Le(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Xo(e){return Go(Le(e))}function qu(e,t,r){r===void 0&&(r=!1);const n=St(e),s=Xo(e),a=qo(s);let i=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=ir(i)),[i,ir(i)]}function Xu(e){const t=ir(e);return[lo(e),t,lo(t)]}function lo(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Mn=["left","right"],$n=["right","left"],Yu=["top","bottom"],Zu=["bottom","top"];function Ku(e,t,r){switch(e){case"top":case"bottom":return r?t?$n:Mn:t?Mn:$n;case"left":case"right":return t?Yu:Zu;default:return[]}}function Ju(e,t,r,n){const s=St(e);let a=Ku(Ve(e),r==="start",n);return s&&(a=a.map(i=>i+"-"+s),t&&(a=a.concat(a.map(lo)))),a}function ir(e){const t=Ve(e);return Gu[t]+e.slice(t.length)}function Qu(e){return{top:0,right:0,bottom:0,left:0,...e}}function Da(e){return typeof e!="number"?Qu(e):{top:e,right:e,bottom:e,left:e}}function lr(e){const{x:t,y:r,width:n,height:s}=e;return{width:n,height:s,top:r,left:t,right:t+n,bottom:r+s,x:t,y:r}}function Fn(e,t,r){let{reference:n,floating:s}=e;const a=Le(t),i=Xo(t),l=qo(i),c=Ve(t),d=a==="y",m=n.x+n.width/2-s.width/2,p=n.y+n.height/2-s.height/2,f=n[l]/2-s[l]/2;let x;switch(c){case"top":x={x:m,y:n.y-s.height};break;case"bottom":x={x:m,y:n.y+n.height};break;case"right":x={x:n.x+n.width,y:p};break;case"left":x={x:n.x-s.width,y:p};break;default:x={x:n.x,y:n.y}}switch(St(t)){case"start":x[i]-=f*(r&&d?-1:1);break;case"end":x[i]+=f*(r&&d?-1:1);break}return x}async function em(e,t){var r;t===void 0&&(t={});const{x:n,y:s,platform:a,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:m="viewport",elementContext:p="floating",altBoundary:f=!1,padding:x=0}=ze(t,e),g=Da(x),v=l[f?p==="floating"?"reference":"floating":p],b=lr(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(v)))==null||r?v:v.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:d,rootBoundary:m,strategy:c})),w=p==="floating"?{x:n,y:s,width:i.floating.width,height:i.floating.height}:i.reference,C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),N=await(a.isElement==null?void 0:a.isElement(C))?await(a.getScale==null?void 0:a.getScale(C))||{x:1,y:1}:{x:1,y:1},j=lr(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:C,strategy:c}):w);return{top:(b.top-j.top+g.top)/N.y,bottom:(j.bottom-b.bottom+g.bottom)/N.y,left:(b.left-j.left+g.left)/N.x,right:(j.right-b.right+g.right)/N.x}}const tm=50,rm=async(e,t,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:a=[],platform:i}=r,l=i.detectOverflow?i:{...i,detectOverflow:em},c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:m,y:p}=Fn(d,n,c),f=n,x=0;const g={};for(let h=0;h<a.length;h++){const v=a[h];if(!v)continue;const{name:b,fn:w}=v,{x:C,y:N,data:j,reset:S}=await w({x:m,y:p,initialPlacement:n,placement:f,strategy:s,middlewareData:g,rects:d,platform:l,elements:{reference:e,floating:t}});m=C??m,p=N??p,g[b]={...g[b],...j},S&&x<tm&&(x++,typeof S=="object"&&(S.placement&&(f=S.placement),S.rects&&(d=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):S.rects),{x:m,y:p}=Fn(d,f,c)),h=-1)}return{x:m,y:p,placement:f,strategy:s,middlewareData:g}},om=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:s,rects:a,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:m=0}=ze(e,t)||{};if(d==null)return{};const p=Da(m),f={x:r,y:n},x=Xo(s),g=qo(x),h=await i.getDimensions(d),v=x==="y",b=v?"top":"left",w=v?"bottom":"right",C=v?"clientHeight":"clientWidth",N=a.reference[g]+a.reference[x]-f[x]-a.floating[g],j=f[x]-a.reference[x],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let P=S?S[C]:0;(!P||!await(i.isElement==null?void 0:i.isElement(S)))&&(P=l.floating[C]||a.floating[g]);const y=N/2-j/2,A=P/2-h[g]/2-1,I=Je(p[b],A),L=Je(p[w],A),D=I,F=P-h[g]-L,M=P/2-h[g]/2+y,V=io(D,M,F),R=!c.arrow&&St(s)!=null&&M!==V&&a.reference[g]/2-(M<D?I:L)-h[g]/2<0,T=R?M<D?M-D:M-F:0;return{[x]:f[x]+T,data:{[x]:V,centerOffset:M-V-T,...R&&{alignmentOffset:T}},reset:R}}}),nm=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:s,middlewareData:a,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:m=!0,crossAxis:p=!0,fallbackPlacements:f,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:h=!0,...v}=ze(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const b=Ve(s),w=Le(l),C=Ve(l)===l,N=await(c.isRTL==null?void 0:c.isRTL(d.floating)),j=f||(C||!h?[ir(l)]:Xu(l)),S=g!=="none";!f&&S&&j.push(...Ju(l,h,g,N));const P=[l,...j],y=await c.detectOverflow(t,v),A=[];let I=((n=a.flip)==null?void 0:n.overflows)||[];if(m&&A.push(y[b]),p){const M=qu(s,i,N);A.push(y[M[0]],y[M[1]])}if(I=[...I,{placement:s,overflows:A}],!A.every(M=>M<=0)){var L,D;const M=(((L=a.flip)==null?void 0:L.index)||0)+1,V=P[M];if(V&&(!(p==="alignment"?w!==Le(V):!1)||I.every(E=>Le(E.placement)===w?E.overflows[0]>0:!0)))return{data:{index:M,overflows:I},reset:{placement:V}};let R=(D=I.filter(T=>T.overflows[0]<=0).sort((T,E)=>T.overflows[1]-E.overflows[1])[0])==null?void 0:D.placement;if(!R)switch(x){case"bestFit":{var F;const T=(F=I.filter(E=>{if(S){const z=Le(E.placement);return z===w||z==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(z=>z>0).reduce((z,O)=>z+O,0)]).sort((E,z)=>E[1]-z[1])[0])==null?void 0:F[0];T&&(R=T);break}case"initialPlacement":R=l;break}if(s!==R)return{reset:{placement:R}}}return{}}}};function zn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Vn(e){return Uu.some(t=>e[t]>=0)}const sm=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:n}=t,{strategy:s="referenceHidden",...a}=ze(e,t);switch(s){case"referenceHidden":{const i=await n.detectOverflow(t,{...a,elementContext:"reference"}),l=zn(i,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Vn(l)}}}case"escaped":{const i=await n.detectOverflow(t,{...a,altBoundary:!0}),l=zn(i,r.floating);return{data:{escapedOffsets:l,escaped:Vn(l)}}}default:return{}}}}},Ma=new Set(["left","top"]);async function am(e,t){const{placement:r,platform:n,elements:s}=e,a=await(n.isRTL==null?void 0:n.isRTL(s.floating)),i=Ve(r),l=St(r),c=Le(r)==="y",d=Ma.has(i)?-1:1,m=a&&c?-1:1,p=ze(t,e);let{mainAxis:f,crossAxis:x,alignmentAxis:g}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof g=="number"&&(x=l==="end"?g*-1:g),c?{x:x*m,y:f*d}:{x:f*d,y:x*m}}const im=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:s,y:a,placement:i,middlewareData:l}=t,c=await am(t,e);return i===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:a+c.y,data:{...c,placement:i}}}}},lm=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:s,platform:a}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:w,y:C}=b;return{x:w,y:C}}},...d}=ze(e,t),m={x:r,y:n},p=await a.detectOverflow(t,d),f=Le(Ve(s)),x=Go(f);let g=m[x],h=m[f];if(i){const b=x==="y"?"top":"left",w=x==="y"?"bottom":"right",C=g+p[b],N=g-p[w];g=io(C,g,N)}if(l){const b=f==="y"?"top":"left",w=f==="y"?"bottom":"right",C=h+p[b],N=h-p[w];h=io(C,h,N)}const v=c.fn({...t,[x]:g,[f]:h});return{...v,data:{x:v.x-r,y:v.y-n,enabled:{[x]:i,[f]:l}}}}}},cm=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:s,rects:a,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=ze(e,t),m={x:r,y:n},p=Le(s),f=Go(p);let x=m[f],g=m[p];const h=ze(l,t),v=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const C=f==="y"?"height":"width",N=a.reference[f]-a.floating[C]+v.mainAxis,j=a.reference[f]+a.reference[C]-v.mainAxis;x<N?x=N:x>j&&(x=j)}if(d){var b,w;const C=f==="y"?"width":"height",N=Ma.has(Ve(s)),j=a.reference[p]-a.floating[C]+(N&&((b=i.offset)==null?void 0:b[p])||0)+(N?0:v.crossAxis),S=a.reference[p]+a.reference[C]+(N?0:((w=i.offset)==null?void 0:w[p])||0)-(N?v.crossAxis:0);g<j?g=j:g>S&&(g=S)}return{[f]:x,[p]:g}}}},dm=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:s,rects:a,platform:i,elements:l}=t,{apply:c=()=>{},...d}=ze(e,t),m=await i.detectOverflow(t,d),p=Ve(s),f=St(s),x=Le(s)==="y",{width:g,height:h}=a.floating;let v,b;p==="top"||p==="bottom"?(v=p,b=f===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(b=p,v=f==="end"?"top":"bottom");const w=h-m.top-m.bottom,C=g-m.left-m.right,N=Je(h-m[v],w),j=Je(g-m[b],C),S=!t.middlewareData.shift;let P=N,y=j;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(y=C),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(P=w),S&&!f){const I=ve(m.left,0),L=ve(m.right,0),D=ve(m.top,0),F=ve(m.bottom,0);x?y=g-2*(I!==0||L!==0?I+L:ve(m.left,m.right)):P=h-2*(D!==0||F!==0?D+F:ve(m.top,m.bottom))}await c({...t,availableWidth:y,availableHeight:P});const A=await i.getDimensions(l.floating);return g!==A.width||h!==A.height?{reset:{rects:!0}}:{}}}};function Sr(){return typeof window<"u"}function Pt(e){return $a(e)?(e.nodeName||"").toLowerCase():"#document"}function be(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function De(e){var t;return(t=($a(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $a(e){return Sr()?e instanceof Node||e instanceof be(e).Node:!1}function Ee(e){return Sr()?e instanceof Element||e instanceof be(e).Element:!1}function We(e){return Sr()?e instanceof HTMLElement||e instanceof be(e).HTMLElement:!1}function Bn(e){return!Sr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof be(e).ShadowRoot}function Ft(e){const{overflow:t,overflowX:r,overflowY:n,display:s}=Ae(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&s!=="inline"&&s!=="contents"}function um(e){return/^(table|td|th)$/.test(Pt(e))}function Pr(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const mm=/transform|translate|scale|rotate|perspective|filter/,pm=/paint|layout|strict|content/,st=e=>!!e&&e!=="none";let Qr;function Yo(e){const t=Ee(e)?Ae(e):e;return st(t.transform)||st(t.translate)||st(t.scale)||st(t.rotate)||st(t.perspective)||!Zo()&&(st(t.backdropFilter)||st(t.filter))||mm.test(t.willChange||"")||pm.test(t.contain||"")}function fm(e){let t=Qe(e);for(;We(t)&&!wt(t);){if(Yo(t))return t;if(Pr(t))return null;t=Qe(t)}return null}function Zo(){return Qr==null&&(Qr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Qr}function wt(e){return/^(html|body|#document)$/.test(Pt(e))}function Ae(e){return be(e).getComputedStyle(e)}function Rr(e){return Ee(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qe(e){if(Pt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Bn(e)&&e.host||De(e);return Bn(t)?t.host:t}function Fa(e){const t=Qe(e);return wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:We(t)&&Ft(t)?t:Fa(t)}function _t(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=Fa(e),a=s===((n=e.ownerDocument)==null?void 0:n.body),i=be(s);if(a){const l=co(i);return t.concat(i,i.visualViewport||[],Ft(s)?s:[],l&&r?_t(l):[])}else return t.concat(s,_t(s,[],r))}function co(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function za(e){const t=Ae(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const s=We(e),a=s?e.offsetWidth:r,i=s?e.offsetHeight:n,l=ar(r)!==a||ar(n)!==i;return l&&(r=a,n=i),{width:r,height:n,$:l}}function Ko(e){return Ee(e)?e:e.contextElement}function vt(e){const t=Ko(e);if(!We(t))return Oe(1);const r=t.getBoundingClientRect(),{width:n,height:s,$:a}=za(t);let i=(a?ar(r.width):r.width)/n,l=(a?ar(r.height):r.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const hm=Oe(0);function Va(e){const t=be(e);return!Zo()||!t.visualViewport?hm:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xm(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==be(e)?!1:t}function ct(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),a=Ko(e);let i=Oe(1);t&&(n?Ee(n)&&(i=vt(n)):i=vt(e));const l=xm(a,r,n)?Va(a):Oe(0);let c=(s.left+l.x)/i.x,d=(s.top+l.y)/i.y,m=s.width/i.x,p=s.height/i.y;if(a){const f=be(a),x=n&&Ee(n)?be(n):n;let g=f,h=co(g);for(;h&&n&&x!==g;){const v=vt(h),b=h.getBoundingClientRect(),w=Ae(h),C=b.left+(h.clientLeft+parseFloat(w.paddingLeft))*v.x,N=b.top+(h.clientTop+parseFloat(w.paddingTop))*v.y;c*=v.x,d*=v.y,m*=v.x,p*=v.y,c+=C,d+=N,g=be(h),h=co(g)}}return lr({width:m,height:p,x:c,y:d})}function Er(e,t){const r=Rr(e).scrollLeft;return t?t.left+r:ct(De(e)).left+r}function Ba(e,t){const r=e.getBoundingClientRect(),n=r.left+t.scrollLeft-Er(e,r),s=r.top+t.scrollTop;return{x:n,y:s}}function gm(e){let{elements:t,rect:r,offsetParent:n,strategy:s}=e;const a=s==="fixed",i=De(n),l=t?Pr(t.floating):!1;if(n===i||l&&a)return r;let c={scrollLeft:0,scrollTop:0},d=Oe(1);const m=Oe(0),p=We(n);if((p||!p&&!a)&&((Pt(n)!=="body"||Ft(i))&&(c=Rr(n)),p)){const x=ct(n);d=vt(n),m.x=x.x+n.clientLeft,m.y=x.y+n.clientTop}const f=i&&!p&&!a?Ba(i,c):Oe(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-c.scrollLeft*d.x+m.x+f.x,y:r.y*d.y-c.scrollTop*d.y+m.y+f.y}}function vm(e){return Array.from(e.getClientRects())}function bm(e){const t=De(e),r=Rr(e),n=e.ownerDocument.body,s=ve(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),a=ve(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+Er(e);const l=-r.scrollTop;return Ae(n).direction==="rtl"&&(i+=ve(t.clientWidth,n.clientWidth)-s),{width:s,height:a,x:i,y:l}}const Wn=25;function ym(e,t){const r=be(e),n=De(e),s=r.visualViewport;let a=n.clientWidth,i=n.clientHeight,l=0,c=0;if(s){a=s.width,i=s.height;const m=Zo();(!m||m&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const d=Er(n);if(d<=0){const m=n.ownerDocument,p=m.body,f=getComputedStyle(p),x=m.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,g=Math.abs(n.clientWidth-p.clientWidth-x);g<=Wn&&(a-=g)}else d<=Wn&&(a+=d);return{width:a,height:i,x:l,y:c}}function wm(e,t){const r=ct(e,!0,t==="fixed"),n=r.top+e.clientTop,s=r.left+e.clientLeft,a=We(e)?vt(e):Oe(1),i=e.clientWidth*a.x,l=e.clientHeight*a.y,c=s*a.x,d=n*a.y;return{width:i,height:l,x:c,y:d}}function Hn(e,t,r){let n;if(t==="viewport")n=ym(e,r);else if(t==="document")n=bm(De(e));else if(Ee(t))n=wm(t,r);else{const s=Va(e);n={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return lr(n)}function Wa(e,t){const r=Qe(e);return r===t||!Ee(r)||wt(r)?!1:Ae(r).position==="fixed"||Wa(r,t)}function Nm(e,t){const r=t.get(e);if(r)return r;let n=_t(e,[],!1).filter(l=>Ee(l)&&Pt(l)!=="body"),s=null;const a=Ae(e).position==="fixed";let i=a?Qe(e):e;for(;Ee(i)&&!wt(i);){const l=Ae(i),c=Yo(i);!c&&l.position==="fixed"&&(s=null),(a?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Ft(i)&&!c&&Wa(e,i))?n=n.filter(m=>m!==i):s=l,i=Qe(i)}return t.set(e,n),n}function Cm(e){let{element:t,boundary:r,rootBoundary:n,strategy:s}=e;const i=[...r==="clippingAncestors"?Pr(t)?[]:Nm(t,this._c):[].concat(r),n],l=Hn(t,i[0],s);let c=l.top,d=l.right,m=l.bottom,p=l.left;for(let f=1;f<i.length;f++){const x=Hn(t,i[f],s);c=ve(x.top,c),d=Je(x.right,d),m=Je(x.bottom,m),p=ve(x.left,p)}return{width:d-p,height:m-c,x:p,y:c}}function jm(e){const{width:t,height:r}=za(e);return{width:t,height:r}}function Sm(e,t,r){const n=We(t),s=De(t),a=r==="fixed",i=ct(e,!0,a,t);let l={scrollLeft:0,scrollTop:0};const c=Oe(0);function d(){c.x=Er(s)}if(n||!n&&!a)if((Pt(t)!=="body"||Ft(s))&&(l=Rr(t)),n){const x=ct(t,!0,a,t);c.x=x.x+t.clientLeft,c.y=x.y+t.clientTop}else s&&d();a&&!n&&s&&d();const m=s&&!n&&!a?Ba(s,l):Oe(0),p=i.left+l.scrollLeft-c.x-m.x,f=i.top+l.scrollTop-c.y-m.y;return{x:p,y:f,width:i.width,height:i.height}}function eo(e){return Ae(e).position==="static"}function Un(e,t){if(!We(e)||Ae(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return De(e)===r&&(r=r.ownerDocument.body),r}function Ha(e,t){const r=be(e);if(Pr(e))return r;if(!We(e)){let s=Qe(e);for(;s&&!wt(s);){if(Ee(s)&&!eo(s))return s;s=Qe(s)}return r}let n=Un(e,t);for(;n&&um(n)&&eo(n);)n=Un(n,t);return n&&wt(n)&&eo(n)&&!Yo(n)?r:n||fm(e)||r}const Pm=async function(e){const t=this.getOffsetParent||Ha,r=this.getDimensions,n=await r(e.floating);return{reference:Sm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Rm(e){return Ae(e).direction==="rtl"}const Em={convertOffsetParentRelativeRectToViewportRelativeRect:gm,getDocumentElement:De,getClippingRect:Cm,getOffsetParent:Ha,getElementRects:Pm,getClientRects:vm,getDimensions:jm,getScale:vt,isElement:Ee,isRTL:Rm};function Ua(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Am(e,t){let r=null,n;const s=De(e);function a(){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),a();const d=e.getBoundingClientRect(),{left:m,top:p,width:f,height:x}=d;if(l||t(),!f||!x)return;const g=Kt(p),h=Kt(s.clientWidth-(m+f)),v=Kt(s.clientHeight-(p+x)),b=Kt(m),C={rootMargin:-g+"px "+-h+"px "+-v+"px "+-b+"px",threshold:ve(0,Je(1,c))||1};let N=!0;function j(S){const P=S[0].intersectionRatio;if(P!==c){if(!N)return i();P?i(!1,P):n=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!Ua(d,e.getBoundingClientRect())&&i(),N=!1}try{r=new IntersectionObserver(j,{...C,root:s.ownerDocument})}catch{r=new IntersectionObserver(j,C)}r.observe(e)}return i(!0),a}function km(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,d=Ko(e),m=s||a?[...d?_t(d):[],...t?_t(t):[]]:[];m.forEach(b=>{s&&b.addEventListener("scroll",r,{passive:!0}),a&&b.addEventListener("resize",r)});const p=d&&l?Am(d,r):null;let f=-1,x=null;i&&(x=new ResizeObserver(b=>{let[w]=b;w&&w.target===d&&x&&t&&(x.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var C;(C=x)==null||C.observe(t)})),r()}),d&&!c&&x.observe(d),t&&x.observe(t));let g,h=c?ct(e):null;c&&v();function v(){const b=ct(e);h&&!Ua(h,b)&&r(),h=b,g=requestAnimationFrame(v)}return r(),()=>{var b;m.forEach(w=>{s&&w.removeEventListener("scroll",r),a&&w.removeEventListener("resize",r)}),p==null||p(),(b=x)==null||b.disconnect(),x=null,c&&cancelAnimationFrame(g)}}const Tm=im,Im=lm,Lm=nm,Om=dm,_m=sm,Gn=om,Dm=cm,Mm=(e,t,r)=>{const n=new Map,s={platform:Em,...r},a={...s.platform,_c:n};return rm(e,t,{...s,platform:a})};var $m=typeof document<"u",Fm=function(){},er=$m?_.useLayoutEffect:Fm;function cr(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,s;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(!cr(e[n],t[n]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,s[n]))return!1;for(n=r;n--!==0;){const a=s[n];if(!(a==="_owner"&&e.$$typeof)&&!cr(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function Ga(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qn(e,t){const r=Ga(e);return Math.round(t*r)/r}function to(e){const t=u.useRef(e);return er(()=>{t.current=e}),t}function zm(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:a,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[m,p]=u.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[f,x]=u.useState(n);cr(f,n)||x(n);const[g,h]=u.useState(null),[v,b]=u.useState(null),w=u.useCallback(E=>{E!==S.current&&(S.current=E,h(E))},[]),C=u.useCallback(E=>{E!==P.current&&(P.current=E,b(E))},[]),N=a||g,j=i||v,S=u.useRef(null),P=u.useRef(null),y=u.useRef(m),A=c!=null,I=to(c),L=to(s),D=to(d),F=u.useCallback(()=>{if(!S.current||!P.current)return;const E={placement:t,strategy:r,middleware:f};L.current&&(E.platform=L.current),Mm(S.current,P.current,E).then(z=>{const O={...z,isPositioned:D.current!==!1};M.current&&!cr(y.current,O)&&(y.current=O,fr.flushSync(()=>{p(O)}))})},[f,t,r,L,D]);er(()=>{d===!1&&y.current.isPositioned&&(y.current.isPositioned=!1,p(E=>({...E,isPositioned:!1})))},[d]);const M=u.useRef(!1);er(()=>(M.current=!0,()=>{M.current=!1}),[]),er(()=>{if(N&&(S.current=N),j&&(P.current=j),N&&j){if(I.current)return I.current(N,j,F);F()}},[N,j,F,I,A]);const V=u.useMemo(()=>({reference:S,floating:P,setReference:w,setFloating:C}),[w,C]),R=u.useMemo(()=>({reference:N,floating:j}),[N,j]),T=u.useMemo(()=>{const E={position:r,left:0,top:0};if(!R.floating)return E;const z=qn(R.floating,m.x),O=qn(R.floating,m.y);return l?{...E,transform:"translate("+z+"px, "+O+"px)",...Ga(R.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:z,top:O}},[r,l,R.floating,m.x,m.y]);return u.useMemo(()=>({...m,update:F,refs:V,elements:R,floatingStyles:T}),[m,F,V,R,T])}const Vm=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:s}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?Gn({element:n.current,padding:s}).fn(r):{}:n?Gn({element:n,padding:s}).fn(r):{}}}},Bm=(e,t)=>{const r=Tm(e);return{name:r.name,fn:r.fn,options:[e,t]}},Wm=(e,t)=>{const r=Im(e);return{name:r.name,fn:r.fn,options:[e,t]}},Hm=(e,t)=>({fn:Dm(e).fn,options:[e,t]}),Um=(e,t)=>{const r=Lm(e);return{name:r.name,fn:r.fn,options:[e,t]}},Gm=(e,t)=>{const r=Om(e);return{name:r.name,fn:r.fn,options:[e,t]}},qm=(e,t)=>{const r=_m(e);return{name:r.name,fn:r.fn,options:[e,t]}},Xm=(e,t)=>{const r=Vm(e);return{name:r.name,fn:r.fn,options:[e,t]}};var Ym="Arrow",qa=u.forwardRef((e,t)=>{const{children:r,width:n=10,height:s=5,...a}=e;return o.jsx(Q.svg,{...a,ref:t,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});qa.displayName=Ym;var Zm=qa,Jo="Popper",[Xa,Rt]=Be(Jo),[Km,Ya]=Xa(Jo),Za=e=>{const{__scopePopper:t,children:r}=e,[n,s]=u.useState(null);return o.jsx(Km,{scope:t,anchor:n,onAnchorChange:s,children:r})};Za.displayName=Jo;var Ka="PopperAnchor",Ja=u.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...s}=e,a=Ya(Ka,r),i=u.useRef(null),l=re(t,i),c=u.useRef(null);return u.useEffect(()=>{const d=c.current;c.current=(n==null?void 0:n.current)||i.current,d!==c.current&&a.onAnchorChange(c.current)}),n?null:o.jsx(Q.div,{...s,ref:l})});Ja.displayName=Ka;var Qo="PopperContent",[Jm,Qm]=Xa(Qo),Qa=u.forwardRef((e,t)=>{var $,oe,K,J,G,ee;const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:a="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:m=0,sticky:p="partial",hideWhenDetached:f=!1,updatePositionStrategy:x="optimized",onPlaced:g,...h}=e,v=Ya(Qo,r),[b,w]=u.useState(null),C=re(t,ue=>w(ue)),[N,j]=u.useState(null),S=Lo(N),P=(S==null?void 0:S.width)??0,y=(S==null?void 0:S.height)??0,A=n+(a!=="center"?"-"+a:""),I=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},L=Array.isArray(d)?d:[d],D=L.length>0,F={padding:I,boundary:L.filter(tp),altBoundary:D},{refs:M,floatingStyles:V,placement:R,isPositioned:T,middlewareData:E}=zm({strategy:"fixed",placement:A,whileElementsMounted:(...ue)=>km(...ue,{animationFrame:x==="always"}),elements:{reference:v.anchor},middleware:[Bm({mainAxis:s+y,alignmentAxis:i}),c&&Wm({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Hm():void 0,...F}),c&&Um({...F}),Gm({...F,apply:({elements:ue,rects:ce,availableWidth:He,availableHeight:Ue})=>{const{width:kt,height:Fl}=ce.reference,Wt=ue.floating.style;Wt.setProperty("--radix-popper-available-width",`${He}px`),Wt.setProperty("--radix-popper-available-height",`${Ue}px`),Wt.setProperty("--radix-popper-anchor-width",`${kt}px`),Wt.setProperty("--radix-popper-anchor-height",`${Fl}px`)}}),N&&Xm({element:N,padding:l}),rp({arrowWidth:P,arrowHeight:y}),f&&qm({strategy:"referenceHidden",...F})]}),[z,O]=ri(R),q=ge(g);he(()=>{T&&(q==null||q())},[T,q]);const se=($=E.arrow)==null?void 0:$.x,ie=(oe=E.arrow)==null?void 0:oe.y,X=((K=E.arrow)==null?void 0:K.centerOffset)!==0,[ne,ae]=u.useState();return he(()=>{b&&ae(window.getComputedStyle(b).zIndex)},[b]),o.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:T?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[(J=E.transformOrigin)==null?void 0:J.x,(G=E.transformOrigin)==null?void 0:G.y].join(" "),...((ee=E.hide)==null?void 0:ee.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(Jm,{scope:r,placedSide:z,onArrowChange:j,arrowX:se,arrowY:ie,shouldHideArrow:X,children:o.jsx(Q.div,{"data-side":z,"data-align":O,...h,ref:C,style:{...h.style,animation:T?void 0:"none"}})})})});Qa.displayName=Qo;var ei="PopperArrow",ep={top:"bottom",right:"left",bottom:"top",left:"right"},ti=u.forwardRef(function(t,r){const{__scopePopper:n,...s}=t,a=Qm(ei,n),i=ep[a.placedSide];return o.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]: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(Zm,{...s,ref:r,style:{...s.style,display:"block"}})})});ti.displayName=ei;function tp(e){return e!==null}var rp=e=>({name:"transformOrigin",options:e,fn(t){var v,b,w;const{placement:r,rects:n,middlewareData:s}=t,i=((v=s.arrow)==null?void 0:v.centerOffset)!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,m]=ri(r),p={start:"0%",center:"50%",end:"100%"}[m],f=(((b=s.arrow)==null?void 0:b.x)??0)+l/2,x=(((w=s.arrow)==null?void 0:w.y)??0)+c/2;let g="",h="";return d==="bottom"?(g=i?p:`${f}px`,h=`${-c}px`):d==="top"?(g=i?p:`${f}px`,h=`${n.floating.height+c}px`):d==="right"?(g=`${-c}px`,h=i?p:`${x}px`):d==="left"&&(g=`${n.floating.width+c}px`,h=i?p:`${x}px`),{data:{x:g,y:h}}}});function ri(e){const[t,r="center"]=e.split("-");return[t,r]}var en=Za,Ar=Ja,tn=Qa,rn=ti,kr="Popover",[oi]=Be(kr,[Rt]),zt=Rt(),[op,tt]=oi(kr),ni=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:s,onOpenChange:a,modal:i=!1}=e,l=zt(t),c=u.useRef(null),[d,m]=u.useState(!1),[p,f]=it({prop:n,defaultProp:s??!1,onChange:a,caller:kr});return o.jsx(en,{...l,children:o.jsx(op,{scope:t,contentId:Ke(),triggerRef:c,open:p,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(x=>!x),[f]),hasCustomAnchor:d,onCustomAnchorAdd:u.useCallback(()=>m(!0),[]),onCustomAnchorRemove:u.useCallback(()=>m(!1),[]),modal:i,children:r})})};ni.displayName=kr;var si="PopoverAnchor",np=u.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=tt(si,r),a=zt(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=s;return u.useEffect(()=>(i(),()=>l()),[i,l]),o.jsx(Ar,{...a,...n,ref:t})});np.displayName=si;var ai="PopoverTrigger",ii=u.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=tt(ai,r),a=zt(r),i=re(t,s.triggerRef),l=o.jsx(Q.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":mi(s.open),...n,ref:i,onClick:Z(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:o.jsx(Ar,{asChild:!0,...a,children:l})});ii.displayName=ai;var on="PopoverPortal",[sp,ap]=oi(on,{forceMount:void 0}),li=e=>{const{__scopePopover:t,forceMount:r,children:n,container:s}=e,a=tt(on,t);return o.jsx(sp,{scope:t,forceMount:r,children:o.jsx(Se,{present:r||a.open,children:o.jsx(wr,{asChild:!0,container:s,children:n})})})};li.displayName=on;var Nt="PopoverContent",ci=u.forwardRef((e,t)=>{const r=ap(Nt,e.__scopePopover),{forceMount:n=r.forceMount,...s}=e,a=tt(Nt,e.__scopePopover);return o.jsx(Se,{present:n||a.open,children:a.modal?o.jsx(lp,{...s,ref:t}):o.jsx(cp,{...s,ref:t})})});ci.displayName=Nt;var ip=bt("PopoverContent.RemoveScroll"),lp=u.forwardRef((e,t)=>{const r=tt(Nt,e.__scopePopover),n=u.useRef(null),s=re(t,n),a=u.useRef(!1);return u.useEffect(()=>{const i=n.current;if(i)return Bo(i)},[]),o.jsx(Cr,{as:ip,allowPinchZoom:!0,children:o.jsx(di,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Z(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),a.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Z(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;a.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Z(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),cp=u.forwardRef((e,t)=>{const r=tt(Nt,e.__scopePopover),n=u.useRef(!1),s=u.useRef(!1);return o.jsx(di,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,a),a.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),a.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:a=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=a.target;((d=r.triggerRef.current)==null?void 0:d.contains(i))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),di=u.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:m,...p}=e,f=tt(Nt,r),x=zt(r);return Vo(),o.jsx(yr,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx($t,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:m,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>f.onOpenChange(!1),children:o.jsx(tn,{"data-state":mi(f.open),role:"dialog",id:f.contentId,...x,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ui="PopoverClose",dp=u.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=tt(ui,r);return o.jsx(Q.button,{type:"button",...n,ref:t,onClick:Z(e.onClick,()=>s.onOpenChange(!1))})});dp.displayName=ui;var up="PopoverArrow",mp=u.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=zt(r);return o.jsx(rn,{...s,...n,ref:t})});mp.displayName=up;function mi(e){return e?"open":"closed"}var pp=ni,fp=ii,hp=li,pi=ci;const Tr=pp,Ir=fp,Vt=u.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>o.jsx(hp,{children:o.jsx(pi,{ref:s,align:t,sideOffset:r,className:U("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})}));Vt.displayName=pi.displayName;const $e=({onInsert:e})=>{const[t,r]=_.useState(null),n=async s=>{const a=`{{${s}}}`;try{await navigator.clipboard.writeText(a)}catch{const i=document.createElement("textarea");i.value=a,i.style.position="fixed",i.style.opacity="0",document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i)}e&&e(a),r(s),setTimeout(()=>r(null),1500)};return o.jsxs(Tr,{children:[o.jsx(Ir,{asChild:!0,children:o.jsx(le,{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(k.Braces,{className:"h-3.5 w-3.5"})})}),o.jsxs(Vt,{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:Ro.map(s=>{const a=t===s.key;return o.jsxs("button",{type:"button",onClick:()=>n(s.key),className:U("w-full flex items-center justify-between px-3 py-1.5 text-left hover:bg-accent transition-colors",a&&"bg-primary/10"),children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xs font-medium truncate",children:s.label}),o.jsx("code",{className:"text-[10px] text-muted-foreground font-mono",children:`{{${s.key}}}`})]}),o.jsx("div",{className:"ml-2 shrink-0",children:a?o.jsx(k.Check,{className:"h-3.5 w-3.5 text-primary"}):o.jsx(k.Braces,{className:"h-3 w-3 text-muted-foreground/50"})})]},s.key)})})]})]})},xp=({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(B,{className:"text-xs",children:"Label"}),o.jsx($e,{})]}),o.jsx(Y,{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(B,{className:"text-xs",children:"Descrição"}),o.jsx($e,{})]}),o.jsx(Y,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do step"})]}),o.jsx(_a,{value:e.icone,onChange:r=>t({icone:r})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{id:"step-show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(B,{htmlFor:"step-show-label",className:"text-xs cursor-pointer",children:"Exibir título no formulário"})]})]});function fi(e){const t=e+"CollectionProvider",[r,n]=Be(t),[s,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:v,children:b}=h,w=_.useRef(null),C=_.useRef(new Map).current;return o.jsx(s,{scope:v,itemMap:C,collectionRef:w,children:b})};i.displayName=t;const l=e+"CollectionSlot",c=bt(l),d=_.forwardRef((h,v)=>{const{scope:b,children:w}=h,C=a(l,b),N=re(v,C.collectionRef);return o.jsx(c,{ref:N,children:w})});d.displayName=l;const m=e+"CollectionItemSlot",p="data-radix-collection-item",f=bt(m),x=_.forwardRef((h,v)=>{const{scope:b,children:w,...C}=h,N=_.useRef(null),j=re(v,N),S=a(m,b);return _.useEffect(()=>(S.itemMap.set(N,{ref:N,...C}),()=>void S.itemMap.delete(N))),o.jsx(f,{[p]:"",ref:j,children:w})});x.displayName=m;function g(h){const v=a(e+"CollectionConsumer",h);return _.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const C=Array.from(w.querySelectorAll(`[${p}]`));return Array.from(v.itemMap.values()).sort((S,P)=>C.indexOf(S.ref.current)-C.indexOf(P.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:d,ItemSlot:x},g,n]}var hi=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"}),gp="VisuallyHidden",xi=u.forwardRef((e,t)=>o.jsx(Q.span,{...e,ref:t,style:{...hi,...e.style}}));xi.displayName=gp;var vp=xi,bp=[" ","Enter","ArrowUp","ArrowDown"],yp=[" ","Enter"],dt="Select",[Lr,Or,wp]=fi(dt),[Et]=Be(dt,[wp,Rt]),_r=Rt(),[Np,rt]=Et(dt),[Cp,jp]=Et(dt),gi=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:a,value:i,defaultValue:l,onValueChange:c,dir:d,name:m,autoComplete:p,disabled:f,required:x,form:g}=e,h=_r(t),[v,b]=u.useState(null),[w,C]=u.useState(null),[N,j]=u.useState(!1),S=Do(d),[P,y]=it({prop:n,defaultProp:s??!1,onChange:a,caller:dt}),[A,I]=it({prop:i,defaultProp:l,onChange:c,caller:dt}),L=u.useRef(null),D=v?g||!!v.closest("form"):!0,[F,M]=u.useState(new Set),V=Array.from(F).map(R=>R.props.value).join(";");return o.jsx(en,{...h,children:o.jsxs(Np,{required:x,scope:t,trigger:v,onTriggerChange:b,valueNode:w,onValueNodeChange:C,valueNodeHasChildren:N,onValueNodeHasChildrenChange:j,contentId:Ke(),value:A,onValueChange:I,open:P,onOpenChange:y,dir:S,triggerPointerDownPosRef:L,disabled:f,children:[o.jsx(Lr.Provider,{scope:t,children:o.jsx(Cp,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(R=>{M(T=>new Set(T).add(R))},[]),onNativeOptionRemove:u.useCallback(R=>{M(T=>{const E=new Set(T);return E.delete(R),E})},[]),children:r})}),D?o.jsxs(Vi,{"aria-hidden":!0,required:x,tabIndex:-1,name:m,autoComplete:p,value:A,onChange:R=>I(R.target.value),disabled:f,form:g,children:[A===void 0?o.jsx("option",{value:""}):null,Array.from(F)]},V):null]})})};gi.displayName=dt;var vi="SelectTrigger",bi=u.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,a=_r(r),i=rt(vi,r),l=i.disabled||n,c=re(t,i.onTriggerChange),d=Or(r),m=u.useRef("touch"),[p,f,x]=Wi(h=>{const v=d().filter(C=>!C.disabled),b=v.find(C=>C.value===i.value),w=Hi(v,h,b);w!==void 0&&i.onValueChange(w.value)}),g=h=>{l||(i.onOpenChange(!0),x()),h&&(i.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return o.jsx(Ar,{asChild:!0,...a,children:o.jsx(Q.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":Bi(i.value)?"":void 0,...s,ref:c,onClick:Z(s.onClick,h=>{h.currentTarget.focus(),m.current!=="mouse"&&g(h)}),onPointerDown:Z(s.onPointerDown,h=>{m.current=h.pointerType;const v=h.target;v.hasPointerCapture(h.pointerId)&&v.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(g(h),h.preventDefault())}),onKeyDown:Z(s.onKeyDown,h=>{const v=p.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(v&&h.key===" ")&&bp.includes(h.key)&&(g(),h.preventDefault())})})})});bi.displayName=vi;var yi="SelectValue",wi=u.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:a,placeholder:i="",...l}=e,c=rt(yi,r),{onValueNodeHasChildrenChange:d}=c,m=a!==void 0,p=re(t,c.onValueNodeChange);return he(()=>{d(m)},[d,m]),o.jsx(Q.span,{...l,ref:p,style:{pointerEvents:"none"},children:Bi(c.value)?o.jsx(o.Fragment,{children:i}):a})});wi.displayName=yi;var Sp="SelectIcon",Ni=u.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return o.jsx(Q.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});Ni.displayName=Sp;var Pp="SelectPortal",Ci=e=>o.jsx(wr,{asChild:!0,...e});Ci.displayName=Pp;var ut="SelectContent",ji=u.forwardRef((e,t)=>{const r=rt(ut,e.__scopeSelect),[n,s]=u.useState();if(he(()=>{s(new DocumentFragment)},[]),!r.open){const a=n;return a?fr.createPortal(o.jsx(Si,{scope:e.__scopeSelect,children:o.jsx(Lr.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),a):null}return o.jsx(Pi,{...e,ref:t})});ji.displayName=ut;var Re=10,[Si,ot]=Et(ut),Rp="SelectContentImpl",Ep=bt("SelectContent.RemoveScroll"),Pi=u.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:m,arrowPadding:p,collisionBoundary:f,collisionPadding:x,sticky:g,hideWhenDetached:h,avoidCollisions:v,...b}=e,w=rt(ut,r),[C,N]=u.useState(null),[j,S]=u.useState(null),P=re(t,$=>N($)),[y,A]=u.useState(null),[I,L]=u.useState(null),D=Or(r),[F,M]=u.useState(!1),V=u.useRef(!1);u.useEffect(()=>{if(C)return Bo(C)},[C]),Vo();const R=u.useCallback($=>{const[oe,...K]=D().map(ee=>ee.ref.current),[J]=K.slice(-1),G=document.activeElement;for(const ee of $)if(ee===G||(ee==null||ee.scrollIntoView({block:"nearest"}),ee===oe&&j&&(j.scrollTop=0),ee===J&&j&&(j.scrollTop=j.scrollHeight),ee==null||ee.focus(),document.activeElement!==G))return},[D,j]),T=u.useCallback(()=>R([y,C]),[R,y,C]);u.useEffect(()=>{F&&T()},[F,T]);const{onOpenChange:E,triggerPointerDownPosRef:z}=w;u.useEffect(()=>{if(C){let $={x:0,y:0};const oe=J=>{var G,ee;$={x:Math.abs(Math.round(J.pageX)-(((G=z.current)==null?void 0:G.x)??0)),y:Math.abs(Math.round(J.pageY)-(((ee=z.current)==null?void 0:ee.y)??0))}},K=J=>{$.x<=10&&$.y<=10?J.preventDefault():C.contains(J.target)||E(!1),document.removeEventListener("pointermove",oe),z.current=null};return z.current!==null&&(document.addEventListener("pointermove",oe),document.addEventListener("pointerup",K,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",oe),document.removeEventListener("pointerup",K,{capture:!0})}}},[C,E,z]),u.useEffect(()=>{const $=()=>E(!1);return window.addEventListener("blur",$),window.addEventListener("resize",$),()=>{window.removeEventListener("blur",$),window.removeEventListener("resize",$)}},[E]);const[O,q]=Wi($=>{const oe=D().filter(G=>!G.disabled),K=oe.find(G=>G.ref.current===document.activeElement),J=Hi(oe,$,K);J&&setTimeout(()=>J.ref.current.focus())}),se=u.useCallback(($,oe,K)=>{const J=!V.current&&!K;(w.value!==void 0&&w.value===oe||J)&&(A($),J&&(V.current=!0))},[w.value]),ie=u.useCallback(()=>C==null?void 0:C.focus(),[C]),X=u.useCallback(($,oe,K)=>{const J=!V.current&&!K;(w.value!==void 0&&w.value===oe||J)&&L($)},[w.value]),ne=n==="popper"?uo:Ri,ae=ne===uo?{side:l,sideOffset:c,align:d,alignOffset:m,arrowPadding:p,collisionBoundary:f,collisionPadding:x,sticky:g,hideWhenDetached:h,avoidCollisions:v}:{};return o.jsx(Si,{scope:r,content:C,viewport:j,onViewportChange:S,itemRefCallback:se,selectedItem:y,onItemLeave:ie,itemTextRefCallback:X,focusSelectedItem:T,selectedItemText:I,position:n,isPositioned:F,searchRef:O,children:o.jsx(Cr,{as:Ep,allowPinchZoom:!0,children:o.jsx(yr,{asChild:!0,trapped:w.open,onMountAutoFocus:$=>{$.preventDefault()},onUnmountAutoFocus:Z(s,$=>{var oe;(oe=w.trigger)==null||oe.focus({preventScroll:!0}),$.preventDefault()}),children:o.jsx($t,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:$=>$.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:o.jsx(ne,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:$=>$.preventDefault(),...b,...ae,onPlaced:()=>M(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Z(b.onKeyDown,$=>{const oe=$.ctrlKey||$.altKey||$.metaKey;if($.key==="Tab"&&$.preventDefault(),!oe&&$.key.length===1&&q($.key),["ArrowUp","ArrowDown","Home","End"].includes($.key)){let J=D().filter(G=>!G.disabled).map(G=>G.ref.current);if(["ArrowUp","End"].includes($.key)&&(J=J.slice().reverse()),["ArrowUp","ArrowDown"].includes($.key)){const G=$.target,ee=J.indexOf(G);J=J.slice(ee+1)}setTimeout(()=>R(J)),$.preventDefault()}})})})})})})});Pi.displayName=Rp;var Ap="SelectItemAlignedPosition",Ri=u.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,a=rt(ut,r),i=ot(ut,r),[l,c]=u.useState(null),[d,m]=u.useState(null),p=re(t,P=>m(P)),f=Or(r),x=u.useRef(!1),g=u.useRef(!0),{viewport:h,selectedItem:v,selectedItemText:b,focusSelectedItem:w}=i,C=u.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&d&&h&&v&&b){const P=a.trigger.getBoundingClientRect(),y=d.getBoundingClientRect(),A=a.valueNode.getBoundingClientRect(),I=b.getBoundingClientRect();if(a.dir!=="rtl"){const G=I.left-y.left,ee=A.left-G,ue=P.left-ee,ce=P.width+ue,He=Math.max(ce,y.width),Ue=window.innerWidth-Re,kt=Ot(ee,[Re,Math.max(Re,Ue-He)]);l.style.minWidth=ce+"px",l.style.left=kt+"px"}else{const G=y.right-I.right,ee=window.innerWidth-A.right-G,ue=window.innerWidth-P.right-ee,ce=P.width+ue,He=Math.max(ce,y.width),Ue=window.innerWidth-Re,kt=Ot(ee,[Re,Math.max(Re,Ue-He)]);l.style.minWidth=ce+"px",l.style.right=kt+"px"}const L=f(),D=window.innerHeight-Re*2,F=h.scrollHeight,M=window.getComputedStyle(d),V=parseInt(M.borderTopWidth,10),R=parseInt(M.paddingTop,10),T=parseInt(M.borderBottomWidth,10),E=parseInt(M.paddingBottom,10),z=V+R+F+E+T,O=Math.min(v.offsetHeight*5,z),q=window.getComputedStyle(h),se=parseInt(q.paddingTop,10),ie=parseInt(q.paddingBottom,10),X=P.top+P.height/2-Re,ne=D-X,ae=v.offsetHeight/2,$=v.offsetTop+ae,oe=V+R+$,K=z-oe;if(oe<=X){const G=L.length>0&&v===L[L.length-1].ref.current;l.style.bottom="0px";const ee=d.clientHeight-h.offsetTop-h.offsetHeight,ue=Math.max(ne,ae+(G?ie:0)+ee+T),ce=oe+ue;l.style.height=ce+"px"}else{const G=L.length>0&&v===L[0].ref.current;l.style.top="0px";const ue=Math.max(X,V+h.offsetTop+(G?se:0)+ae)+K;l.style.height=ue+"px",h.scrollTop=oe-X+h.offsetTop}l.style.margin=`${Re}px 0`,l.style.minHeight=O+"px",l.style.maxHeight=D+"px",n==null||n(),requestAnimationFrame(()=>x.current=!0)}},[f,a.trigger,a.valueNode,l,d,h,v,b,a.dir,n]);he(()=>C(),[C]);const[N,j]=u.useState();he(()=>{d&&j(window.getComputedStyle(d).zIndex)},[d]);const S=u.useCallback(P=>{P&&g.current===!0&&(C(),w==null||w(),g.current=!1)},[C,w]);return o.jsx(Tp,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:x,onScrollButtonChange:S,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:o.jsx(Q.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Ri.displayName=Ap;var kp="SelectPopperPosition",uo=u.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=Re,...a}=e,i=_r(r);return o.jsx(tn,{...i,...a,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...a.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)"}})});uo.displayName=kp;var[Tp,nn]=Et(ut,{}),mo="SelectViewport",Ei=u.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,a=ot(mo,r),i=nn(mo,r),l=re(t,a.onViewportChange),c=u.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(Lr.Slot,{scope:r,children:o.jsx(Q.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Z(s.onScroll,d=>{const m=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:f}=i;if(f!=null&&f.current&&p){const x=Math.abs(c.current-m.scrollTop);if(x>0){const g=window.innerHeight-Re*2,h=parseFloat(p.style.minHeight),v=parseFloat(p.style.height),b=Math.max(h,v);if(b<g){const w=b+x,C=Math.min(g,w),N=w-C;p.style.height=C+"px",p.style.bottom==="0px"&&(m.scrollTop=N>0?N:0,p.style.justifyContent="flex-end")}}}c.current=m.scrollTop})})})]})});Ei.displayName=mo;var Ai="SelectGroup",[Ip,Lp]=Et(Ai),Op=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Ke();return o.jsx(Ip,{scope:r,id:s,children:o.jsx(Q.div,{role:"group","aria-labelledby":s,...n,ref:t})})});Op.displayName=Ai;var ki="SelectLabel",Ti=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Lp(ki,r);return o.jsx(Q.div,{id:s.id,...n,ref:t})});Ti.displayName=ki;var dr="SelectItem",[_p,Ii]=Et(dr),Li=u.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:a,...i}=e,l=rt(dr,r),c=ot(dr,r),d=l.value===n,[m,p]=u.useState(a??""),[f,x]=u.useState(!1),g=re(t,w=>{var C;return(C=c.itemRefCallback)==null?void 0:C.call(c,w,n,s)}),h=Ke(),v=u.useRef("touch"),b=()=>{s||(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(_p,{scope:r,value:n,disabled:s,textId:h,isSelected:d,onItemTextChange:u.useCallback(w=>{p(C=>C||((w==null?void 0:w.textContent)??"").trim())},[]),children:o.jsx(Lr.ItemSlot,{scope:r,value:n,disabled:s,textValue:m,children:o.jsx(Q.div,{role:"option","aria-labelledby":h,"data-highlighted":f?"":void 0,"aria-selected":d&&f,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...i,ref:g,onFocus:Z(i.onFocus,()=>x(!0)),onBlur:Z(i.onBlur,()=>x(!1)),onClick:Z(i.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:Z(i.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:Z(i.onPointerDown,w=>{v.current=w.pointerType}),onPointerMove:Z(i.onPointerMove,w=>{var C;v.current=w.pointerType,s?(C=c.onItemLeave)==null||C.call(c):v.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Z(i.onPointerLeave,w=>{var C;w.currentTarget===document.activeElement&&((C=c.onItemLeave)==null||C.call(c))}),onKeyDown:Z(i.onKeyDown,w=>{var N;((N=c.searchRef)==null?void 0:N.current)!==""&&w.key===" "||(yp.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});Li.displayName=dr;var It="SelectItemText",Oi=u.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...a}=e,i=rt(It,r),l=ot(It,r),c=Ii(It,r),d=jp(It,r),[m,p]=u.useState(null),f=re(t,b=>p(b),c.onItemTextChange,b=>{var w;return(w=l.itemTextRefCallback)==null?void 0:w.call(l,b,c.value,c.disabled)}),x=m==null?void 0:m.textContent,g=u.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:x},c.value),[c.disabled,c.value,x]),{onNativeOptionAdd:h,onNativeOptionRemove:v}=d;return he(()=>(h(g),()=>v(g)),[h,v,g]),o.jsxs(o.Fragment,{children:[o.jsx(Q.span,{id:c.textId,...a,ref:f}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?fr.createPortal(a.children,i.valueNode):null]})});Oi.displayName=It;var _i="SelectItemIndicator",Di=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return Ii(_i,r).isSelected?o.jsx(Q.span,{"aria-hidden":!0,...n,ref:t}):null});Di.displayName=_i;var po="SelectScrollUpButton",Mi=u.forwardRef((e,t)=>{const r=ot(po,e.__scopeSelect),n=nn(po,e.__scopeSelect),[s,a]=u.useState(!1),i=re(t,n.onScrollButtonChange);return he(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollTop>0;a(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?o.jsx(Fi,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Mi.displayName=po;var fo="SelectScrollDownButton",$i=u.forwardRef((e,t)=>{const r=ot(fo,e.__scopeSelect),n=nn(fo,e.__scopeSelect),[s,a]=u.useState(!1),i=re(t,n.onScrollButtonChange);return he(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,m=Math.ceil(c.scrollTop)<d;a(m)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),s?o.jsx(Fi,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});$i.displayName=fo;var Fi=u.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,a=ot("SelectScrollButton",r),i=u.useRef(null),l=Or(r),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),he(()=>{var m;const d=l().find(p=>p.ref.current===document.activeElement);(m=d==null?void 0:d.ref.current)==null||m.scrollIntoView({block:"nearest"})},[l]),o.jsx(Q.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Z(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:Z(s.onPointerMove,()=>{var d;(d=a.onItemLeave)==null||d.call(a),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:Z(s.onPointerLeave,()=>{c()})})}),Dp="SelectSeparator",zi=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return o.jsx(Q.div,{"aria-hidden":!0,...n,ref:t})});zi.displayName=Dp;var ho="SelectArrow",Mp=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=_r(r),a=rt(ho,r),i=ot(ho,r);return a.open&&i.position==="popper"?o.jsx(rn,{...s,...n,ref:t}):null});Mp.displayName=ho;var $p="SelectBubbleInput",Vi=u.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const s=u.useRef(null),a=re(n,s),i=Io(t);return u.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&m){const p=new Event("change",{bubbles:!0});m.call(l,t),l.dispatchEvent(p)}},[i,t]),o.jsx(Q.select,{...r,style:{...hi,...r.style},ref:a,defaultValue:t})});Vi.displayName=$p;function Bi(e){return e===""||e===void 0}function Wi(e){const t=ge(e),r=u.useRef(""),n=u.useRef(0),s=u.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]),a=u.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,a]}function Hi(e,t,r){const s=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let i=Fp(e,Math.max(a,0));s.length===1&&(i=i.filter(d=>d!==r));const c=i.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function Fp(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var zp=gi,Ui=bi,Vp=wi,Bp=Ni,Wp=Ci,Gi=ji,Hp=Ei,qi=Ti,Xi=Li,Up=Oi,Gp=Di,Yi=Mi,Zi=$i,Ki=zi;const Ce=zp,je=Vp,ye=u.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Ui,{ref:n,className:U("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(Bp,{asChild:!0,children:o.jsx(k.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));ye.displayName=Ui.displayName;const Ji=u.forwardRef(({className:e,...t},r)=>o.jsx(Yi,{ref:r,className:U("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(k.ChevronUp,{className:"h-4 w-4"})}));Ji.displayName=Yi.displayName;const Qi=u.forwardRef(({className:e,...t},r)=>o.jsx(Zi,{ref:r,className:U("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(k.ChevronDown,{className:"h-4 w-4"})}));Qi.displayName=Zi.displayName;const we=u.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>o.jsx(Wp,{children:o.jsxs(Gi,{ref:s,className:U("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(Ji,{}),o.jsx(Hp,{className:U("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(Qi,{})]})}));we.displayName=Gi.displayName;const qp=u.forwardRef(({className:e,...t},r)=>o.jsx(qi,{ref:r,className:U("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));qp.displayName=qi.displayName;const pe=u.forwardRef(({className:e,children:t,...r},n)=>o.jsxs(Xi,{ref:n,className:U("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(Gp,{children:o.jsx(k.Check,{className:"h-4 w-4"})})}),o.jsx(Up,{children:t})]}));pe.displayName=Xi.displayName;const Xp=u.forwardRef(({className:e,...t},r)=>o.jsx(Ki,{ref:r,className:U("-mx-1 my-1 h-px bg-muted",e),...t}));Xp.displayName=Ki.displayName;var el=["PageUp","PageDown"],tl=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],rl={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},At="Slider",[xo,Yp,Zp]=fi(At),[ol]=Be(At,[Zp]),[Kp,Dr]=ol(At),nl=u.forwardRef((e,t)=>{const{name:r,min:n=0,max:s=100,step:a=1,orientation:i="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[n],value:m,onValueChange:p=()=>{},onValueCommit:f=()=>{},inverted:x=!1,form:g,...h}=e,v=u.useRef(new Set),b=u.useRef(0),C=i==="horizontal"?Jp:Qp,[N=[],j]=it({prop:m,defaultProp:d,onChange:L=>{var F;(F=[...v.current][b.current])==null||F.focus(),p(L)}}),S=u.useRef(N);function P(L){const D=nf(N,L);I(L,D)}function y(L){I(L,b.current)}function A(){const L=S.current[b.current];N[b.current]!==L&&f(N)}function I(L,D,{commit:F}={commit:!1}){const M=cf(a),V=df(Math.round((L-n)/a)*a+n,M),R=Ot(V,[n,s]);j((T=[])=>{const E=rf(T,R,D);if(lf(E,c*a)){b.current=E.indexOf(R);const z=String(E)!==String(T);return z&&F&&f(E),z?E:T}else return T})}return o.jsx(Kp,{scope:e.__scopeSlider,name:r,disabled:l,min:n,max:s,valueIndexToChangeRef:b,thumbs:v.current,values:N,orientation:i,form:g,children:o.jsx(xo.Provider,{scope:e.__scopeSlider,children:o.jsx(xo.Slot,{scope:e.__scopeSlider,children:o.jsx(C,{"aria-disabled":l,"data-disabled":l?"":void 0,...h,ref:t,onPointerDown:Z(h.onPointerDown,()=>{l||(S.current=N)}),min:n,max:s,inverted:x,onSlideStart:l?void 0:P,onSlideMove:l?void 0:y,onSlideEnd:l?void 0:A,onHomeKeyDown:()=>!l&&I(n,0,{commit:!0}),onEndKeyDown:()=>!l&&I(s,N.length-1,{commit:!0}),onStepKeyDown:({event:L,direction:D})=>{if(!l){const V=el.includes(L.key)||L.shiftKey&&tl.includes(L.key)?10:1,R=b.current,T=N[R],E=a*V*D;I(T+E,R,{commit:!0})}}})})})})});nl.displayName=At;var[sl,al]=ol(At,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Jp=u.forwardRef((e,t)=>{const{min:r,max:n,dir:s,inverted:a,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...m}=e,[p,f]=u.useState(null),x=re(t,C=>f(C)),g=u.useRef(void 0),h=Do(s),v=h==="ltr",b=v&&!a||!v&&a;function w(C){const N=g.current||p.getBoundingClientRect(),j=[0,N.width],P=sn(j,b?[r,n]:[n,r]);return g.current=N,P(C-N.left)}return o.jsx(sl,{scope:e.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:o.jsx(il,{dir:h,"data-orientation":"horizontal",...m,ref:x,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const N=w(C.clientX);i==null||i(N)},onSlideMove:C=>{const N=w(C.clientX);l==null||l(N)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:C=>{const j=rl[b?"from-left":"from-right"].includes(C.key);d==null||d({event:C,direction:j?-1:1})}})})}),Qp=u.forwardRef((e,t)=>{const{min:r,max:n,inverted:s,onSlideStart:a,onSlideMove:i,onSlideEnd:l,onStepKeyDown:c,...d}=e,m=u.useRef(null),p=re(t,m),f=u.useRef(void 0),x=!s;function g(h){const v=f.current||m.current.getBoundingClientRect(),b=[0,v.height],C=sn(b,x?[n,r]:[r,n]);return f.current=v,C(h-v.top)}return o.jsx(sl,{scope:e.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:o.jsx(il,{"data-orientation":"vertical",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{const v=g(h.clientY);a==null||a(v)},onSlideMove:h=>{const v=g(h.clientY);i==null||i(v)},onSlideEnd:()=>{f.current=void 0,l==null||l()},onStepKeyDown:h=>{const b=rl[x?"from-bottom":"from-top"].includes(h.key);c==null||c({event:h,direction:b?-1:1})}})})}),il=u.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:n,onSlideMove:s,onSlideEnd:a,onHomeKeyDown:i,onEndKeyDown:l,onStepKeyDown:c,...d}=e,m=Dr(At,r);return o.jsx(Q.span,{...d,ref:t,onKeyDown:Z(e.onKeyDown,p=>{p.key==="Home"?(i(p),p.preventDefault()):p.key==="End"?(l(p),p.preventDefault()):el.concat(tl).includes(p.key)&&(c(p),p.preventDefault())}),onPointerDown:Z(e.onPointerDown,p=>{const f=p.target;f.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(f)?f.focus():n(p)}),onPointerMove:Z(e.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&s(p)}),onPointerUp:Z(e.onPointerUp,p=>{const f=p.target;f.hasPointerCapture(p.pointerId)&&(f.releasePointerCapture(p.pointerId),a(p))})})}),ll="SliderTrack",cl=u.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,s=Dr(ll,r);return o.jsx(Q.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...n,ref:t})});cl.displayName=ll;var go="SliderRange",dl=u.forwardRef((e,t)=>{const{__scopeSlider:r,...n}=e,s=Dr(go,r),a=al(go,r),i=u.useRef(null),l=re(t,i),c=s.values.length,d=s.values.map(f=>pl(f,s.min,s.max)),m=c>1?Math.min(...d):0,p=100-Math.max(...d);return o.jsx(Q.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...n,ref:l,style:{...e.style,[a.startEdge]:m+"%",[a.endEdge]:p+"%"}})});dl.displayName=go;var vo="SliderThumb",ul=u.forwardRef((e,t)=>{const r=Yp(e.__scopeSlider),[n,s]=u.useState(null),a=re(t,l=>s(l)),i=u.useMemo(()=>n?r().findIndex(l=>l.ref.current===n):-1,[r,n]);return o.jsx(ef,{...e,ref:a,index:i})}),ef=u.forwardRef((e,t)=>{const{__scopeSlider:r,index:n,name:s,...a}=e,i=Dr(vo,r),l=al(vo,r),[c,d]=u.useState(null),m=re(t,w=>d(w)),p=c?i.form||!!c.closest("form"):!0,f=Lo(c),x=i.values[n],g=x===void 0?0:pl(x,i.min,i.max),h=of(n,i.values.length),v=f==null?void 0:f[l.size],b=v?sf(v,g,l.direction):0;return u.useEffect(()=>{if(c)return i.thumbs.add(c),()=>{i.thumbs.delete(c)}},[c,i.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${g}% + ${b}px)`},children:[o.jsx(xo.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(Q.span,{role:"slider","aria-label":e["aria-label"]||h,"aria-valuemin":i.min,"aria-valuenow":x,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...a,ref:m,style:x===void 0?{display:"none"}:e.style,onFocus:Z(e.onFocus,()=>{i.valueIndexToChangeRef.current=n})})}),p&&o.jsx(ml,{name:s??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:x},n)]})});ul.displayName=vo;var tf="RadioBubbleInput",ml=u.forwardRef(({__scopeSlider:e,value:t,...r},n)=>{const s=u.useRef(null),a=re(s,n),i=Io(t);return u.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&m){const p=new Event("input",{bubbles:!0});m.call(l,t),l.dispatchEvent(p)}},[i,t]),o.jsx(Q.input,{style:{display:"none"},...r,ref:a,defaultValue:t})});ml.displayName=tf;function rf(e=[],t,r){const n=[...e];return n[r]=t,n.sort((s,a)=>s-a)}function pl(e,t,r){const a=100/(r-t)*(e-t);return Ot(a,[0,100])}function of(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function nf(e,t){if(e.length===1)return 0;const r=e.map(s=>Math.abs(s-t)),n=Math.min(...r);return r.indexOf(n)}function sf(e,t,r){const n=e/2,a=sn([0,50],[0,n]);return(n-a(t)*r)*r}function af(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function lf(e,t){if(t>0){const r=af(e);return Math.min(...r)>=t}return!0}function sn(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 cf(e){return(String(e).split(".")[1]||"").length}function df(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var fl=nl,uf=cl,mf=dl,pf=ul;const hl=u.forwardRef(({className:e,...t},r)=>o.jsxs(fl,{ref:r,className:U("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(uf,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:o.jsx(mf,{className:"absolute h-full bg-primary"})}),o.jsx(pf,{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"})]}));hl.displayName=fl.displayName;const ff=({inicioColuna:e,tamanho:t,onSelect:r})=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(B,{className:"text-xs",children:"Posição no grid"}),o.jsx("div",{className:"flex gap-0.5",children:Array.from({length:12},(n,s)=>{const a=s+1,i=a>=e&&a<e+t;return o.jsx("button",{onClick:()=>r(a),className:U("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:a},a)})}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Início: col ",e," · Span: ",t]})]}),xl=({tamanho:e,inicioColuna:t,defaultTamanho:r=6,onTamanhoChange:n,onPositionChange:s})=>{const a=13-t;return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(B,{className:"text-xs",children:["Tamanho (",e,"/12 colunas)"]}),o.jsx(hl,{value:[e],onValueChange:([i])=>{const l=Math.min(i,a);n(l)},min:1,max:a,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(ff,{inicioColuna:t,tamanho:e,onSelect:i=>{const l=13-i,c=Math.min(e,l);s(i),c!==e&&n(c)}})]})},hf=({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(B,{className:"text-xs",children:"Label"}),o.jsx($e,{})]}),o.jsx(Y,{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(B,{className:"text-xs",children:"Descrição"}),o.jsx($e,{})]}),o.jsx(Y,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do container"})]}),o.jsx(_a,{value:e.icone,onChange:r=>t({icone:r})}),o.jsx(xl,{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(B,{className:"text-xs",children:"Colunas internas"}),o.jsxs(Ce,{value:String(e.columns||2),onValueChange:r=>t({columns:Number(r)}),children:[o.jsx(ye,{className:"h-8 text-sm",children:o.jsx(je,{})}),o.jsxs(we,{children:[o.jsx(pe,{value:"1",children:"1 coluna"}),o.jsx(pe,{value:"2",children:"2 colunas"}),o.jsx(pe,{value:"3",children:"3 colunas"}),o.jsx(pe,{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(xe,{id:"show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(B,{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(xe,{id:"show-as-card",checked:e.showAsCard||!1,onCheckedChange:r=>t({showAsCard:r===!0})}),o.jsx(B,{htmlFor:"show-as-card",className:"text-xs cursor-pointer",children:"Exibir como card"})]})]}),Mr=u.forwardRef(({className:e,...t},r)=>o.jsx("textarea",{className:U("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}));Mr.displayName="Textarea";function xf(e,t=[]){let r=[];function n(a,i){const l=u.createContext(i);l.displayName=a+"Context";const c=r.length;r=[...r,i];const d=p=>{var b;const{scope:f,children:x,...g}=p,h=((b=f==null?void 0:f[e])==null?void 0:b[c])||l,v=u.useMemo(()=>g,Object.values(g));return o.jsx(h.Provider,{value:v,children:x})};d.displayName=a+"Provider";function m(p,f){var h;const x=((h=f==null?void 0:f[e])==null?void 0:h[c])||l,g=u.useContext(x);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${a}\``)}return[d,m]}const s=()=>{const a=r.map(i=>u.createContext(i));return function(l){const c=(l==null?void 0:l[e])||a;return u.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,gf(s,...t)]}function gf(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const i=n.reduce((l,{useScope:c,scopeName:d})=>{const p=c(a)[`__scope${d}`];return{...l,...p}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}var an="Progress",ln=100,[vf]=xf(an),[bf,yf]=vf(an),gl=u.forwardRef((e,t)=>{const{__scopeProgress:r,value:n=null,max:s,getValueLabel:a=wf,...i}=e;(s||s===0)&&!Xn(s)&&console.error(Nf(`${s}`,"Progress"));const l=Xn(s)?s:ln;n!==null&&!Yn(n,l)&&console.error(Cf(`${n}`,"Progress"));const c=Yn(n,l)?n:null,d=ur(c)?a(c,l):void 0;return o.jsx(bf,{scope:r,value:c,max:l,children:o.jsx(hr.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":ur(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":yl(c,l),"data-value":c??void 0,"data-max":l,...i,ref:t})})});gl.displayName=an;var vl="ProgressIndicator",bl=u.forwardRef((e,t)=>{const{__scopeProgress:r,...n}=e,s=yf(vl,r);return o.jsx(hr.div,{"data-state":yl(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...n,ref:t})});bl.displayName=vl;function wf(e,t){return`${Math.round(e/t*100)}%`}function yl(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function ur(e){return typeof e=="number"}function Xn(e){return ur(e)&&!isNaN(e)&&e>0}function Yn(e,t){return ur(e)&&!isNaN(e)&&e<=t&&e>=0}function Nf(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${ln}\`.`}function Cf(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
46
46
|
- a positive number
|
|
47
47
|
- less than the value passed to \`max\` (or ${ln} if no \`max\` prop is set)
|
|
48
48
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
49
49
|
|
|
50
|
-
Defaulting to \`null\`.`}var wl=gl,jf=bl;const Nl=u.forwardRef(({className:e,value:t,...r},n)=>o.jsx(wl,{ref:n,className:U("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...r,children:o.jsx(jf,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Nl.displayName=wl.displayName;var[$r]=Be("Tooltip",[Rt]),Fr=Rt(),Sf="TooltipProvider",bo="tooltip.open",[Th,cn]=$r(Sf),Dt="Tooltip",[Pf,zr]=$r(Dt),Cl=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:s,onOpenChange:a,disableHoverableContent:i,delayDuration:l}=e,c=cn(Dt,e.__scopeTooltip),d=Fr(t),[m,p]=u.useState(null),f=Ke(),x=u.useRef(0),g=i??c.disableHoverableContent,h=l??c.delayDuration,v=u.useRef(!1),[b,w]=it({prop:n,defaultProp:s??!1,onChange:P=>{P?(c.onOpen(),document.dispatchEvent(new CustomEvent(bo))):c.onClose(),a==null||a(P)},caller:Dt}),N=u.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),C=u.useCallback(()=>{window.clearTimeout(x.current),x.current=0,v.current=!1,w(!0)},[w]),j=u.useCallback(()=>{window.clearTimeout(x.current),x.current=0,w(!1)},[w]),S=u.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{v.current=!0,w(!0),x.current=0},h)},[h,w]);return u.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),o.jsx(en,{...d,children:o.jsx(Pf,{scope:t,contentId:f,open:b,stateAttribute:N,trigger:m,onTriggerChange:p,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?S():C()},[c.isOpenDelayedRef,S,C]),onTriggerLeave:u.useCallback(()=>{g?j():(window.clearTimeout(x.current),x.current=0)},[j,g]),onOpen:C,onClose:j,disableHoverableContent:g,children:r})})};Cl.displayName=Dt;var yo="TooltipTrigger",jl=u.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=zr(yo,r),a=cn(yo,r),i=Fr(r),l=u.useRef(null),c=re(t,l,s.onTriggerChange),d=u.useRef(!1),m=u.useRef(!1),p=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),o.jsx(Ar,{asChild:!0,...i,children:o.jsx(Q.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:Z(e.onPointerMove,f=>{f.pointerType!=="touch"&&!m.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:Z(e.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:Z(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Z(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:Z(e.onBlur,s.onClose),onClick:Z(e.onClick,s.onClose)})})});jl.displayName=yo;var Rf="TooltipPortal",[Ih,Ef]=$r(Rf,{forceMount:void 0}),Ct="TooltipContent",Sl=u.forwardRef((e,t)=>{const r=Ef(Ct,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...a}=e,i=zr(Ct,e.__scopeTooltip);return o.jsx(Se,{present:n||i.open,children:i.disableHoverableContent?o.jsx(Pl,{side:s,...a,ref:t}):o.jsx(Af,{side:s,...a,ref:t})})}),Af=u.forwardRef((e,t)=>{const r=zr(Ct,e.__scopeTooltip),n=cn(Ct,e.__scopeTooltip),s=u.useRef(null),a=re(t,s),[i,l]=u.useState(null),{trigger:c,onClose:d}=r,m=s.current,{onPointerInTransitChange:p}=n,f=u.useCallback(()=>{l(null),p(!1)},[p]),x=u.useCallback((g,h)=>{const v=g.currentTarget,b={x:g.clientX,y:g.clientY},w=Of(b,v.getBoundingClientRect()),N=_f(b,w),C=Df(h.getBoundingClientRect()),j=$f([...N,...C]);l(j),p(!0)},[p]);return u.useEffect(()=>()=>f(),[f]),u.useEffect(()=>{if(c&&m){const g=v=>x(v,m),h=v=>x(v,c);return c.addEventListener("pointerleave",g),m.addEventListener("pointerleave",h),()=>{c.removeEventListener("pointerleave",g),m.removeEventListener("pointerleave",h)}}},[c,m,x,f]),u.useEffect(()=>{if(i){const g=h=>{const v=h.target,b={x:h.clientX,y:h.clientY},w=(c==null?void 0:c.contains(v))||(m==null?void 0:m.contains(v)),N=!Mf(b,i);w?f():N&&(f(),d())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,m,i,d,f]),o.jsx(Pl,{...e,ref:a})}),[kf,Tf]=$r(Dt,{isInside:!1}),If=td("TooltipContent"),Pl=u.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:a,onPointerDownOutside:i,...l}=e,c=zr(Ct,r),d=Fr(r),{onClose:m}=c;return u.useEffect(()=>(document.addEventListener(bo,m),()=>document.removeEventListener(bo,m)),[m]),u.useEffect(()=>{if(c.trigger){const p=f=>{const x=f.target;x!=null&&x.contains(c.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,m]),o.jsx($t,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:o.jsxs(tn,{"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(If,{children:n}),o.jsx(kf,{scope:r,isInside:!0,children:o.jsx(vp,{id:c.contentId,role:"tooltip",children:s||n})})]})})});Sl.displayName=Ct;var Rl="TooltipArrow",Lf=u.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Fr(r);return Tf(Rl,r).isInside?null:o.jsx(rn,{...s,...n,ref:t})});Lf.displayName=Rl;function Of(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(r,n,s,a)){case a:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function _f(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 Df(e){const{top:t,right:r,bottom:n,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:n},{x:s,y:n}]}function Mf(e,t){const{x:r,y:n}=e;let s=!1;for(let a=0,i=t.length-1;a<t.length;i=a++){const l=t[a],c=t[i],d=l.x,m=l.y,p=c.x,f=c.y;m>n!=f>n&&r<(p-d)*(n-m)/(f-m)+d&&(s=!s)}return s}function $f(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),Ff(t)}function Ff(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const s=e[n];for(;t.length>=2;){const a=t[t.length-1],i=t[t.length-2];if((a.x-i.x)*(s.y-i.y)>=(a.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const s=e[n];for(;r.length>=2;){const a=r[r.length-1],i=r[r.length-2];if((a.x-i.x)*(s.y-i.y)>=(a.y-i.y)*(s.x-i.x))r.pop();else break}r.push(s)}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 zf=Cl,Vf=jl,El=Sl;const Al=zf,kl=Vf,dn=u.forwardRef(({className:e,sideOffset:t=4,...r},n)=>o.jsx(El,{ref:n,sideOffset:t,className:U("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}));dn.displayName=El.displayName;const Bf=To("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 Vr({className:e,variant:t,...r}){return o.jsx("div",{className:U(Bf({variant:t}),e),...r})}const wo=[{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."}]}],Wf=wo.flatMap(e=>e.presets),Hf=({value:e,message:t,onChange:r})=>{const[n,s]=_.useState(!1),[a,i]=_.useState(""),l=_.useMemo(()=>{if(!a.trim())return wo;const p=a.toLowerCase();return wo.map(f=>({...f,presets:f.presets.filter(x=>x.label.toLowerCase().includes(p)||x.description.toLowerCase().includes(p)||x.pattern.toLowerCase().includes(p))})).filter(f=>f.presets.length>0)},[a]),c=_.useMemo(()=>e?Wf.find(p=>p.pattern===e):void 0,[e]),d=p=>{r(p.pattern,`${p.label}: formato inválido`),s(!1),i("")},m=()=>{r(void 0,void 0)};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(B,{className:"text-[10px]",children:"Regex"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Y,{value:e??"",onChange:p=>r(p.target.value||void 0,t),className:"h-7 text-xs font-mono flex-1",placeholder:"Clique no botão ou digite..."}),e&&o.jsx(le,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:m,children:o.jsx(k.X,{className:"h-3 w-3"})}),o.jsxs(Tr,{open:n,onOpenChange:s,children:[o.jsx(Ir,{asChild:!0,children:o.jsx(le,{variant:"outline",size:"icon",className:"h-7 w-7 shrink-0",children:o.jsx(k.Regex,{className:"h-3.5 w-3.5"})})}),o.jsxs(Vt,{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(k.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(Y,{value:a,onChange:p=>i(p.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar regex (ex: CPF, e-mail, senha)...",autoFocus:!0})]})}),o.jsx(br,{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(p=>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:p.category}),p.presets.map(f=>o.jsxs(Al,{children:[o.jsx(kl,{asChild:!0,children:o.jsxs("button",{onClick:()=>d(f),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(k.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:f.label}),o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono block truncate",children:f.pattern})]})]})}),o.jsxs(dn,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:f.label}),o.jsx("p",{children:f.description})]})]},f.pattern+f.label))]},p.category))]})})]})]})]}),c&&o.jsxs(Vr,{variant:"secondary",className:"text-[10px] font-normal gap-1",children:[o.jsx(k.Regex,{className:"h-2.5 w-2.5"}),c.label]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Mensagem do regex"}),o.jsx(Y,{value:t??"",onChange:p=>r(e,p.target.value||void 0),className:"h-7 text-xs",placeholder:"Formato inválido"})]})]})},No=[{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"]}]}],Uf=No.flatMap(e=>e.presets),Gf=({value:e,onChange:t})=>{const[r,n]=_.useState(!1),[s,a]=_.useState(""),[i,l]=_.useState(""),c=_.useMemo(()=>new Set(e??[]),[e]),d=_.useMemo(()=>{if(!s.trim())return No;const g=s.toLowerCase();return No.map(h=>({...h,presets:h.presets.filter(v=>v.label.toLowerCase().includes(g)||v.description.toLowerCase().includes(g)||v.value.toLowerCase().includes(g))})).filter(h=>h.presets.length>0)},[s]),m=g=>{const h=new Set(e??[]);g.group?g.group.every(b=>h.has(b))?g.group.forEach(b=>h.delete(b)):g.group.forEach(b=>h.add(b)):h.has(g.value)?h.delete(g.value):h.add(g.value),t(h.size>0?Array.from(h):void 0)},p=()=>{const g=i.trim();if(!g)return;const h=new Set(e??[]);h.add(g),t(Array.from(h)),l("")},f=g=>{const h=new Set(e??[]);h.delete(g),t(h.size>0?Array.from(h):void 0)},x=g=>{const h=Uf.find(v=>v.value===g);return(h==null?void 0:h.label)??g};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(B,{className:"text-[10px]",children:"Tipos de arquivo aceitos"}),((e==null?void 0:e.length)??0)>0&&o.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(g=>o.jsxs(Vr,{variant:"secondary",className:"text-[10px] gap-1 pr-1",children:[x(g),o.jsx("button",{onClick:()=>f(g),className:"hover:text-destructive",children:o.jsx(k.X,{className:"h-2.5 w-2.5"})})]},g))}),o.jsxs(Tr,{open:r,onOpenChange:n,children:[o.jsx(Ir,{asChild:!0,children:o.jsxs(le,{variant:"outline",className:"w-full h-8 text-xs justify-start gap-2",children:[o.jsx(k.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(Vt,{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(k.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(Y,{value:s,onChange:g=>a(g.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar tipos (ex: PDF, imagem, vídeo)...",autoFocus:!0})]})}),o.jsxs("div",{className:"px-2 py-1.5 border-b flex gap-1",children:[o.jsx(Y,{value:i,onChange:g=>l(g.target.value),className:"h-7 text-xs font-mono flex-1",placeholder:"Tipo customizado (ex: .dwg)",onKeyDown:g=>g.key==="Enter"&&p()}),o.jsx(le,{variant:"secondary",size:"sm",className:"h-7 text-xs shrink-0",onClick:p,disabled:!i.trim(),children:"Adicionar"})]}),o.jsx(br,{className:"h-[320px]",children:o.jsxs("div",{className:"p-1",children:[d.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum tipo encontrado"}),d.map(g=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:g.category}),g.presets.map(h=>{const v=h.group?h.group.every(w=>c.has(w)):c.has(h.value),b=h.group?h.group.some(w=>c.has(w))&&!v:!1;return o.jsxs(Al,{children:[o.jsx(kl,{asChild:!0,children:o.jsxs("button",{onClick:()=>m(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(xe,{checked:b?"indeterminate":v,className:"h-3.5 w-3.5",tabIndex:-1}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium",children: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(k.Info,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"})]})}),o.jsxs(dn,{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(w=>o.jsx("li",{className:"font-mono text-[10px] opacity-80",children:w},w))})]})]},h.value)})]},g.category))]})})]})]})]})},Tl=1048576,mr=1073741824;function Zn(e){return e>=mr&&e%mr===0?"GB":"MB"}function Kn(e,t){return t==="GB"?e/mr:e/Tl}function Jn(e,t){return Math.round(e*(t==="GB"?mr:Tl))}const qf=({value:e,onChange:t})=>{const r=_.useMemo(()=>e?Zn(e):"MB",[]),[n,s]=_.useState(r),[a,i]=_.useState(e?String(Kn(e,r)):"");_.useEffect(()=>{if(e===void 0){i("");return}const d=Zn(e);s(d),i(String(Kn(e,d)))},[e]);const l=d=>{i(d);const m=parseFloat(d);d.trim()===""||isNaN(m)||m<=0?t(void 0):t(Jn(m,n))},c=d=>{s(d);const m=parseFloat(a);!isNaN(m)&&m>0&&t(Jn(m,d))};return o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(B,{className:"text-[10px]",children:"Tamanho máximo do arquivo"}),o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx(Y,{type:"number",min:0,step:"any",value:a,onChange:d=>l(d.target.value),placeholder:"Ex: 10",className:"h-8 text-xs flex-1"}),o.jsxs(Ce,{value:n,onValueChange:d=>c(d),children:[o.jsx(ye,{className:"w-[72px] h-8 text-xs",children:o.jsx(je,{})}),o.jsxs(we,{children:[o.jsx(pe,{value:"MB",children:"MB"}),o.jsx(pe,{value:"GB",children:"GB"})]})]})]}),e!==void 0&&o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["= ",e.toLocaleString("pt-BR")," bytes"]})]})},Xf=new Set(["texto","textarea","email","password","url","phone","tel","cpf","cnpj","cep","rg"]),Yf=({fieldType:e,validation:t,onChange:r})=>{const n=(i,l)=>{const m=["minLength","maxLength","min","max","maxFileSize","minAge","maxAge"].includes(i)?l?Number(l):void 0:l||void 0;r({...t,[i]:m})},s=e==="file",a=Xf.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"}),a&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Min caracteres"}),o.jsx(Y,{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(B,{className:"text-[10px]",children:"Max caracteres"}),o.jsx(Y,{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(B,{className:"text-[10px]",children:"Valor mínimo"}),o.jsx(Y,{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(B,{className:"text-[10px]",children:"Valor máximo"}),o.jsx(Y,{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(B,{className:"text-[10px]",children:"Data mínima"}),o.jsx(Y,{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(B,{className:"text-[10px]",children:"Data máxima"}),o.jsx(Y,{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(B,{className:"text-[10px]",children:"Idade mínima (anos)"}),o.jsx(Y,{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(B,{className:"text-[10px]",children:"Idade máxima (anos)"}),o.jsx(Y,{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"})]})]})]}),s&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(Gf,{value:t==null?void 0:t.fileTypes,onChange:i=>r({...t,fileTypes:i})}),o.jsx(qf,{value:t==null?void 0:t.maxFileSize,onChange:i=>r({...t,maxFileSize:i})})]}),!s&&o.jsx(Hf,{value:(t==null?void 0:t.regex)??"",message:(t==null?void 0:t.regexMessage)??"",onChange:(i,l)=>r({...t,regex:i,regexMessage:l})})]})},Il=({options:e,onChange:t})=>{const r=_.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=_.useCallback((i,l,c)=>{const d=[...e];d[i]={...d[i],[l]:c},t(d)},[e,t]),s=_.useCallback(i=>{r.current.splice(i,1),t(e.filter((l,c)=>c!==i))},[e,t]),a=_.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(k.GripVertical,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}),o.jsx(Y,{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(Y,{value:i.label,onChange:c=>n(l,"label",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Label"}),o.jsx($e,{})]}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>s(l),children:o.jsx(k.Trash2,{className:"h-3 w-3"})})]},r.current[l])),o.jsxs(le,{variant:"outline",size:"sm",className:"w-full h-7 text-xs",onClick:a,children:[o.jsx(k.Plus,{className:"h-3 w-3 mr-1"})," Adicionar opção"]})]})},Zf=[{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"}],Kf=["vazio","naoVazio"],Qn=({cond:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:s})=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Fonte"}),o.jsxs(Ce,{value:e.source||"campo",onValueChange:a=>s({source:a,when:""}),children:[o.jsx(ye,{className:"h-7 text-xs",children:o.jsx(je,{})}),o.jsxs(we,{children:[o.jsx(pe,{value:"campo",children:"Campo do formulário"}),o.jsx(pe,{value:"evento",children:"Variável do evento"})]})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:e.source==="evento"?"Variável do evento":"Quando o campo"}),o.jsxs(Ce,{value:e.when||"",onValueChange:a=>s({when:a}),children:[o.jsx(ye,{className:"h-7 text-xs",children:o.jsx(je,{placeholder:e.source==="evento"?"Selecione uma variável...":"Selecione um campo..."})}),o.jsx(we,{children:e.source==="evento"?Ro.map(a=>o.jsx(pe,{value:a.key,children:a.label},a.key)):r.filter(a=>a!==t).map(a=>o.jsxs(pe,{value:a,children:[n(a),o.jsxs("span",{className:"text-muted-foreground/50 ml-1 text-[9px] font-mono",children:["(",a,")"]})]},a))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Operador"}),o.jsxs(Ce,{value:e.operator,onValueChange:a=>s({operator:a}),children:[o.jsx(ye,{className:"h-7 text-xs",children:o.jsx(je,{})}),o.jsx(we,{children:Zf.map(a=>o.jsx(pe,{value:a.value,children:a.label},a.value))})]})]}),!Kf.includes(e.operator)&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Valor"}),o.jsx(Y,{value:e.value||"",onChange:a=>s({value:a.target.value}),className:"h-7 text-xs",placeholder:"Valor esperado"})]})]}),Jf=({condition:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onChange:s})=>{var m;const a=p=>{e&&s({...e,...p})},i=()=>{if(!e)return;const p=e.extraConditions??[];s({...e,logicOperator:e.logicOperator??"and",extraConditions:[...p,{when:"",operator:"igual",value:"",source:"campo"}]})},l=p=>{if(!e)return;const f=(e.extraConditions??[]).filter((x,g)=>g!==p);s({...e,extraConditions:f,logicOperator:f.length?e.logicOperator:void 0})},c=(p,f)=>{if(!e)return;const x=(e.extraConditions??[]).map((g,h)=>h===p?{...g,...f}:g);s({...e,extraConditions:x})},d=(((m=e==null?void 0:e.extraConditions)==null?void 0:m.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(xe,{id:"has-condition",checked:!!e,onCheckedChange:p=>{s(p?{when:"",operator:"igual",value:"",source:"campo"}:void 0)}}),o.jsx(B,{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(Qn,{cond:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:a}),d&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Lógica"}),o.jsxs(Ce,{value:e.logicOperator??"and",onValueChange:p=>a({logicOperator:p}),children:[o.jsx(ye,{className:"h-7 text-xs",children:o.jsx(je,{})}),o.jsxs(we,{children:[o.jsx(pe,{value:"and",children:"E (AND) — todas devem ser verdadeiras"}),o.jsx(pe,{value:"or",children:"OU (OR) — pelo menos uma deve ser verdadeira"})]})]})]}),(e.extraConditions??[]).map((p,f)=>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"," ",f+2]}),o.jsx(le,{variant:"ghost",size:"sm",className:"h-5 px-1 text-[10px] text-destructive hover:text-destructive",onClick:()=>l(f),children:"Remover"})]}),o.jsx(Qn,{cond:p,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:x=>c(f,x)})]},f)),o.jsx(le,{variant:"outline",size:"sm",className:"h-6 text-[10px] w-full mt-1",onClick:i,children:"+ Adicionar condição"})]})]})},es=[{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"}],Qf=({subFields:e,onChange:t})=>{const[r,n]=_.useState(null),s=(l,c)=>{const d=e.map((m,p)=>p===l?{...m,...c}:m);t(d)},a=l=>{t(e.filter((c,d)=>d!==l)),n(null)},i=()=>{const l={label:"Novo campo",name:`campo_${e.length+1}`,fieldType:"texto",required:!1};t([...e,l]),n(e.length)};return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(B,{className:"text-xs font-semibold",children:"Sub-campos"}),o.jsxs(le,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs gap-1",onClick:i,children:[o.jsx(k.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((l,c)=>{var d;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===c?null:c),children:[o.jsx(Vr,{variant:"secondary",className:"h-4 text-[9px] px-1 shrink-0",children:c+1}),o.jsx("span",{className:"flex-1 truncate font-medium",children:l.label||l.name||"Campo sem nome"}),o.jsx("span",{className:"text-muted-foreground text-[10px] shrink-0",children:((d=es.find(m=>m.value===l.fieldType))==null?void 0:d.label)??l.fieldType}),o.jsx(le,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 text-destructive hover:text-destructive shrink-0",onClick:m=>{m.stopPropagation(),a(c)},children:o.jsx(k.Trash2,{className:"w-3 h-3"})}),r===c?o.jsx(k.ChevronUp,{className:"w-3 h-3 text-muted-foreground shrink-0"}):o.jsx(k.ChevronDown,{className:"w-3 h-3 text-muted-foreground shrink-0"})]}),r===c&&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(B,{className:"text-[10px]",children:"Label"}),o.jsx(Y,{value:l.label,onChange:m=>s(c,{label:m.target.value}),className:"h-7 text-xs",placeholder:"Ex: Nome"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Nome (campo)"}),o.jsx(Y,{value:l.name||"",onChange:m=>s(c,{name:m.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(B,{className:"text-[10px]",children:"Tipo de campo"}),o.jsxs(Ce,{value:l.fieldType,onValueChange:m=>s(c,{fieldType:m}),children:[o.jsx(ye,{className:"h-7 text-xs",children:o.jsx(je,{})}),o.jsx(we,{children:es.map(m=>o.jsx(pe,{value:m.value,className:"text-xs",children:m.label},m.value))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Colunas (1-12)"}),o.jsx(Y,{type:"number",min:1,max:12,value:l.tamanho??"",onChange:m=>s(c,{tamanho:m.target.value?Number(m.target.value):void 0}),className:"h-7 text-xs",placeholder:"12"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Placeholder"}),o.jsx(Y,{value:l.placeholder||"",onChange:m=>s(c,{placeholder:m.target.value}),className:"h-7 text-xs",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{id:`sf-req-${c}`,checked:l.required||!1,onCheckedChange:m=>s(c,{required:m===!0})}),o.jsx(B,{htmlFor:`sf-req-${c}`,className:"text-[10px] cursor-pointer",children:"Obrigatório"})]}),["select","radio","checkbox_group"].includes(l.fieldType)&&o.jsx("div",{className:"pt-1",children:o.jsx(Il,{options:l.options||[],onChange:m=>s(c,{options:m})})})]})]},c)}),e.length>0&&o.jsx(Ne,{className:"mt-1"})]})},eh=({config:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:s})=>{const a=e.fieldType||"texto",i=["select","radio","checkbox_group","autocomplete"].includes(a),l=a==="field_array",c=e.locked===!0,d=a==="participation_type",m=a==="payment_method",p=a==="terms",f=a==="slider",x=a==="rating",g=a==="date_range",h=a==="sub_form",{schemaId:v,uploadTermsPdf:b}=ke(),[w,N]=_.useState(e.termoPdfUploadId?"upload":"link"),[C,j]=_.useState({status:"idle"}),S=_.useRef(null),P=_.useCallback(async y=>{if(!v){j({status:"error",message:"Salve o schema primeiro para habilitar o upload de PDF."});return}if(!b){j({status:"error",message:"Upload de PDF não configurado. Forneça a prop uploadTermsPdf ao BuilderProvider."});return}j({status:"uploading",fileName:y.name,progress:0});try{const E=await b(y,v);s({termoPdfUploadId:E,termoPdfUrl:void 0}),j({status:"idle"})}catch(E){j({status:"error",message:E instanceof Error?E.message:"Falha no upload do PDF."})}},[v,b,s]);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(k.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(k.Lock,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Tipo de Participação"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Datas, preços e vagas são carregados automaticamente do evento"})]})]}),p&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(k.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(B,{className:"text-xs",children:"Label"}),o.jsx($e,{})]}),o.jsx(Y,{value:e.label,onChange:y=>s({label:y.target.value}),className:"h-8 text-sm"})]}),d||m?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Dica (hint)"}),o.jsx(Y,{value:e.hint||"",onChange:y=>s({hint:y.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(xe,{id:"req",checked:e.required||!1,onCheckedChange:y=>s({required:y===!0})}),o.jsx(B,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]})]}):p?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Dica (hint)"}),o.jsx(Y,{value:e.hint||"",onChange:y=>s({hint:y.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(xe,{id:"req",checked:e.required||!1,onCheckedChange:y=>s({required:y===!0})}),o.jsx(B,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),o.jsx(Ne,{}),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(B,{className:"text-xs",children:"Texto dos termos"}),o.jsx(Mr,{value:e.termoTexto||"",onChange:y=>s({termoTexto:y.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(B,{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:()=>N("link"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${w==="link"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Link externo"}),o.jsx("button",{type:"button",onClick:()=>N("upload"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${w==="upload"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Upload de PDF"})]}),w==="link"?o.jsxs("div",{className:"space-y-1",children:[o.jsx(Y,{value:e.termoPdfUrl||"",onChange:y=>s({termoPdfUrl:y.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&&C.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(k.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(le,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>{s({termoPdfUploadId:void 0})},children:o.jsx(k.X,{className:"h-3 w-3"})})]}):null,C.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(k.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),o.jsx("span",{className:"truncate",children:C.fileName}),o.jsxs("span",{className:"ml-auto",children:[C.progress,"%"]})]}),o.jsx(Nl,{value:C.progress,className:"h-1"})]}):null,C.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(k.AlertCircle,{className:"h-3.5 w-3.5 text-destructive shrink-0"}),o.jsx("span",{className:"text-[11px] text-destructive",children:C.message}),o.jsx(le,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 ml-auto",onClick:()=>j({status:"idle"}),children:o.jsx(k.X,{className:"h-3 w-3"})})]}):null,C.status!=="uploading"?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:S,type:"file",accept:"application/pdf",className:"hidden",onChange:y=>{var I;const E=(I=y.target.files)==null?void 0:I[0];E&&P(E),y.target.value=""}}),o.jsxs(le,{type:"button",variant:"outline",size:"sm",className:"w-full h-8 text-xs gap-1.5",disabled:!v,onClick:()=>{var y;return(y=S.current)==null?void 0:y.click()},children:[o.jsx(k.Upload,{className:"h-3.5 w-3.5"}),e.termoPdfUploadId?"Substituir PDF":"Selecionar PDF"]}),!v&&o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Salve o schema uma vez para habilitar o upload."})]}):null]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Nome (chave)"}),o.jsx(Y,{value:e.name||t.replace(/^field_/,""),onChange:y=>!c&&s({name:y.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(B,{className:"text-xs",children:"Tipo do campo"}),o.jsxs(Ce,{value:a,onValueChange:y=>!c&&s({fieldType:y}),disabled:c,children:[o.jsx(ye,{className:"h-8 text-sm",children:o.jsx(je,{})}),o.jsx(we,{children:at.map(y=>o.jsx(pe,{value:y.component,children:y.label},y.component))})]})]}),o.jsx(xl,{tamanho:e.tamanho||6,inicioColuna:e.inicioColuna||1,defaultTamanho:6,onTamanhoChange:y=>s({tamanho:y}),onPositionChange:y=>s({inicioColuna:y})}),a!=="file"&&!l&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(B,{className:"text-xs",children:"Placeholder"}),o.jsx($e,{})]}),o.jsx(Y,{value:e.placeholder||"",onChange:y=>s({placeholder:y.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(B,{className:"text-xs",children:"Dica (hint)"}),o.jsx($e,{})]}),o.jsx(Y,{value:e.hint||"",onChange:y=>s({hint:y.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),a!=="file"&&!l&&!h&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Valor padrão"}),o.jsx(Y,{value:e.defaultValue||"",onChange:y=>s({defaultValue:y.target.value}),className:"h-8 text-sm",placeholder:"Valor inicial do campo"})]}),a!=="file"&&!l&&!h&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(B,{className:"text-xs",children:"Valor inicial (runtime)"}),o.jsx($e,{})]}),o.jsx(Y,{value:e.initialValue||"",onChange:y=>s({initialValue:y.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&&!h&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{id:"req",checked:e.required||!1,onCheckedChange:y=>s({required:y===!0})}),o.jsx(B,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),!l&&!h&&!c&&o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{id:"readonly",checked:e.isReadOnly||!1,onCheckedChange:y=>s({isReadOnly:y===!0||void 0})}),o.jsx(B,{htmlFor:"readonly",className:"text-xs cursor-pointer",children:"Somente leitura"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{id:"disabled",checked:e.isDisabled||!1,onCheckedChange:y=>s({isDisabled:y===!0||void 0})}),o.jsx(B,{htmlFor:"disabled",className:"text-xs cursor-pointer",children:"Desabilitado"})]})]}),f&&o.jsxs(o.Fragment,{children:[o.jsx(Ne,{}),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(B,{className:"text-xs",children:"Mínimo"}),o.jsx(Y,{type:"number",value:e.minValue??0,onChange:y=>s({minValue:Number(y.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Máximo"}),o.jsx(Y,{type:"number",value:e.maxValue??100,onChange:y=>s({maxValue:Number(y.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Passo"}),o.jsx(Y,{type:"number",min:1,value:e.step??1,onChange:y=>s({step:Number(y.target.value)}),className:"h-8 text-sm"})]})]})]})]}),x&&o.jsxs(o.Fragment,{children:[o.jsx(Ne,{}),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(B,{className:"text-xs",children:"Número de estrelas"}),o.jsxs(Ce,{value:String(e.maxRating??5),onValueChange:y=>s({maxRating:Number(y)}),children:[o.jsx(ye,{className:"h-8 text-sm",children:o.jsx(je,{})}),o.jsx(we,{children:[3,4,5,6,7,10].map(y=>o.jsxs(pe,{value:String(y),children:[y," estrelas"]},y))})]})]})]})]}),g&&o.jsxs(o.Fragment,{children:[o.jsx(Ne,{}),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(B,{className:"text-xs",children:"Label da data inicial"}),o.jsx(Y,{value:e.dateRangeStartLabel??"Data inicial",onChange:y=>s({dateRangeStartLabel:y.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Label da data final"}),o.jsx(Y,{value:e.dateRangeEndLabel??"Data final",onChange:y=>s({dateRangeEndLabel:y.target.value}),className:"h-8 text-sm"})]})]})]}),!l&&o.jsx(Ne,{}),!l&&o.jsx(Yf,{fieldType:a,validation:e.validation,onChange:y=>s({validation:y})}),i&&o.jsxs(o.Fragment,{children:[o.jsx(Ne,{}),a==="radio"&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Estilo visual"}),o.jsxs(Ce,{value:e.visualStyle||"card",onValueChange:y=>s({visualStyle:y}),children:[o.jsx(ye,{className:"h-8 text-sm",children:o.jsx(je,{})}),o.jsxs(we,{children:[o.jsx(pe,{value:"card",children:"Card (padrão)"}),o.jsx(pe,{value:"default",children:"Radio simples"})]})]})]}),o.jsx(Il,{options:e.options||[],onChange:y=>s({options:y})})]}),l&&o.jsxs(o.Fragment,{children:[o.jsx(Ne,{}),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(B,{className:"text-xs",children:"Mín. itens"}),o.jsx(Y,{type:"number",min:0,value:e.minItems??"",onChange:y=>s({minItems:y.target.value?Number(y.target.value):void 0}),className:"h-8 text-sm",placeholder:"0"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Máx. itens"}),o.jsx(Y,{type:"number",min:0,value:e.maxItems??"",onChange:y=>s({maxItems:y.target.value?Number(y.target.value):void 0}),className:"h-8 text-sm",placeholder:"Sem limite"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Label do item"}),o.jsx(Y,{value:e.itemLabel||"",onChange:y=>s({itemLabel:y.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(B,{className:"text-xs",children:"Label do botão adicionar"}),o.jsx(Y,{value:e.addLabel||"",onChange:y=>s({addLabel:y.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."})})]})]}),h&&o.jsxs(o.Fragment,{children:[o.jsx(Ne,{}),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(B,{className:"text-xs",children:"Título do grupo (opcional)"}),o.jsx(Y,{value:e.subSchemaTitle||"",onChange:y=>s({subSchemaTitle:y.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Endereço, Responsável..."})]}),o.jsx(Qf,{subFields:e.subSchemaFields||[],onChange:y=>s({subSchemaFields:y})})]})]}),o.jsx(Ne,{}),o.jsx(Jf,{condition:e.condition,selectedId:t,allFieldIds:r,getFieldLabel:n,onChange:y=>s({condition:y})}),e.condition&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Valor ao ocultar (clearedValue)"}),o.jsx(Y,{value:e.clearedValue??"",onChange:y=>s({clearedValue:y.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&&!h&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs text-muted-foreground",children:"Resolver de props (avançado)"}),o.jsx(Y,{value:e.resolvePropsKey||"",onChange:y=>s({resolvePropsKey:y.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."]})]})]})]})},th=()=>{const{selectedId:e,getConfig:t,updateConfig:r,getAllFieldIds:n}=ke();if(!e)return o.jsx("div",{className:"rounded-xl border bg-card p-4 text-center text-sm text-muted-foreground",children:"Clique em um item para configurá-lo"});const s=t(e),a=me(e),i=d=>r(e,d),l=n().filter(d=>d!==e),c=d=>t(d).label||d;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:a==="step"?"Step":a==="container"?"Container":"Campo"}),o.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:e})]}),o.jsx(Ne,{}),a==="step"&&o.jsx(xp,{config:s,onUpdate:i}),a==="container"&&o.jsx(hf,{config:s,onUpdate:i}),a==="field"&&o.jsx(eh,{config:s,selectedId:e,allFieldIds:l,getFieldLabel:c,onUpdate:i})]})},rh=(e,t)=>{var s,a,i,l,c,d;const r=((a=(s=e==null?void 0:e.containers)==null?void 0:s.root)==null?void 0:a.children)||[],n=[];for(const m of r){if(me(m)!=="step")continue;const p=((l=(i=e==null?void 0:e.containers)==null?void 0:i[m])==null?void 0:l.children)||[],f=[];for(const x of p){if(me(x)!=="container")continue;const h=(((d=(c=e==null?void 0:e.containers)==null?void 0:c[x])==null?void 0:d.children)||[]).filter(v=>me(v)==="field").map(v=>{var N,C;const b=t(v),w={id:v,config:b};if(b.fieldType==="field_array"){const j=((C=(N=e==null?void 0:e.containers)==null?void 0:N[v])==null?void 0:C.children)??[];w.subFields=j.filter(S=>me(S)==="field").map(S=>({id:S,config:t(S)}))}return w});f.push({id:x,config:t(x),fields:h})}n.push({id:m,config:t(m),containers:f})}return n},Br=(e,t,r)=>{var l;if(!e||!e.when)return!0;const n=e.source==="evento"?(r==null?void 0:r[e.when])||"":t[e.when]||"",s=parseFloat(n),a=parseFloat(e.value||"");let i;switch(e.operator){case"igual":i=n===(e.value||"");break;case"diferente":i=n!==(e.value||"");break;case"vazio":i=!n;break;case"naoVazio":i=!!n;break;case"contem":i=n.includes(e.value||"");break;case"naoContem":i=!n.includes(e.value||"");break;case"maiorQue":i=!isNaN(s)&&!isNaN(a)&&s>a;break;case"menorQue":i=!isNaN(s)&&!isNaN(a)&&s<a;break;case"maiorOuIgual":i=!isNaN(s)&&!isNaN(a)&&s>=a;break;case"menorOuIgual":i=!isNaN(s)&&!isNaN(a)&&s<=a;break;default:i=!0}if(e.logicOperator&&((l=e.extraConditions)!=null&&l.length)){const c=e.extraConditions.map(d=>Br(d,t,r));return e.logicOperator==="and"?i&&c.every(Boolean):i||c.some(Boolean)}return i},ts=(e,t,r,n)=>{if(!Br(t.condition,r,n))return;const s=t.validation,a=t.fieldType||"texto";if(t.required&&!e)return"Campo obrigatório";if(e){if(s!=null&&s.minLength&&e.length<s.minLength)return`Mínimo ${s.minLength} caracteres`;if(s!=null&&s.maxLength&&e.length>s.maxLength)return`Máximo ${s.maxLength} caracteres`;if(a==="number"){const i=Number(e);if(!isNaN(i)){if((s==null?void 0:s.min)!==void 0&&i<s.min)return`Valor mínimo: ${s.min}`;if((s==null?void 0:s.max)!==void 0&&i>s.max)return`Valor máximo: ${s.max}`}}if((a==="date"||a==="datetime")&&e){if(s!=null&&s.minDate&&e<s.minDate)return`Data mínima: ${s.minDate}`;if(s!=null&&s.maxDate&&e>s.maxDate)return`Data máxima: ${s.maxDate}`}if(s!=null&&s.regex)try{if(!new RegExp(s.regex).test(e))return s.regexMessage||"Formato inválido"}catch{}}},rs={email:"teste@email.com",number:"123",telefone:"(11) 99999-9999",cpf:"123.456.789-00",cep:"01001-000",date:new Date().toISOString().slice(0,10),datetime:new Date().toISOString().slice(0,10),textarea:"Texto de teste para preview",checkbox:"true",hidden:"",participation_type:JSON.stringify({tipo:"todos_os_dias",data:null,genero:null}),payment_method:JSON.stringify({metodo:"pix",valorTotal:0}),terms:""},Ll=(e,t)=>{var n;const r=e.fieldType||"texto";if(r==="field_array"){const s=Math.max(e.minItems??1,1),a=Array.from({length:s},()=>{const i={};return t==null||t.forEach(l=>{i[l.id]=Ll(l.config)}),i});return JSON.stringify(a)}return rs[r]!==void 0?rs[r]:(r==="select"||r==="radio")&&((n=e.options)!=null&&n.length)?e.options[0].value||"":"Teste"},oh={glassmorphism:"Glass",card:"Card",flat:"Flat",bordered:"Bordered"},nh=()=>{const{previewTemplateId:e,setPreviewTemplateId:t}=ke(),[r,n]=_.useState(!1),s=Object.values(Ye.TEMPLATE_REGISTRY),a=Ye.TEMPLATE_REGISTRY[e];return o.jsxs(Tr,{open:r,onOpenChange:n,children:[o.jsx(Ir,{asChild:!0,children:o.jsxs(le,{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:(a==null?void 0:a.colors.primary)??"#3b82f6"}}),o.jsx(k.Palette,{className:"w-3.5 h-3.5"}),o.jsx("span",{className:"hidden sm:inline",children:(a==null?void 0:a.displayName)??"Template"})]})}),o.jsxs(Vt,{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:s.map(i=>{const l=i.id===e,c=Ye.isDarkTemplate(i),d=oh[i.layout.containerStyle]??"";return o.jsxs("button",{onClick:()=>{t(i.id),n(!1)},className:U("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(k.Check,{className:"w-3 h-3 text-primary"})})]},i.id)})})]})]})},sh=({onFillMock:e,onClear:t})=>o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(nh,{}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(le,{variant:"outline",size:"sm",onClick:e,children:[o.jsx(k.FlaskConical,{className:"w-3.5 h-3.5 mr-1"}),"Preencher mock"]}),o.jsxs(le,{variant:"ghost",size:"sm",onClick:t,children:[o.jsx(k.Eraser,{className:"w-3.5 h-3.5 mr-1"}),"Limpar"]})]})]}),ah={texto:"text",number:"number",email:"email",telefone:"tel",cpf:"text",cep:"text",date:"date",datetime:"datetime-local"},Ol=e=>ah[e]||"text",xt=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,ih=({config:e,fieldId:t,subFields:r,tamanho:n,error:s,onChange:a,value:i})=>{const l=e.minItems??1,c=e.maxItems??10,d=e.itemLabel||"Item",m=e.addLabel||`Adicionar ${d}`,p=_.useRef(i||""),f=_.useCallback(()=>Object.fromEntries(r.map(j=>[j.id,""])),[r]),[x,g]=_.useState(()=>{if(i)try{const j=JSON.parse(i);if(Array.isArray(j)&&j.length>0)return j}catch{}return[f()]}),[h,v]=_.useState({});_.useEffect(()=>{if(i!==p.current){if(p.current=i||"",!i){g([f()]);return}try{const j=JSON.parse(i);Array.isArray(j)&&g(j)}catch{}}},[i,f]),_.useEffect(()=>{if(!s){v({});return}const j={};x.forEach((S,P)=>{r.forEach(y=>{const E=S[y.id]??"";y.config.required&&!E.trim()&&(j[`${P}.${y.id}`]="Campo obrigatório")})}),v(j)},[s,x,r]);const b=j=>{if(!a)return;const S=j.map(y=>{const E={};return r.forEach(I=>{E[I.id]=y[I.id]??""}),E}),P=JSON.stringify(S);p.current=P,a(P)},w=()=>{if(x.length>=c)return;const j=[...x,f()];g(j),b(j)},N=j=>{if(x.length<=l)return;const S=x.filter((P,y)=>y!==j);g(S),b(S)},C=(j,S,P)=>{const y=x.map((E,I)=>I===j?{...E,[S]:P}:E);g(y),b(y),v(E=>{const I={...E};return delete I[`${j}.${S}`],I})};return o.jsxs("div",{className:"space-y-2",style:{gridColumn:`span ${n}`},children:[e.label&&o.jsx(B,{className:"text-sm font-medium",children:e.label}),o.jsx("div",{className:"space-y-3",children:x.map((j,S)=>o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-3 shadow-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full bg-orange-500 text-white text-xs font-bold shrink-0",children:S+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[d," ",S+1]})]}),x.length>l&&o.jsx(le,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive/60 hover:text-destructive",onClick:()=>N(S),children:o.jsx(k.Trash2,{className:"h-4 w-4"})})]}),r.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Sem sub-campos configurados"}):o.jsx("div",{className:"grid grid-cols-12 gap-3",children:r.map(P=>{const y=P.config.fieldType||"texto",E=P.config.tamanho||6,I=j[P.id]??"",L=z=>C(S,P.id,z),D=h[`${S}.${P.id}`];return o.jsxs("div",{className:"space-y-1",style:{gridColumn:`span ${E}`},children:[o.jsxs(B,{className:"text-xs font-medium",children:[P.config.label,P.config.required&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),y==="textarea"?o.jsx(Mr,{placeholder:P.config.placeholder,className:D?"text-sm border-destructive":"text-sm",value:I,onChange:z=>L(z.target.value)}):y==="select"?o.jsxs(Ce,{value:I,onValueChange:L,children:[o.jsx(ye,{className:D?"text-sm border-destructive":"text-sm",children:o.jsx(je,{placeholder:P.config.placeholder||"Selecione..."})}),o.jsx(we,{children:(P.config.options||[]).map((z,M)=>o.jsx(pe,{value:z.value||`__opt_${M}`,children:z.label},`${M}-${z.value}`))})]}):y==="checkbox"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{checked:I==="true",onCheckedChange:z=>L(z?"true":"")}),o.jsx("span",{className:"text-sm text-muted-foreground",children:P.config.placeholder||P.config.label})]}):o.jsx(Y,{type:Ol(y),placeholder:P.config.placeholder,className:D?"text-sm border-destructive":"text-sm",value:I,onChange:z=>L(z.target.value)}),D&&o.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[o.jsx(k.AlertCircle,{className:"h-3 w-3 shrink-0"}),D]})]},P.id)})})]},S))}),o.jsxs(le,{type:"button",variant:"outline",className:"w-full border-dashed border-orange-500 text-orange-500 hover:bg-orange-500/10 hover:text-orange-500 font-semibold",onClick:w,disabled:x.length>=c,children:[o.jsx(k.Plus,{className:"h-4 w-4 mr-2"}),m]}),e.maxItems&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",e.maxItems," ",d.toLowerCase(),e.maxItems!==1?"s":""]}),!e.maxItems&&e.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:e.hint}),s&&o.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[o.jsx(k.AlertCircle,{className:"h-4 w-4 shrink-0"}),s]})]})},lh=({config:e,fieldId:t,value:r,onChange:n,visible:s,error:a,subFields:i,eventoData:l,allValues:c})=>{const d=e.fieldType||"texto",m=e.tamanho||6;if(!s)return null;if(d==="field_array")return o.jsx(ih,{config:e,fieldId:t,subFields:i??[],tamanho:m,error:a,onChange:n,value:r});const p=a?"border-destructive":"";return o.jsxs("div",{className:"space-y-1",style:{gridColumn:e.inicioColuna?`${e.inicioColuna} / span ${m}`:`span ${m}`},children:[d!=="terms"&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs(B,{className:"text-sm font-medium",children:[e.label,e.required&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.condition&&o.jsxs(Vr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 border-amber-500/50 text-amber-600",children:[o.jsx(k.Zap,{className:"h-2.5 w-2.5 mr-0.5"}),"cond"]})]}),d==="textarea"?o.jsx(Mr,{placeholder:e.placeholder,className:U("text-sm",p),value:r,onChange:f=>n(f.target.value)}):d==="select"?o.jsxs(Ce,{value:r,onValueChange:n,children:[o.jsx(ye,{className:U("text-sm",p),children:o.jsx(je,{placeholder:e.placeholder||"Selecione..."})}),o.jsx(we,{children:(e.options||[]).map((f,x)=>o.jsx(pe,{value:f.value||`__opt_${x}`,children:f.label},`${x}-${f.value}`))})]}):d==="checkbox"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{checked:r==="true",onCheckedChange:f=>n(f?"true":"")}),o.jsx("span",{className:"text-sm text-muted-foreground",children:e.placeholder||e.label})]}):d==="checkbox_group"?o.jsx(ch,{config:e,value:r,onChange:n}):d==="radio"?o.jsx("div",{className:"space-y-2",children:(e.options||[{value:"1",label:"Opção 1"}]).map((f,x)=>e.visualStyle==="default"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"radio",readOnly:!0,checked:r===f.value,className:"accent-orange-500"}),o.jsx("span",{className:"text-sm",children:f.label})]},`${x}-${f.value}`):o.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border-2 transition-all cursor-pointer bg-card border-border",children:[o.jsx("input",{type:"radio",readOnly:!0,checked:r===f.value,className:"accent-orange-500"}),o.jsx("span",{className:"text-sm flex-1",children:f.label})]},`${x}-${f.value}`))}):d==="participation_type"?(()=>{const f=parseInt((l==null?void 0:l["evento.valor"])??"0")||0,x=parseInt((l==null?void 0:l["evento.valorPorDia"])??"0")||0,g=l==null?void 0:l["evento.vagasTotal"],h=l==null?void 0:l["evento.vagasPorDia"],v=l==null?void 0:l["evento.vagasMasculinas"],b=l==null?void 0:l["evento.vagasFemininas"],w=!!(v&&Number(v)>0)&&!!(b&&Number(b)>0),N=l==null?void 0:l["evento.dataInicioEvento"],C=l==null?void 0:l["evento.dataFimEvento"],j=R=>R?R.slice(8,10)+"/"+R.slice(5,7)+"/"+R.slice(0,4):"—",S=N&&C?`${j(N)} a ${j(C)}`:"Período do evento",y=(N&&C?Math.round((new Date(C.slice(0,10)+"T00:00:00Z").getTime()-new Date(N.slice(0,10)+"T00:00:00Z").getTime())/864e5)+1:0)>1;let E={};try{E=r?JSON.parse(r):{}}catch{}const I=E.tipo??null,L=E.data??null,D=E.genero??null,z=R=>n(JSON.stringify({tipo:R,data:null,...w?{genero:D}:{}})),M=R=>n(JSON.stringify({tipo:"por_dia",data:R,...w?{genero:D}:{}})),$=R=>n(JSON.stringify({tipo:I,data:L,genero:R})),A=[];if(y&&N&&C){const R=new Date(N.slice(0,10)+"T00:00:00Z"),V=new Date(C.slice(0,10)+"T00:00:00Z");let O=0;for(;R<=V&&O++<60;)A.push(R.toISOString().slice(0,10)),R.setUTCDate(R.getUTCDate()+1)}const T=R=>{const[V,O,q]=R.split("-").map(Number),se=new Date(Date.UTC(V,O-1,q)),ie=String(q).padStart(2,"0"),X=String(O).padStart(2,"0"),ne=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(se);return`${ie}/${X} — ${ne.charAt(0).toUpperCase()}${ne.slice(1)}`};return o.jsxs("div",{className:"space-y-2",children:[w&&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(R=>{const V=R==="masculino"?"Masculino":"Feminino";return o.jsx("button",{type:"button",onClick:()=>$(R),className:U("px-3 py-1 rounded-full text-xs font-medium border transition-all",D===R?"border-primary bg-primary text-primary-foreground":"border-border bg-card text-muted-foreground hover:border-primary/60"),children:V},R)})})]}),o.jsxs("button",{type:"button",onClick:()=>z("todos_os_dias"),className:U("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all bg-card",I==="todos_os_dias"?"border-primary bg-primary/10":"border-border hover:border-primary/40"),children:[o.jsx("div",{className:U("mt-0.5 p-2 rounded-lg shrink-0",I==="todos_os_dias"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:o.jsx(k.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar todos os dias"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:S})]}),o.jsxs("div",{className:"text-right shrink-0",children:[o.jsx("p",{className:U("text-sm font-bold",I==="todos_os_dias"?"text-primary":"text-foreground"),children:f>0?xt(f):"R$ —,—"}),g&&o.jsxs("p",{className:"text-xs text-emerald-500 flex items-center justify-end gap-1",children:[o.jsx(k.Users,{className:"w-3 h-3"}),g," vagas"]})]})]}),y?o.jsxs("button",{type:"button",onClick:()=>z("por_dia"),className:U("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all bg-card",I==="por_dia"?"border-primary bg-primary/10":"border-border hover:border-primary/40"),children:[o.jsx("div",{className:U("mt-0.5 p-2 rounded-lg shrink-0",I==="por_dia"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:o.jsx(k.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[o.jsx("p",{className:U("text-sm font-bold",I==="por_dia"?"text-primary":"text-foreground"),children:x>0?xt(x):"R$ —,—"}),h&&o.jsxs("p",{className:"text-xs text-emerald-500 flex items-center justify-end gap-1",children:[o.jsx(k.Users,{className:"w-3 h-3"}),h," vagas/dia"]})]})]}):N?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg bg-muted/50 border border-border",children:[o.jsx(k.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'Evento de 1 dia — a opção "Participar um dia" não é exibida.'})]}):o.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl border-2 border-border bg-card opacity-40",children:[o.jsx("div",{className:"mt-0.5 p-2 rounded-lg shrink-0 bg-muted text-muted-foreground",children:o.jsx(k.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Visível se evento tiver 2+ dias"})]}),o.jsx("div",{className:"text-right shrink-0",children:o.jsx("p",{className:"text-sm font-bold text-primary",children:"R$ —,—"})})]}),I==="por_dia"&&A.length>0&&o.jsxs("div",{className:"pl-2 space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold text-primary uppercase tracking-wide",children:"Selecione o dia:"}),A.map(R=>o.jsxs("button",{type:"button",onClick:()=>M(R),className:U("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",L===R?"border-primary bg-primary/10 text-primary":"border-border bg-card hover:border-primary/40"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:U("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center",L===R?"border-primary bg-primary":"border-muted-foreground"),children:L===R&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-primary-foreground"})}),o.jsx("span",{className:"text-sm",children:T(R)})]}),h&&o.jsxs("span",{className:"text-xs text-emerald-500",children:[h," vagas"]})]},R))]})]})})():d==="payment_method"?(()=>{const g=(c==null?void 0:c._participation_type_field)??"";let h={};try{h=g?JSON.parse(g):{}}catch{}const v=h.tipo??null,b=Number((l==null?void 0:l["evento.valor"])??0)||0,w=Number((l==null?void 0:l["evento.valorPorDia"])??0)||0,N=v==="por_dia"&&w>0?w:b,C=v==="por_dia"?(()=>{if(!h.data)return"Um dia";const[E,I,L]=h.data.split("-");return`${L}/${I}/${E}`})():"Todos os dias",j=v==="por_dia"?[{id:"pix",label:"PIX",desc:"Transferência instantânea (à vista)",taxa:0,parcelas:0},{id:"dinheiro",label:"Dinheiro",desc:"Pagamento em espécie",taxa:0,parcelas:0},{id:"cartao",label:"Cartão de Crédito",desc:"Débito ou crédito na maquininha",taxa:.0315,parcelas:0,taxaLabel:`Taxa InfinityPay: ${(.0315*100).toFixed(2).replace(".",",")}%`}]:[{id:"pix",label:"PIX à Vista",desc:"Pagamento instantâneo sem parcelamento",taxa:0,parcelas:0},{id:"pix_parcelado",label:"PIX Parcelado",desc:"Parcelado em até 7x sem juros",taxa:0,parcelas:7},{id:"cartao",label:"Cartão de Crédito",desc:"Parcelado em até 12x",taxa:.124,parcelas:12,taxaLabel:`Taxa InfinityPay: ${(.124*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",desc:"Pagamento em espécie",taxa:0,parcelas:0}];let S={};try{S=r?JSON.parse(r):{}}catch{}const P=S.metodo??null,y=E=>{const I=Math.round(N*(1+E.taxa)*100)/100,L={metodo:E.id,valorTotal:I};E.parcelas>1&&(L.parcelas=E.parcelas),n(JSON.stringify(L))};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border bg-card px-4 py-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:C})]}),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:xt(N)})]})]}),o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2.5",children:[o.jsx(k.Info,{className:"h-4 w-4 text-amber-500 mt-0.5 shrink-0"}),o.jsxs("p",{className:"text-xs text-amber-200",children:[o.jsx("span",{className:"font-bold text-amber-400",children:"Importante:"})," ","Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:j.map(E=>{const I=P===E.id,L=Math.round(N*(1+E.taxa)*100)/100,D=E.parcelas>1,z=D?Math.round(L/E.parcelas*100)/100:null;return o.jsxs("button",{type:"button",onClick:()=>y(E),className:U("w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all bg-card",I?"border-primary bg-primary/10":"border-border hover:border-primary/50"),children:[o.jsx("div",{className:U("flex items-center justify-center w-10 h-10 rounded-lg shrink-0",I?"bg-primary/20":"bg-muted"),children:o.jsx(k.Wallet,{className:U("h-5 w-5",I?"text-primary":"text-muted-foreground")})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:E.label}),o.jsx("p",{className:"text-xs text-muted-foreground",children:E.desc}),E.taxaLabel&&o.jsxs("p",{className:"text-xs text-amber-400 mt-0.5",children:["* ",E.taxaLabel]}),E.taxa>0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",xt(L)]})]}),o.jsx("div",{className:"text-right shrink-0",children:D?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[E.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold text-primary",children:xt(z)})]}):o.jsx("p",{className:"text-base font-bold text-primary",children:xt(L)})})]},E.id)})})]})})():d==="terms"?(()=>{const f=r==="accepted",x=e.termoTexto,g=e.termoPdfUrl,h=!!e.termoPdfUploadId,v=!!(x||g||h);return o.jsxs("div",{className:U("rounded-lg border p-4 space-y-4 transition-colors",f?"border-green-500/40 bg-green-500/5":"border-border bg-muted/30"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(k.ScrollText,{className:"h-4 w-4 text-primary shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:e.label||"Termos e condições"})]}),v?o.jsxs("div",{className:"flex items-center gap-1.5",children:[h&&o.jsx("span",{className:"flex items-center gap-1 text-[10px] text-green-600 dark:text-green-400 font-medium border border-green-500/40 bg-green-500/10 rounded px-1.5 py-0.5",children:"PDF enviado ✓"}),o.jsxs(le,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{},children:[o.jsx(k.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]})]}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx(xe,{checked:f,onCheckedChange:b=>n(b?"accepted":""),className:"mt-0.5"}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito"," ",e.label?`"${e.label}"`:"os termos e condições"]}),f&&o.jsx(k.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]})})():d==="file"?o.jsx(Y,{type:"file",className:U("text-sm",p)}):d==="hidden"?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Campo oculto"}):o.jsx(Y,{type:Ol(d),placeholder:e.placeholder,className:U("text-sm",p),value:r,onChange:f=>n(f.target.value)}),a?o.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[o.jsx(k.AlertCircle,{className:"h-3 w-3 shrink-0"}),a]}):e.hint?o.jsx("p",{className:"text-xs text-muted-foreground",children:e.hint}):null]})},ch=({config:e,value:t,onChange:r})=>{var i;const n=new Set(t?t.split(","):[]),s=(i=e.options)!=null&&i.length?e.options:[{value:"1",label:"Opção 1"}],a=l=>{const c=new Set(n);c.has(l)?c.delete(l):c.add(l),r(Array.from(c).join(","))};return o.jsx("div",{className:"space-y-1",children:s.map((l,c)=>o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{checked:n.has(l.value),onCheckedChange:()=>a(l.value),disabled:l.disabled}),o.jsx("span",{className:"text-sm",children:l.label})]},`${c}-${l.value}`))})},dh=({step:e,stepIndex:t,formValues:r,errors:n,eventoData:s,onChange:a})=>o.jsxs("div",{className:"rounded-xl border bg-card p-5 space-y-5",children:[o.jsxs("div",{children:[e.config.showLabel!==!1&&o.jsxs("h2",{className:"text-base font-bold text-foreground",children:["Step ",t+1," — ",e.config.label]}),e.config.description&&o.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:e.config.description})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4",children:e.containers.map(i=>o.jsxs("div",{className:U("space-y-3",i.config.showAsCard&&"rounded-lg border bg-card p-4 shadow-sm"),style:{gridColumn:i.config.inicioColuna?`${i.config.inicioColuna} / span ${i.config.tamanho||12}`:`span ${i.config.tamanho||12}`},children:[i.config.showLabel!==!1&&i.config.label!=="Novo Container"&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold text-foreground",children:i.config.label}),i.config.description&&o.jsx("p",{className:"text-xs text-muted-foreground",children:i.config.description})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-3",children:i.fields.map(l=>o.jsx(lh,{config:l.config,fieldId:l.id,subFields:l.subFields,value:r[l.id]||"",onChange:c=>a(l.id,c),visible:Br(l.config.condition,r,s),error:n[l.id],eventoData:s,allValues:r},l.id))})]},i.id))})]}),uh=({currentStep:e,isLastStep:t,onBack:r,onNext:n})=>o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs(le,{variant:"outline",onClick:r,disabled:e===0,children:[o.jsx(k.ChevronLeft,{className:"w-4 h-4 mr-1"}),"Voltar"]}),o.jsx(le,{onClick:n,children:t?o.jsxs(o.Fragment,{children:[o.jsx(k.Check,{className:"w-4 h-4 mr-1"}),"Finalizar"]}):o.jsxs(o.Fragment,{children:[o.jsx(k.ChevronRight,{className:"w-4 h-4 mr-1"}),"Próximo"]})})]}),mh=({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(k.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(le,{variant:"outline",onClick:e,children:[o.jsx(k.RotateCcw,{className:"w-4 h-4 mr-1"}),"Recomeçar"]})]}),pr=e=>{if(e)return Lt[e]},ph=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,s)=>o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(s),onKeyDown:a=>a.key==="Enter"&&(r==null?void 0:r(s)),className:U("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:s===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:s<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:s<t?o.jsx(k.Check,{className:"w-4 h-4"}):s+1},n.id))}),fh=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,s)=>{const a=pr(n.icone)??k.CircleDot;return o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(s),onKeyDown:i=>i.key==="Enter"&&(r==null?void 0:r(s)),className:U("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:s===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:s<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:s<t?o.jsx(k.Check,{className:"w-4 h-4"}):o.jsx(a,{className:"w-4 h-4"})},n.id)})}),hh=({steps:e,currentStep:t,position:r,orientation:n="horizontal",onStepClick:s})=>n==="vertical"?o.jsx("div",{className:"flex flex-col gap-0",children:e.map((a,i)=>{const l=pr(a.icone)??k.CircleDot,c=i===t,d=i<t,m=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:()=>s==null?void 0:s(i),className:U("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",s&&"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(k.Check,{className:"w-3.5 h-3.5"}):o.jsx(l,{className:"w-3.5 h-3.5"})}),!m&&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:a.label})]},a.id)})}):o.jsx("div",{className:"w-full flex items-start",children:e.map((a,i)=>{const l=pr(a.icone)??k.CircleDot,c=i===t,d=i<t,m=i===e.length-1;return o.jsxs("div",{className:U("flex items-start",!m&&"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:()=>s==null?void 0:s(i),className:U("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",s&&"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(k.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:a.label})]}),!m&&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)"}})]},a.id)})}),xh=({steps:e,currentStep:t,onStepClick:r,className:n})=>{const s=Ye.useTemplate(),{layout:a}=s;if(!a.showStepIndicators||e.length<=1)return null;const i=a.stepIndicatorVariant??"numbers",l=a.stepIndicatorPosition??"top-center",c=a.stepIndicatorOrientation??"horizontal",d=(t+1)/e.length*100,m=e[t],p=pr(m==null?void 0:m.icone)??k.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:`${d}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),x=o.jsxs("div",{className:"block sm:hidden space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:o.jsx(p,{className:"w-5 h-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:m==null?void 0:m.label}),o.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),f]}),g=o.jsxs("div",{className:"hidden sm:block",children:[i==="numbers"&&o.jsx(ph,{steps:e,currentStep:t,onStepClick:r}),i==="icons"&&o.jsx(fh,{steps:e,currentStep:t,onStepClick:r}),i==="icons-labeled"&&o.jsx(hh,{steps:e,currentStep:t,position:l,orientation:c,onStepClick:r})]}),h=a.showProgressBar?o.jsx("div",{className:"hidden sm:block",children:f}):null;return c==="vertical"?o.jsxs("div",{className:U("flex gap-6 items-start",n),children:[x,o.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[g,h&&o.jsx("div",{className:"flex-1 pt-4",children:h})]})]}):o.jsxs("div",{className:U("space-y-3",n),children:[x,o.jsxs("div",{className:"hidden sm:block space-y-3",children:[g,h]})]})},gh=({eventoData:e})=>{const{getConfig:t,containers:r,previewTemplateId:n}=ke(),s=rh({containers:r},t),[a,i]=_.useState({}),[l,c]=_.useState(0),[d,m]=_.useState(!1),[p,f]=_.useState({}),[x,g]=_.useState(!1),h=Math.min(l,Math.max(s.length-1,0));_.useEffect(()=>{h!==l&&c(h)},[h,l,c]);const v=_.useCallback((L,D)=>{var z;if(i(M=>({...M,[L]:D})),x){const M=(z=s[h])==null?void 0:z.containers.flatMap($=>$.fields).find($=>$.id===L);if(M){const $=ts(D,M.config,{...a,[L]:D},e);f(A=>{const T={...A};return $?T[L]=$:delete T[L],T})}}},[x,s,h,a,e,i,f]),b=_.useCallback(()=>{const L=s[h];if(!L)return!0;const D={};for(const M of L.containers)for(const $ of M.fields){if($.config.fieldType==="field_array"){let T=!1;try{const R=a[$.id],V=R?JSON.parse(R):[],O=$.config.minItems??1;if(V.length<O)D[$.id]=`Mínimo de ${O} item${O!==1?"s":""} obrigatório${O!==1?"s":""}`,T=!0;else{for(const q of V){for(const se of $.subFields??[]){const ie=q[se.id]??"";if(se.config.required&&!ie.trim()){T=!0;break}}if(T)break}T&&(D[$.id]="Preencha todos os campos obrigatórios")}}catch{$.config.required&&(D[$.id]="Campo obrigatório")}continue}const A=ts(a[$.id]||"",$.config,a,e);A&&(D[$.id]=A)}f(D),g(!0);const z=Object.keys(D).length;return z>0?(console.warn(`Corrija ${z} campo(s) destacado(s) antes de continuar`),!1):!0},[s,h,a,e,f,g]),w=_.useCallback(()=>{b()&&(g(!1),f({}),h>=s.length-1?m(!0):c(L=>L+1))},[b,h,s.length,g,f,m,c]),N=_.useCallback(()=>{c(L=>L-1),g(!1),f({})},[c,g,f]),C=_.useCallback(()=>{const L={};for(const D of s)for(const z of D.containers)for(const M of z.fields)Br(M.config.condition,a,e)&&(L[M.id]=Ll(M.config,M.subFields));i(D=>({...D,...L}))},[s,a,e,i]),j=_.useCallback(()=>{i({}),f({}),g(!1)},[i,f,g]),S=_.useCallback(()=>{m(!1),c(0),j()},[m,c,j]);if(s.length===0)return o.jsx("div",{className:"rounded-lg border border-dashed border-border/40 p-6 text-center text-xs text-muted-foreground/50",children:"Adicione steps, containers e campos para ver o preview ao vivo"});if(d)return o.jsx(mh,{onRestart:S});const P=s[h],y=s.length,E=h===y-1,I=Ye.getTemplateConfig(n);return o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"px-1",children:o.jsx(sh,{onFillMock:C,onClear:j})}),o.jsx(Ye.TemplateProvider,{config:I,className:I.wrapperClass,style:{minHeight:"100%",padding:"12px",borderRadius:"12px"},children:o.jsxs("div",{className:"max-w-4xl mx-auto space-y-4",children:[o.jsx(xh,{steps:s.map(L=>({id:L.id,label:L.config.label,icone:L.config.icone})),currentStep:h}),o.jsx(dh,{step:P,stepIndex:h,formValues:a,errors:p,eventoData:e,onChange:v}),o.jsx(uh,{currentStep:h,isLastStep:E,onBack:N,onNext:w})]})})]})},_l=({id:e,currentTamanho:t,inicioColuna:r,onResize:n})=>{const s=_.useRef(null),[a,i]=_.useState(!1),[l,c]=_.useState(null),d=_.useRef(null);_.useEffect(()=>()=>{var p;(p=d.current)==null||p.call(d)},[]);const m=_.useCallback(p=>{p.preventDefault(),p.stopPropagation();const f=s.current;if(!f)return;const x=f.parentElement;if(!x)return;const g=x.getBoundingClientRect().width,h=f.getBoundingClientRect().width,v=p.clientX,b=r?13-r:12;i(!0);const w=C=>{const j=C.clientX-v,P=(h+j)/g,y=Math.max(1,Math.min(b,Math.round(P*12)));c(y),n(y)},N=()=>{i(!1),c(null),d.current=null,window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",N)};d.current=()=>{i(!1),c(null),window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",N)},window.addEventListener("mousemove",w),window.addEventListener("mouseup",N)},[r,n]);return{resizeRef:s,resizing:a,resizePreview:l,handleResizeStart:m}},vh=({id:e,elementRef:t,onPositionApply:r,setPositionDrag:n,setSelected:s})=>{const a=_.useRef(null);return _.useEffect(()=>()=>{var l;(l=a.current)==null||l.call(a)},[]),{handlePositionMouseDown:_.useCallback(l=>{l.preventDefault(),l.stopPropagation(),s(e);const c=t.current;if(!c)return;const d=c.parentElement;if(!d)return;const m=d.getBoundingClientRect(),p=m.width/12,f=c.getBoundingClientRect(),x=Math.max(1,Math.round(f.width/p)),g=f.left-m.left,h=l.clientX-f.left,v=C=>{const j=C-m.left-h,S=Math.round(j/p)+1;return Math.max(1,Math.min(13-x,S))},b=Math.max(1,Math.min(12,Math.round(g/p)+1));n({itemId:e,ghostStart:b,ghostSpan:x,cursorX:l.clientX,cursorY:l.clientY});const w=C=>{n({itemId:e,ghostStart:v(C.clientX),ghostSpan:x,cursorX:C.clientX,cursorY:C.clientY})},N=C=>{r(v(C.clientX)),n(null),a.current=null,window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",N)};a.current=()=>{n(null),window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",N)},window.addEventListener("mousemove",w),window.addEventListener("mouseup",N)},[e,t,r,n,s])}},Bt=({id:e,container:t})=>{const{attributes:r,listeners:n,setNodeRef:s,transform:a,transition:i,isDragging:l}=Fe.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{selectedId:c,setSelected:d,getConfig:m,updateConfig:p,removeItem:f,setPositionDrag:x,positionDrag:g}=ke(),h=m(e),v=as(e),b=(v==null?void 0:v.icon)||k.Type,w=c===e,N=h.tamanho||6,C=(g==null?void 0:g.itemId)===e,[j,S]=_.useState(!1),P="var(--t-primary, hsl(var(--primary)))",y=w?P:j?`color-mix(in srgb, ${P} 60%, transparent)`:`color-mix(in srgb, ${P} 25%, transparent)`,E=w?`0 0 0 2px color-mix(in srgb, ${P} 30%, transparent)`:void 0,{resizeRef:I,resizing:L,resizePreview:D,handleResizeStart:z}=_l({id:e,currentTamanho:N,inicioColuna:h.inicioColuna,onResize:$=>p(e,{tamanho:$})}),{handlePositionMouseDown:M}=vh({id:e,elementRef:I,onPositionApply:$=>p(e,{inicioColuna:$}),setPositionDrag:x,setSelected:d});return o.jsxs("div",{ref:$=>{s($),I.current=$},onClick:$=>{$.stopPropagation(),d(e)},"data-field-id":e,onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),className:U("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:h.inicioColuna?`${h.inicioColuna} / span ${N}`:`span ${N}`,transform:Mt.CSS.Transform.toString(a),transition:i,opacity:l?0:1,borderColor:y,boxShadow:E},children:[o.jsx("div",{onMouseDown:M,onClick:$=>$.stopPropagation(),className:"cursor-ew-resize shrink-0 p-0.5 rounded hover:bg-primary/20 transition-colors",title:"Arrastar para mudar coluna",children:o.jsx(k.ArrowLeftRight,{className:"h-3 w-3 text-primary/60"})}),o.jsx("div",{...n,...r,className:"cursor-grab shrink-0",onClick:$=>$.stopPropagation(),children:o.jsx(k.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:h.label}),h.condition&&o.jsx(k.Zap,{className:"h-3 w-3 text-amber-500 shrink-0"}),h.required&&o.jsx("span",{className:"text-destructive font-bold",children:"*"}),o.jsxs("span",{className:"text-[9px] text-muted-foreground shrink-0",children:[D??N,"/12"]}),o.jsx("button",{onClick:$=>{$.stopPropagation(),f(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:j?1:0},children:o.jsx(k.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(k.GripHorizontal,{className:"h-3 w-3 text-primary/40 rotate-90"})})]})},bh=({id:e,container:t})=>{var j;const{attributes:r,listeners:n,setNodeRef:s,transform:a,transition:i,isDragging:l}=Fe.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{setNodeRef:c,isOver:d}=jt.useDroppable({id:`zone-${e}`}),{selectedId:m,setSelected:p,getConfig:f,removeItem:x,moveItem:g,containers:h}=ke(),v=f(e),w=(((j=h[e])==null?void 0:j.children)??[]).filter(S=>me(S)==="field"),N=m===e,C=v.tamanho||12;return o.jsxs("div",{ref:s,onClick:S=>{S.stopPropagation(),p(e)},className:U("group/fa relative rounded-lg border overflow-hidden transition-all",l&&"opacity-0 pointer-events-none",N?"border-amber-500 ring-2 ring-amber-500/20 shadow-lg":"border-amber-500/30 hover:border-amber-500/55"),style:{gridColumn:v.inicioColuna?`${v.inicioColuna} / span ${C}`:`span ${C}`,transform:Mt.CSS.Transform.toString(a),transition:i},children:[o.jsxs("div",{className:U("flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",N?"bg-amber-500/15 border-amber-500/30":"bg-amber-500/10 border-amber-500/20"),children:[o.jsx("div",{...n,...r,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-amber-500/20 transition-colors",onClick:S=>S.stopPropagation(),children:o.jsx(k.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:S=>{S.stopPropagation(),g(e,"up")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(k.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})}),o.jsx("button",{onClick:S=>{S.stopPropagation(),g(e,"down")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(k.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})})]}),o.jsx(k.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:v.label}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-amber-500/10 px-1.5 rounded",children:[v.itemLabel||"Item"," · ",w.length," campo",w.length!==1?"s":""]}),o.jsx("button",{onClick:S=>{S.stopPropagation(),x(e)},className:"opacity-0 group-hover/fa:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",children:o.jsx(k.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:c,className:U("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",d?"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:[w.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(Fe.SortableContext,{items:w,strategy:Fe.rectSortingStrategy,children:w.map(S=>o.jsx(Bt,{id:S,container:e},S))})]})]})},os=5,yh=({id:e,elementRef:t,tamanho:r,inicioColuna:n,onPositionApply:s,setPositionDrag:a,setSelected:i,reorderStrategy:l})=>{const c=_.useRef({inicioColuna:n,tamanho:r});c.current={inicioColuna:n,tamanho:r};const d=_.useRef(null);return _.useEffect(()=>()=>{var p;(p=d.current)==null||p.call(d)},[]),{handleGripMouseDown:_.useCallback(p=>{p.preventDefault(),p.stopPropagation(),i(e);const f=p.clientX,x=p.clientY;let g=!1;const h=()=>{d.current=null,window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",b)},v=C=>{const j=Math.abs(C.clientX-f),S=Math.abs(C.clientY-x);j<os&&S<os||(g=!0,h(),j>=S?w(C):N(C))},b=()=>{g||h()};window.addEventListener("mousemove",v),window.addEventListener("mouseup",b),d.current=h;const w=C=>{const j=t.current;if(!j)return;const S=j.parentElement;if(!S)return;const P=S.getBoundingClientRect(),E=P.width/12,{tamanho:I}=c.current,L=j.getBoundingClientRect(),D=L.left-P.left,z=Math.max(1,Math.min(12,Math.round(D/E)+1)),M=L.left;a({itemId:e,ghostStart:z,ghostSpan:I,cursorX:C.clientX,cursorY:C.clientY});const $=R=>{const V=R-M,O=Math.round(V/E)+1;return Math.max(1,Math.min(13-I,O))};a({itemId:e,ghostStart:$(C.clientX),ghostSpan:I,cursorX:C.clientX,cursorY:C.clientY});const A=R=>{a({itemId:e,ghostStart:$(R.clientX),ghostSpan:I,cursorX:R.clientX,cursorY:R.clientY})},T=R=>{s($(R.clientX)),a(null),d.current=null,window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",T)};window.addEventListener("mousemove",A),window.addEventListener("mouseup",T),d.current=()=>{a(null),window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",T)}},N=C=>{const j=l,S=t.current;if(!S)return;const P=S.parentElement;if(!P)return;const y=j.dataAttribute||"data-container-id";j.pushSnapshot(),j.setReorderDrag({draggingId:e});let E=C.clientY;const I=D=>{const z=Array.from(P.children).filter(M=>M!==S&&M.getAttribute(y));for(const M of z){const $=M.getBoundingClientRect(),A=$.top+$.height/2;if(D.clientY<A&&D.clientY>$.top&&D.clientY<E){j.moveItemNoSnapshot(e,"up"),E=D.clientY;break}else if(D.clientY>A&&D.clientY<$.bottom&&D.clientY>E){j.moveItemNoSnapshot(e,"down"),E=D.clientY;break}}},L=()=>{j.setReorderDrag(null),d.current=null,window.removeEventListener("mousemove",I),window.removeEventListener("mouseup",L)};window.addEventListener("mousemove",I),window.addEventListener("mouseup",L),d.current=()=>{j.setReorderDrag(null),window.removeEventListener("mousemove",I),window.removeEventListener("mouseup",L)}}},[e,t,s,a,i,l])}},un=({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]})})]}),mn=({id:e,container:t})=>{var ie;const{setNodeRef:r,isOver:n}=jt.useDroppable({id:`zone-${e}`}),{selectedId:s,setSelected:a,getConfig:i,updateConfig:l,removeItem:c,moveItem:d,moveItemNoSnapshot:m,setPositionDrag:p,positionDrag:f,reorderDrag:x,setReorderDrag:g,pushSnapshot:h,containers:v}=ke(),b=i(e),w=((ie=v[e])==null?void 0:ie.children)??[],N=w.filter(X=>me(X)==="field"),C=s===e,j=b.tamanho||12,S=(f==null?void 0:f.itemId)===e,P=(x==null?void 0:x.draggingId)===e,y=f&&w.includes(f.itemId),E=s&&w.includes(s)&&me(s)==="field",[I,L]=_.useState(!1),D="var(--t-primary, hsl(var(--primary)))",z=C?D:I?"rgba(59,130,246,0.55)":"rgba(59,130,246,0.3)",M=C?`color-mix(in srgb, ${D} 15%, transparent)`:I?"rgba(59,130,246,0.12)":"rgba(59,130,246,0.07)",$=C?`color-mix(in srgb, ${D} 30%, transparent)`:I?"rgba(59,130,246,0.28)":"rgba(59,130,246,0.18)",A=C?`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:T,resizing:R,resizePreview:V,handleResizeStart:O}=_l({id:e,currentTamanho:j,inicioColuna:b.inicioColuna,onResize:X=>l(e,{tamanho:X})}),q=_.useMemo(()=>({kind:"custom",moveItemNoSnapshot:m,pushSnapshot:h,setReorderDrag:g,dataAttribute:"data-container-id"}),[m,h,g]),{handleGripMouseDown:se}=yh({id:e,elementRef:T,tamanho:j,inicioColuna:b.inicioColuna||1,onPositionApply:X=>l(e,{inicioColuna:X}),setPositionDrag:p,setSelected:a,reorderStrategy:q});return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:X=>{T.current=X},onClick:X=>{X.stopPropagation(),a(e)},onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),className:U("relative rounded-lg border overflow-hidden transition-all",R&&"ring-2 ring-blue-400/50",S&&"opacity-0 pointer-events-none",P&&"opacity-50"),"data-container-id":e,style:{gridColumn:b.inicioColuna?`${b.inicioColuna} / span ${j}`:`span ${j}`,minWidth:"80px",borderColor:z,boxShadow:A},children:[o.jsxs("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",style:{backgroundColor:M,borderColor:$},children:[o.jsx("div",{"data-grip":!0,onMouseDown:se,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-primary/20 transition-colors",children:o.jsx(k.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:X=>{X.stopPropagation(),d(e,"up")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(k.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})}),o.jsx("button",{onClick:X=>{X.stopPropagation(),d(e,"down")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(k.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})})]}),o.jsx(k.BoxSelect,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"}),o.jsx("span",{className:U("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(k.SquareStack,{className:"h-3 w-3 text-blue-400 shrink-0"}),b.showLabel===!1&&o.jsx(k.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:[V??j,"/12"]}),o.jsx("button",{onClick:X=>{X.stopPropagation(),c(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:I?1:0},children:o.jsx(k.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:r,className:U("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",n?"bg-primary/15 ring-2 ring-inset ring-primary/50":(y||E)&&"bg-muted/30"),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[o.jsx(un,{showGuides:!!y||!!E,positionDrag:y?f:null}),w.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(Fe.SortableContext,{items:N,strategy:Fe.rectSortingStrategy,children:w.filter(X=>me(X)==="field").map(X=>i(X).fieldType==="field_array"?o.jsx(bh,{id:X,container:e},X):o.jsx(Bt,{id:X,container:e},X))})]}),o.jsx("div",{onMouseDown:O,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(k.GripHorizontal,{className:"h-3 w-3 text-blue-500/40 rotate-90"})})]}),S&&f&&So.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(k.BoxSelect,{className:"h-2.5 w-2.5"}),"col ",f.ghostStart,"–",f.ghostStart+f.ghostSpan-1]}),document.body)," "]})},Dl=({id:e,container:t,index:r})=>{var z;const{attributes:n,listeners:s,setNodeRef:a,transform:i,transition:l,isDragging:c}=Fe.useSortable({id:e,data:{isCanvasItem:!0,type:"step",id:e}}),{setNodeRef:d,isOver:m}=jt.useDroppable({id:`zone-${e}`}),{selectedId:p,setSelected:f,getConfig:x,removeItem:g,containers:h,positionDrag:v}=ke(),b=x(e),w=((z=h[e])==null?void 0:z.children)??[],N=p===e,C=v&&w.includes(v.itemId),[j,S]=_.useState(!1),P="var(--t-primary, hsl(var(--primary)))",y=N?P:j?`color-mix(in srgb, ${P} 60%, transparent)`:`color-mix(in srgb, ${P} 25%, transparent)`,E=N?`color-mix(in srgb, ${P} 14%, transparent)`:j?`color-mix(in srgb, ${P} 10%, transparent)`:`color-mix(in srgb, ${P} 6%, transparent)`,I=N?`color-mix(in srgb, ${P} 28%, transparent)`:`color-mix(in srgb, ${P} 15%, transparent)`,L=N?`0 0 0 3px color-mix(in srgb, ${P} 20%, transparent)`:void 0,D={transform:Mt.CSS.Transform.toString(i),transition:l,opacity:c?0:1};return o.jsxs("div",{ref:a,style:{...D,borderWidth:"2px",borderStyle:"solid",borderColor:y,boxShadow:L},onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),onClick:M=>{M.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:E,borderColor:I},children:[o.jsx("div",{...s,...n,className:"cursor-grab shrink-0",onClick:M=>M.stopPropagation(),children:o.jsx(k.GripVertical,{className:"h-3.5 w-3.5 text-primary"})}),o.jsx(k.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:M=>{M.stopPropagation(),g(e)},className:"transition-opacity shrink-0 p-1 rounded hover:bg-destructive/10",style:{opacity:j?1:0},children:o.jsx(k.Trash2,{className:"h-3.5 w-3.5 text-destructive"})})]}),o.jsxs("div",{ref:d,className:U("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(un,{showGuides:!!C,positionDrag:C?v:null}),w.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"}),w.map(M=>me(M)==="container"?o.jsx(mn,{id:M,container:e},M):o.jsx(Bt,{id:M,container:e},M))]})]})},wh=()=>{var i;const{containers:e,setSelected:t}=ke(),r=((i=e.root)==null?void 0:i.children)??[],n=r.filter(l=>me(l)==="step"),{setNodeRef:s,isOver:a}=jt.useDroppable({id:"root"});return o.jsxs("div",{ref:s,onClick:()=>t(null),className:`min-h-[500px] rounded-xl border p-4 space-y-4 transition-all duration-150 ${a?"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:a?void 0:"hsl(var(--muted) / 0.3)"},children:[r.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(k.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(Fe.SortableContext,{items:n,strategy:Fe.verticalListSortingStrategy,children:r.map((l,c)=>{const d=me(l);return d==="step"?o.jsx(Dl,{id:l,container:"root",index:c},l):d==="container"?o.jsx(mn,{id:l,container:"root"},l):o.jsx(Bt,{id:l,container:"root"},l)})})]})},Nh={personal:"Pessoal",address:"Endereço",health:"Saúde",event:"Evento",payment:"Pagamento",emergency:"Emergência"},Ch={texto:"Texto",selecao:"Seleção",range:"Numérico / Visual",data:"Data e Hora",contato:"Contato / Endereço",outros:"Arquivo / Outros"},jh=()=>{const e=at.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"}),ss.map(t=>o.jsx(ns,{component:t.component,label:t.label,icon:t.icon,color:t.color},t.component))]}),Object.entries(e).map(([t,r])=>o.jsx(ro,{label:Ch[t]??t,children:r.map(n=>o.jsx(ns,{component:n.component,label:n.label,icon:n.icon,color:"border-border"},n.component))},t)),o.jsx(ro,{label:"Blocos pré-configurados",defaultOpen:!1,children:Ye.PRESET_BLOCKS.map(t=>o.jsx(Sh,{block:t},t.id))}),o.jsx(ro,{label:"Blocos de steps",defaultOpen:!1,children:Ye.PRESET_STEP_BLOCKS.map(t=>o.jsx(Ph,{block:t},t.id))})]})},ro=({label:e,children:t,defaultOpen:r=!0})=>{const[n,s]=_.useState(r);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("button",{type:"button",onClick:()=>s(a=>!a),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(k.ChevronDown,{className:`h-3.5 w-3.5 transition-transform ${n?"":"-rotate-90"}`})]}),n&&o.jsx("div",{className:"space-y-1.5",children:t})]})},ns=({component:e,label:t,icon:r,color:n})=>{const{attributes:s,listeners:a,setNodeRef:i,transform:l,isDragging:c}=jt.useDraggable({id:`palette-${e}`,data:{isPaletteItem:!0,componentType:e}});return o.jsxs("div",{ref:i,...a,...s,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:Mt.CSS.Translate.toString(l)},children:[o.jsx(k.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})]})},Sh=({block:e})=>{const{attributes:t,listeners:r,setNodeRef:n,transform:s,isDragging:a}=jt.useDraggable({id:`preset-${e.id}`,data:{isPalettePreset:!0,presetId:e.id}}),i=e.icon?Lt[e.icon]:void 0,l=Nh[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 ${a?"opacity-50":""}`,style:{transform:a?void 0:Mt.CSS.Translate.toString(s)},title:e.description,children:[o.jsx(k.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(Lt.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})]})]})},Ph=({block:e})=>{const{addPresetStepBlock:t}=ke(),r=e.icon?Lt[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(Lt.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"]})]})},oo=e=>({when:e.campoId,operator:e.operador,value:e.valor,source:e.source}),Ml=e=>{var r;const t={campoId:e.when,operador:e.operator,valor:e.value,source:e.source};if(e.logicOperator&&((r=e.extraConditions)!=null&&r.length)){const n=e.extraConditions.map(a=>({campoId:a.when,operador:a.operator,valor:a.value,source:a.source})),s=[t,...n];return e.logicOperator==="or"?{or:s}:{and:s}}return t},$l=e=>{if("campoId"in e)return oo(e);const t=("and"in e?e.and:e.or)??[];if(t.length===0)return;const r="and"in e?"and":"or",[n,...s]=t;if(!("campoId"in n))return;const a=oo(n);return s.length===0?a:{...a,logicOperator:r,extraConditions:s.filter(i=>"campoId"in i).map(oo)}},Rh=(e,t,r)=>{var i,l;const n=c=>t[c]||{label:c,name:c},a=(((l=(i=e==null?void 0:e.containers)==null?void 0:i.root)==null?void 0:l.children)||[]).filter(c=>me(c)==="step").map((c,d)=>{var x,g;const m=n(c),f=(((g=(x=e==null?void 0:e.containers)==null?void 0:x[c])==null?void 0:g.children)||[]).filter(h=>me(h)==="container").map((h,v)=>{var j,S;const b=n(h),N=(((S=(j=e==null?void 0:e.containers)==null?void 0:j[h])==null?void 0:S.children)||[]).filter(P=>me(P)==="field").map((P,y)=>{var L,D;const E=n(P),I=Co(E,P,y);if(I.tipo===de.FieldType.FIELD_ARRAY){const z=((D=(L=e==null?void 0:e.containers)==null?void 0:L[P])==null?void 0:D.children)??[];I.subFields=z.filter(M=>me(M)==="field").map((M,$)=>Co(n(M),M,$))}return I}),C={id:h,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:N};return b.condition&&(C.condicional=Ml(b.condition)),C});return{id:c,titulo:m.label||"Step",descricao:m.description,icone:m.icone,ordem:d,showLabel:m.showLabel,containers:f}});return{id:r.id||"",nome:r.nome,descricao:r.descricao,status:r.status,template:r.template??null,steps:a}},Co=(e,t,r)=>{var s,a,i,l;const n={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((s=e.validate)!=null&&s.length&&(n.validate=e.validate),(a=e.warn)!=null&&a.length&&(n.warn=e.warn),(i=e.options)!=null&&i.length&&(n.opcoes=e.options.map(c=>({valor:c.value,label:c.label,disabled:c.disabled}))),e.validation){const c=e.validation;n.validacao={},c.minLength!==void 0&&(n.validacao.minLength=c.minLength),c.maxLength!==void 0&&(n.validacao.maxLength=c.maxLength),c.min!==void 0&&(n.validacao.min=c.min),c.max!==void 0&&(n.validacao.max=c.max),c.regex&&(n.validacao.regex=c.regex),c.regexMessage&&(n.validacao.regexMessage=c.regexMessage),c.minDate&&(n.validacao.minDate=c.minDate),c.maxDate&&(n.validacao.maxDate=c.maxDate),c.minAge!==void 0&&(n.validacao.minAge=c.minAge),c.maxAge!==void 0&&(n.validacao.maxAge=c.maxAge),(l=c.fileTypes)!=null&&l.length&&(n.validacao.fileTypes=c.fileTypes),c.maxFileSize!==void 0&&(n.validacao.maxFileSize=c.maxFileSize)}if(n.tipo===de.FieldType.FIELD_ARRAY&&(e.itemLabel&&(n.itemLabel=e.itemLabel),e.minItems!==void 0&&(n.minItems=e.minItems),e.maxItems!==void 0&&(n.maxItems=e.maxItems),e.addLabel&&(n.addLabel=e.addLabel)),n.tipo===de.FieldType.TERMS&&(e.termoTexto&&(n.termoTexto=e.termoTexto),e.termoPdfUrl&&(n.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(n.termoPdfUploadId=e.termoPdfUploadId)),n.tipo===de.FieldType.SLIDER&&(e.step!==void 0&&(n.step=e.step),e.minValue!==void 0&&(n.minValue=e.minValue),e.maxValue!==void 0&&(n.maxValue=e.maxValue)),n.tipo===de.FieldType.RATING&&e.maxRating!==void 0&&(n.maxRating=e.maxRating),n.tipo===de.FieldType.DATE_RANGE&&(e.dateRangeStartLabel&&(n.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(n.dateRangeEndLabel=e.dateRangeEndLabel)),n.tipo===de.FieldType.SUB_FORM){const c=e.subSchemaFields??[];(c.length>0||e.subSchemaTitle)&&(n.subSchema={titulo:e.subSchemaTitle,fields:c.map((d,m)=>Co(d,d.name??`subfield-${m}`,m))})}return e.condition&&(n.condicional=Ml(e.condition)),n},Eh=e=>{const t={},r={root:{children:[]}},n=[...e.steps].sort((s,a)=>s.ordem-a.ordem);for(const s of n){const a=s.id||`step-${de.v4Fallback()}`;r.root.children.push(a),t[a]={label:s.titulo,name:a,fieldType:"step",description:s.descricao,icone:s.icone,showLabel:s.showLabel};const i=[],l=[...s.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l){const d=c.id||`container-${de.v4Fallback()}`;i.push(d);const m=c.condicional?$l(c.condicional):void 0;t[d]={label:c.titulo,name:d,fieldType:"container",description:c.descricao,icone:c.icone,columns:c.colunas,tamanho:c.tamanho||12,inicioColuna:c.inicioColuna,showLabel:c.showLabel,showAsCard:c.showAsCard,...m?{condition:m}:{}};const p=[],f=[...c.campos].sort((x,g)=>x.ordem-g.ordem);for(const x of f){const g=x.id||`${x.tipo}-${de.v4Fallback()}`;if(p.push(g),t[g]=jo(x),x.tipo===de.FieldType.FIELD_ARRAY){const h=[];for(const v of x.subFields??[]){const b=v.id||`${v.tipo}-${de.v4Fallback()}`;h.push(b),t[b]=jo(v)}r[g]={children:h}}}r[d]={children:p}}r[a]={children:i}}return{dndState:{containers:r},configs:t,templateId:e.template??null}},jo=(e,t)=>{var n,s,a,i;const r={label:e.label,name:e.nome,fieldType:e.tipo,required:e.obrigatorio,tamanho:e.tamanho,inicioColuna:e.inicioColuna,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!=null?String(e.clearedValue):void 0,initialValue:e.initialValue!==void 0?String(e.initialValue):void 0,resolvePropsKey:e.resolvePropsKey||void 0,validate:(n=e.validate)!=null&&n.length?e.validate:void 0,warn:(s=e.warn)!=null&&s.length?e.warn:void 0};if((a=e.opcoes)!=null&&a.length&&(r.options=e.opcoes.map(l=>({value:l.valor,label:l.label,disabled:l.disabled}))),e.validacao){const l=e.validacao;r.validation={},l.minLength!==void 0&&(r.validation.minLength=l.minLength),l.maxLength!==void 0&&(r.validation.maxLength=l.maxLength),l.min!==void 0&&(r.validation.min=l.min),l.max!==void 0&&(r.validation.max=l.max),l.regex&&(r.validation.regex=l.regex),l.regexMessage&&(r.validation.regexMessage=l.regexMessage),l.minDate&&(r.validation.minDate=l.minDate),l.maxDate&&(r.validation.maxDate=l.maxDate),l.minAge!==void 0&&(r.validation.minAge=l.minAge),l.maxAge!==void 0&&(r.validation.maxAge=l.maxAge),(i=l.fileTypes)!=null&&i.length&&(r.validation.fileTypes=l.fileTypes),l.maxFileSize!==void 0&&(r.validation.maxFileSize=l.maxFileSize)}if(e.tipo===de.FieldType.FIELD_ARRAY&&(e.itemLabel&&(r.itemLabel=e.itemLabel),e.minItems!==void 0&&(r.minItems=e.minItems),e.maxItems!==void 0&&(r.maxItems=e.maxItems),e.addLabel&&(r.addLabel=e.addLabel)),e.tipo===de.FieldType.TERMS&&(e.termoTexto&&(r.termoTexto=e.termoTexto),e.termoPdfUrl&&(r.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(r.termoPdfUploadId=e.termoPdfUploadId)),e.tipo===de.FieldType.SLIDER&&(e.step!==void 0&&(r.step=e.step),e.minValue!==void 0&&(r.minValue=e.minValue),e.maxValue!==void 0&&(r.maxValue=e.maxValue)),e.tipo===de.FieldType.RATING&&e.maxRating!==void 0&&(r.maxRating=e.maxRating),e.tipo===de.FieldType.DATE_RANGE&&(e.dateRangeStartLabel&&(r.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(r.dateRangeEndLabel=e.dateRangeEndLabel)),e.tipo===de.FieldType.SUB_FORM&&e.subSchema&&(r.subSchemaTitle=e.subSchema.titulo,r.subSchemaFields=e.subSchema.fields.map(l=>jo(l,l.id))),e.condicional){const l=$l(e.condicional);l&&(r.condition=l)}return r},Ah=(e,t)=>{var l,c,d,m,p,f,x;const r=[],n=[],s=g=>t[g]||{label:g,name:g},a=((c=(l=e==null?void 0:e.containers)==null?void 0:l.root)==null?void 0:c.children)||[],i=new Set;for(const g of a){if(me(g)!=="step")continue;const h=s(g).label||g,v=((m=(d=e==null?void 0:e.containers)==null?void 0:d[g])==null?void 0:m.children)||[];if(v.length===0){n.push(`Step "${h}" está vazio (sem containers).`);continue}for(const b of v){if(me(b)!=="container")continue;const w=s(b).label||b,N=((f=(p=e==null?void 0:e.containers)==null?void 0:p[b])==null?void 0:f.children)||[],C=new Map;for(const j of N){if(me(j)!=="field")continue;i.add(j);const S=s(j).name||j;C.has(S)||C.set(S,[]),C.get(S).push(j)}for(const[j,S]of C.entries())S.length>1&&r.push(`Nome duplicado "${j}" no container "${w}" (IDs: ${S.join(", ")}).`)}}for(const[g,h]of Object.entries(t)){if(!((x=h.condition)!=null&&x.when))continue;const v=h.condition.when;if(!i.has(v)){const b=h.label||g;n.push(`Campo "${b}" referencia campo inexistente na condição (when: "${v}").`)}}return{errors:r,warnings:n}};exports.BuilderProvider=Bl;exports.Canvas=wh;exports.ConfigPanel=th;exports.DroppedContainer=mn;exports.DroppedField=Bt;exports.DroppedStep=Dl;exports.EVENT_VARIABLES=Ro;exports.FIELD_TYPES=at;exports.GridOverlay=un;exports.LivePreview=gh;exports.Palette=jh;exports.STRUCTURE_TYPES=ss;exports.builderToFormSchema=Rh;exports.findParentContainer=cs;exports.formSchemaToBuilder=Eh;exports.getFieldMeta=zl;exports.getFieldMetaById=as;exports.getItemType=me;exports.useBuilder=ke;exports.validateBuilderIntegrity=Ah;
|
|
50
|
+
Defaulting to \`null\`.`}var wl=gl,jf=bl;const Nl=u.forwardRef(({className:e,value:t,...r},n)=>o.jsx(wl,{ref:n,className:U("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...r,children:o.jsx(jf,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Nl.displayName=wl.displayName;var[$r]=Be("Tooltip",[Rt]),Fr=Rt(),Sf="TooltipProvider",bo="tooltip.open",[Th,cn]=$r(Sf),Dt="Tooltip",[Pf,zr]=$r(Dt),Cl=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:s,onOpenChange:a,disableHoverableContent:i,delayDuration:l}=e,c=cn(Dt,e.__scopeTooltip),d=Fr(t),[m,p]=u.useState(null),f=Ke(),x=u.useRef(0),g=i??c.disableHoverableContent,h=l??c.delayDuration,v=u.useRef(!1),[b,w]=it({prop:n,defaultProp:s??!1,onChange:P=>{P?(c.onOpen(),document.dispatchEvent(new CustomEvent(bo))):c.onClose(),a==null||a(P)},caller:Dt}),C=u.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),N=u.useCallback(()=>{window.clearTimeout(x.current),x.current=0,v.current=!1,w(!0)},[w]),j=u.useCallback(()=>{window.clearTimeout(x.current),x.current=0,w(!1)},[w]),S=u.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{v.current=!0,w(!0),x.current=0},h)},[h,w]);return u.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),o.jsx(en,{...d,children:o.jsx(Pf,{scope:t,contentId:f,open:b,stateAttribute:C,trigger:m,onTriggerChange:p,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?S():N()},[c.isOpenDelayedRef,S,N]),onTriggerLeave:u.useCallback(()=>{g?j():(window.clearTimeout(x.current),x.current=0)},[j,g]),onOpen:N,onClose:j,disableHoverableContent:g,children:r})})};Cl.displayName=Dt;var yo="TooltipTrigger",jl=u.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=zr(yo,r),a=cn(yo,r),i=Fr(r),l=u.useRef(null),c=re(t,l,s.onTriggerChange),d=u.useRef(!1),m=u.useRef(!1),p=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),o.jsx(Ar,{asChild:!0,...i,children:o.jsx(Q.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:Z(e.onPointerMove,f=>{f.pointerType!=="touch"&&!m.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:Z(e.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:Z(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Z(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:Z(e.onBlur,s.onClose),onClick:Z(e.onClick,s.onClose)})})});jl.displayName=yo;var Rf="TooltipPortal",[Ih,Ef]=$r(Rf,{forceMount:void 0}),Ct="TooltipContent",Sl=u.forwardRef((e,t)=>{const r=Ef(Ct,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...a}=e,i=zr(Ct,e.__scopeTooltip);return o.jsx(Se,{present:n||i.open,children:i.disableHoverableContent?o.jsx(Pl,{side:s,...a,ref:t}):o.jsx(Af,{side:s,...a,ref:t})})}),Af=u.forwardRef((e,t)=>{const r=zr(Ct,e.__scopeTooltip),n=cn(Ct,e.__scopeTooltip),s=u.useRef(null),a=re(t,s),[i,l]=u.useState(null),{trigger:c,onClose:d}=r,m=s.current,{onPointerInTransitChange:p}=n,f=u.useCallback(()=>{l(null),p(!1)},[p]),x=u.useCallback((g,h)=>{const v=g.currentTarget,b={x:g.clientX,y:g.clientY},w=Of(b,v.getBoundingClientRect()),C=_f(b,w),N=Df(h.getBoundingClientRect()),j=$f([...C,...N]);l(j),p(!0)},[p]);return u.useEffect(()=>()=>f(),[f]),u.useEffect(()=>{if(c&&m){const g=v=>x(v,m),h=v=>x(v,c);return c.addEventListener("pointerleave",g),m.addEventListener("pointerleave",h),()=>{c.removeEventListener("pointerleave",g),m.removeEventListener("pointerleave",h)}}},[c,m,x,f]),u.useEffect(()=>{if(i){const g=h=>{const v=h.target,b={x:h.clientX,y:h.clientY},w=(c==null?void 0:c.contains(v))||(m==null?void 0:m.contains(v)),C=!Mf(b,i);w?f():C&&(f(),d())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,m,i,d,f]),o.jsx(Pl,{...e,ref:a})}),[kf,Tf]=$r(Dt,{isInside:!1}),If=td("TooltipContent"),Pl=u.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:a,onPointerDownOutside:i,...l}=e,c=zr(Ct,r),d=Fr(r),{onClose:m}=c;return u.useEffect(()=>(document.addEventListener(bo,m),()=>document.removeEventListener(bo,m)),[m]),u.useEffect(()=>{if(c.trigger){const p=f=>{const x=f.target;x!=null&&x.contains(c.trigger)&&m()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,m]),o.jsx($t,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:o.jsxs(tn,{"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(If,{children:n}),o.jsx(kf,{scope:r,isInside:!0,children:o.jsx(vp,{id:c.contentId,role:"tooltip",children:s||n})})]})})});Sl.displayName=Ct;var Rl="TooltipArrow",Lf=u.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Fr(r);return Tf(Rl,r).isInside?null:o.jsx(rn,{...s,...n,ref:t})});Lf.displayName=Rl;function Of(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(r,n,s,a)){case a:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function _f(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 Df(e){const{top:t,right:r,bottom:n,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:n},{x:s,y:n}]}function Mf(e,t){const{x:r,y:n}=e;let s=!1;for(let a=0,i=t.length-1;a<t.length;i=a++){const l=t[a],c=t[i],d=l.x,m=l.y,p=c.x,f=c.y;m>n!=f>n&&r<(p-d)*(n-m)/(f-m)+d&&(s=!s)}return s}function $f(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),Ff(t)}function Ff(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const s=e[n];for(;t.length>=2;){const a=t[t.length-1],i=t[t.length-2];if((a.x-i.x)*(s.y-i.y)>=(a.y-i.y)*(s.x-i.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const s=e[n];for(;r.length>=2;){const a=r[r.length-1],i=r[r.length-2];if((a.x-i.x)*(s.y-i.y)>=(a.y-i.y)*(s.x-i.x))r.pop();else break}r.push(s)}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 zf=Cl,Vf=jl,El=Sl;const Al=zf,kl=Vf,dn=u.forwardRef(({className:e,sideOffset:t=4,...r},n)=>o.jsx(El,{ref:n,sideOffset:t,className:U("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}));dn.displayName=El.displayName;const Bf=To("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 Vr({className:e,variant:t,...r}){return o.jsx("div",{className:U(Bf({variant:t}),e),...r})}const wo=[{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."}]}],Wf=wo.flatMap(e=>e.presets),Hf=({value:e,message:t,onChange:r})=>{const[n,s]=_.useState(!1),[a,i]=_.useState(""),l=_.useMemo(()=>{if(!a.trim())return wo;const p=a.toLowerCase();return wo.map(f=>({...f,presets:f.presets.filter(x=>x.label.toLowerCase().includes(p)||x.description.toLowerCase().includes(p)||x.pattern.toLowerCase().includes(p))})).filter(f=>f.presets.length>0)},[a]),c=_.useMemo(()=>e?Wf.find(p=>p.pattern===e):void 0,[e]),d=p=>{r(p.pattern,`${p.label}: formato inválido`),s(!1),i("")},m=()=>{r(void 0,void 0)};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(B,{className:"text-[10px]",children:"Regex"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Y,{value:e??"",onChange:p=>r(p.target.value||void 0,t),className:"h-7 text-xs font-mono flex-1",placeholder:"Clique no botão ou digite..."}),e&&o.jsx(le,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:m,children:o.jsx(k.X,{className:"h-3 w-3"})}),o.jsxs(Tr,{open:n,onOpenChange:s,children:[o.jsx(Ir,{asChild:!0,children:o.jsx(le,{variant:"outline",size:"icon",className:"h-7 w-7 shrink-0",children:o.jsx(k.Regex,{className:"h-3.5 w-3.5"})})}),o.jsxs(Vt,{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(k.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(Y,{value:a,onChange:p=>i(p.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar regex (ex: CPF, e-mail, senha)...",autoFocus:!0})]})}),o.jsx(br,{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(p=>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:p.category}),p.presets.map(f=>o.jsxs(Al,{children:[o.jsx(kl,{asChild:!0,children:o.jsxs("button",{onClick:()=>d(f),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(k.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:f.label}),o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono block truncate",children:f.pattern})]})]})}),o.jsxs(dn,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:f.label}),o.jsx("p",{children:f.description})]})]},f.pattern+f.label))]},p.category))]})})]})]})]}),c&&o.jsxs(Vr,{variant:"secondary",className:"text-[10px] font-normal gap-1",children:[o.jsx(k.Regex,{className:"h-2.5 w-2.5"}),c.label]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Mensagem do regex"}),o.jsx(Y,{value:t??"",onChange:p=>r(e,p.target.value||void 0),className:"h-7 text-xs",placeholder:"Formato inválido"})]})]})},No=[{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"]}]}],Uf=No.flatMap(e=>e.presets),Gf=({value:e,onChange:t})=>{const[r,n]=_.useState(!1),[s,a]=_.useState(""),[i,l]=_.useState(""),c=_.useMemo(()=>new Set(e??[]),[e]),d=_.useMemo(()=>{if(!s.trim())return No;const g=s.toLowerCase();return No.map(h=>({...h,presets:h.presets.filter(v=>v.label.toLowerCase().includes(g)||v.description.toLowerCase().includes(g)||v.value.toLowerCase().includes(g))})).filter(h=>h.presets.length>0)},[s]),m=g=>{const h=new Set(e??[]);g.group?g.group.every(b=>h.has(b))?g.group.forEach(b=>h.delete(b)):g.group.forEach(b=>h.add(b)):h.has(g.value)?h.delete(g.value):h.add(g.value),t(h.size>0?Array.from(h):void 0)},p=()=>{const g=i.trim();if(!g)return;const h=new Set(e??[]);h.add(g),t(Array.from(h)),l("")},f=g=>{const h=new Set(e??[]);h.delete(g),t(h.size>0?Array.from(h):void 0)},x=g=>{const h=Uf.find(v=>v.value===g);return(h==null?void 0:h.label)??g};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(B,{className:"text-[10px]",children:"Tipos de arquivo aceitos"}),((e==null?void 0:e.length)??0)>0&&o.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(g=>o.jsxs(Vr,{variant:"secondary",className:"text-[10px] gap-1 pr-1",children:[x(g),o.jsx("button",{onClick:()=>f(g),className:"hover:text-destructive",children:o.jsx(k.X,{className:"h-2.5 w-2.5"})})]},g))}),o.jsxs(Tr,{open:r,onOpenChange:n,children:[o.jsx(Ir,{asChild:!0,children:o.jsxs(le,{variant:"outline",className:"w-full h-8 text-xs justify-start gap-2",children:[o.jsx(k.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(Vt,{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(k.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(Y,{value:s,onChange:g=>a(g.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar tipos (ex: PDF, imagem, vídeo)...",autoFocus:!0})]})}),o.jsxs("div",{className:"px-2 py-1.5 border-b flex gap-1",children:[o.jsx(Y,{value:i,onChange:g=>l(g.target.value),className:"h-7 text-xs font-mono flex-1",placeholder:"Tipo customizado (ex: .dwg)",onKeyDown:g=>g.key==="Enter"&&p()}),o.jsx(le,{variant:"secondary",size:"sm",className:"h-7 text-xs shrink-0",onClick:p,disabled:!i.trim(),children:"Adicionar"})]}),o.jsx(br,{className:"h-[320px]",children:o.jsxs("div",{className:"p-1",children:[d.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum tipo encontrado"}),d.map(g=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:g.category}),g.presets.map(h=>{const v=h.group?h.group.every(w=>c.has(w)):c.has(h.value),b=h.group?h.group.some(w=>c.has(w))&&!v:!1;return o.jsxs(Al,{children:[o.jsx(kl,{asChild:!0,children:o.jsxs("button",{onClick:()=>m(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(xe,{checked:b?"indeterminate":v,className:"h-3.5 w-3.5",tabIndex:-1}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium",children: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(k.Info,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"})]})}),o.jsxs(dn,{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(w=>o.jsx("li",{className:"font-mono text-[10px] opacity-80",children:w},w))})]})]},h.value)})]},g.category))]})})]})]})]})},Tl=1048576,mr=1073741824;function Zn(e){return e>=mr&&e%mr===0?"GB":"MB"}function Kn(e,t){return t==="GB"?e/mr:e/Tl}function Jn(e,t){return Math.round(e*(t==="GB"?mr:Tl))}const qf=({value:e,onChange:t})=>{const r=_.useMemo(()=>e?Zn(e):"MB",[]),[n,s]=_.useState(r),[a,i]=_.useState(e?String(Kn(e,r)):"");_.useEffect(()=>{if(e===void 0){i("");return}const d=Zn(e);s(d),i(String(Kn(e,d)))},[e]);const l=d=>{i(d);const m=parseFloat(d);d.trim()===""||isNaN(m)||m<=0?t(void 0):t(Jn(m,n))},c=d=>{s(d);const m=parseFloat(a);!isNaN(m)&&m>0&&t(Jn(m,d))};return o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(B,{className:"text-[10px]",children:"Tamanho máximo do arquivo"}),o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx(Y,{type:"number",min:0,step:"any",value:a,onChange:d=>l(d.target.value),placeholder:"Ex: 10",className:"h-8 text-xs flex-1"}),o.jsxs(Ce,{value:n,onValueChange:d=>c(d),children:[o.jsx(ye,{className:"w-[72px] h-8 text-xs",children:o.jsx(je,{})}),o.jsxs(we,{children:[o.jsx(pe,{value:"MB",children:"MB"}),o.jsx(pe,{value:"GB",children:"GB"})]})]})]}),e!==void 0&&o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["= ",e.toLocaleString("pt-BR")," bytes"]})]})},Xf=new Set(["texto","textarea","email","password","url","phone","tel","cpf","cnpj","cep","rg"]),Yf=({fieldType:e,validation:t,onChange:r})=>{const n=(i,l)=>{const m=["minLength","maxLength","min","max","maxFileSize","minAge","maxAge"].includes(i)?l?Number(l):void 0:l||void 0;r({...t,[i]:m})},s=e==="file",a=Xf.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"}),a&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Min caracteres"}),o.jsx(Y,{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(B,{className:"text-[10px]",children:"Max caracteres"}),o.jsx(Y,{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(B,{className:"text-[10px]",children:"Valor mínimo"}),o.jsx(Y,{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(B,{className:"text-[10px]",children:"Valor máximo"}),o.jsx(Y,{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(B,{className:"text-[10px]",children:"Data mínima"}),o.jsx(Y,{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(B,{className:"text-[10px]",children:"Data máxima"}),o.jsx(Y,{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(B,{className:"text-[10px]",children:"Idade mínima (anos)"}),o.jsx(Y,{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(B,{className:"text-[10px]",children:"Idade máxima (anos)"}),o.jsx(Y,{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"})]})]})]}),s&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(Gf,{value:t==null?void 0:t.fileTypes,onChange:i=>r({...t,fileTypes:i})}),o.jsx(qf,{value:t==null?void 0:t.maxFileSize,onChange:i=>r({...t,maxFileSize:i})})]}),!s&&o.jsx(Hf,{value:(t==null?void 0:t.regex)??"",message:(t==null?void 0:t.regexMessage)??"",onChange:(i,l)=>r({...t,regex:i,regexMessage:l})})]})},Il=({options:e,onChange:t})=>{const r=_.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=_.useCallback((i,l,c)=>{const d=[...e];d[i]={...d[i],[l]:c},t(d)},[e,t]),s=_.useCallback(i=>{r.current.splice(i,1),t(e.filter((l,c)=>c!==i))},[e,t]),a=_.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(k.GripVertical,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}),o.jsx(Y,{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(Y,{value:i.label,onChange:c=>n(l,"label",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Label"}),o.jsx($e,{})]}),o.jsx(le,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>s(l),children:o.jsx(k.Trash2,{className:"h-3 w-3"})})]},r.current[l])),o.jsxs(le,{variant:"outline",size:"sm",className:"w-full h-7 text-xs",onClick:a,children:[o.jsx(k.Plus,{className:"h-3 w-3 mr-1"})," Adicionar opção"]})]})},Zf=[{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"}],Kf=["vazio","naoVazio"],Qn=({cond:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:s})=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Fonte"}),o.jsxs(Ce,{value:e.source||"campo",onValueChange:a=>s({source:a,when:""}),children:[o.jsx(ye,{className:"h-7 text-xs",children:o.jsx(je,{})}),o.jsxs(we,{children:[o.jsx(pe,{value:"campo",children:"Campo do formulário"}),o.jsx(pe,{value:"evento",children:"Variável do evento"})]})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:e.source==="evento"?"Variável do evento":"Quando o campo"}),o.jsxs(Ce,{value:e.when||"",onValueChange:a=>s({when:a}),children:[o.jsx(ye,{className:"h-7 text-xs",children:o.jsx(je,{placeholder:e.source==="evento"?"Selecione uma variável...":"Selecione um campo..."})}),o.jsx(we,{children:e.source==="evento"?Ro.map(a=>o.jsx(pe,{value:a.key,children:a.label},a.key)):r.filter(a=>a!==t).map(a=>o.jsxs(pe,{value:a,children:[n(a),o.jsxs("span",{className:"text-muted-foreground/50 ml-1 text-[9px] font-mono",children:["(",a,")"]})]},a))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Operador"}),o.jsxs(Ce,{value:e.operator,onValueChange:a=>s({operator:a}),children:[o.jsx(ye,{className:"h-7 text-xs",children:o.jsx(je,{})}),o.jsx(we,{children:Zf.map(a=>o.jsx(pe,{value:a.value,children:a.label},a.value))})]})]}),!Kf.includes(e.operator)&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Valor"}),o.jsx(Y,{value:e.value||"",onChange:a=>s({value:a.target.value}),className:"h-7 text-xs",placeholder:"Valor esperado"})]})]}),Jf=({condition:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onChange:s})=>{var m;const a=p=>{e&&s({...e,...p})},i=()=>{if(!e)return;const p=e.extraConditions??[];s({...e,logicOperator:e.logicOperator??"and",extraConditions:[...p,{when:"",operator:"igual",value:"",source:"campo"}]})},l=p=>{if(!e)return;const f=(e.extraConditions??[]).filter((x,g)=>g!==p);s({...e,extraConditions:f,logicOperator:f.length?e.logicOperator:void 0})},c=(p,f)=>{if(!e)return;const x=(e.extraConditions??[]).map((g,h)=>h===p?{...g,...f}:g);s({...e,extraConditions:x})},d=(((m=e==null?void 0:e.extraConditions)==null?void 0:m.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(xe,{id:"has-condition",checked:!!e,onCheckedChange:p=>{s(p?{when:"",operator:"igual",value:"",source:"campo"}:void 0)}}),o.jsx(B,{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(Qn,{cond:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:a}),d&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Lógica"}),o.jsxs(Ce,{value:e.logicOperator??"and",onValueChange:p=>a({logicOperator:p}),children:[o.jsx(ye,{className:"h-7 text-xs",children:o.jsx(je,{})}),o.jsxs(we,{children:[o.jsx(pe,{value:"and",children:"E (AND) — todas devem ser verdadeiras"}),o.jsx(pe,{value:"or",children:"OU (OR) — pelo menos uma deve ser verdadeira"})]})]})]}),(e.extraConditions??[]).map((p,f)=>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"," ",f+2]}),o.jsx(le,{variant:"ghost",size:"sm",className:"h-5 px-1 text-[10px] text-destructive hover:text-destructive",onClick:()=>l(f),children:"Remover"})]}),o.jsx(Qn,{cond:p,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:x=>c(f,x)})]},f)),o.jsx(le,{variant:"outline",size:"sm",className:"h-6 text-[10px] w-full mt-1",onClick:i,children:"+ Adicionar condição"})]})]})},es=[{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"}],Qf=({subFields:e,onChange:t})=>{const[r,n]=_.useState(null),s=(l,c)=>{const d=e.map((m,p)=>p===l?{...m,...c}:m);t(d)},a=l=>{t(e.filter((c,d)=>d!==l)),n(null)},i=()=>{const l={label:"Novo campo",name:`campo_${e.length+1}`,fieldType:"texto",required:!1};t([...e,l]),n(e.length)};return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(B,{className:"text-xs font-semibold",children:"Sub-campos"}),o.jsxs(le,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs gap-1",onClick:i,children:[o.jsx(k.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((l,c)=>{var d;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===c?null:c),children:[o.jsx(Vr,{variant:"secondary",className:"h-4 text-[9px] px-1 shrink-0",children:c+1}),o.jsx("span",{className:"flex-1 truncate font-medium",children:l.label||l.name||"Campo sem nome"}),o.jsx("span",{className:"text-muted-foreground text-[10px] shrink-0",children:((d=es.find(m=>m.value===l.fieldType))==null?void 0:d.label)??l.fieldType}),o.jsx(le,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 text-destructive hover:text-destructive shrink-0",onClick:m=>{m.stopPropagation(),a(c)},children:o.jsx(k.Trash2,{className:"w-3 h-3"})}),r===c?o.jsx(k.ChevronUp,{className:"w-3 h-3 text-muted-foreground shrink-0"}):o.jsx(k.ChevronDown,{className:"w-3 h-3 text-muted-foreground shrink-0"})]}),r===c&&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(B,{className:"text-[10px]",children:"Label"}),o.jsx(Y,{value:l.label,onChange:m=>s(c,{label:m.target.value}),className:"h-7 text-xs",placeholder:"Ex: Nome"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Nome (campo)"}),o.jsx(Y,{value:l.name||"",onChange:m=>s(c,{name:m.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(B,{className:"text-[10px]",children:"Tipo de campo"}),o.jsxs(Ce,{value:l.fieldType,onValueChange:m=>s(c,{fieldType:m}),children:[o.jsx(ye,{className:"h-7 text-xs",children:o.jsx(je,{})}),o.jsx(we,{children:es.map(m=>o.jsx(pe,{value:m.value,className:"text-xs",children:m.label},m.value))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Colunas (1-12)"}),o.jsx(Y,{type:"number",min:1,max:12,value:l.tamanho??"",onChange:m=>s(c,{tamanho:m.target.value?Number(m.target.value):void 0}),className:"h-7 text-xs",placeholder:"12"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-[10px]",children:"Placeholder"}),o.jsx(Y,{value:l.placeholder||"",onChange:m=>s(c,{placeholder:m.target.value}),className:"h-7 text-xs",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{id:`sf-req-${c}`,checked:l.required||!1,onCheckedChange:m=>s(c,{required:m===!0})}),o.jsx(B,{htmlFor:`sf-req-${c}`,className:"text-[10px] cursor-pointer",children:"Obrigatório"})]}),["select","radio","checkbox_group"].includes(l.fieldType)&&o.jsx("div",{className:"pt-1",children:o.jsx(Il,{options:l.options||[],onChange:m=>s(c,{options:m})})})]})]},c)}),e.length>0&&o.jsx(Ne,{className:"mt-1"})]})},eh=({config:e,selectedId:t,allFieldIds:r,getFieldLabel:n,onUpdate:s})=>{const a=e.fieldType||"texto",i=["select","radio","checkbox_group","autocomplete"].includes(a),l=a==="field_array",c=e.locked===!0,d=a==="participation_type",m=a==="payment_method",p=a==="terms",f=a==="slider",x=a==="rating",g=a==="date_range",h=a==="sub_form",{schemaId:v,uploadTermsPdf:b}=ke(),[w,C]=_.useState(e.termoPdfUploadId?"upload":"link"),[N,j]=_.useState({status:"idle"}),S=_.useRef(null),P=_.useCallback(async y=>{if(!v){j({status:"error",message:"Salve o schema primeiro para habilitar o upload de PDF."});return}if(!b){j({status:"error",message:"Upload de PDF não configurado. Forneça a prop uploadTermsPdf ao BuilderProvider."});return}j({status:"uploading",fileName:y.name,progress:0});try{const A=await b(y,v);s({termoPdfUploadId:A,termoPdfUrl:void 0}),j({status:"idle"})}catch(A){j({status:"error",message:A instanceof Error?A.message:"Falha no upload do PDF."})}},[v,b,s]);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(k.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(k.Lock,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Tipo de Participação"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Datas, preços e vagas são carregados automaticamente do evento"})]})]}),p&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(k.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(B,{className:"text-xs",children:"Label"}),o.jsx($e,{})]}),o.jsx(Y,{value:e.label,onChange:y=>s({label:y.target.value}),className:"h-8 text-sm"})]}),d||m?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Dica (hint)"}),o.jsx(Y,{value:e.hint||"",onChange:y=>s({hint:y.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(xe,{id:"req",checked:e.required||!1,onCheckedChange:y=>s({required:y===!0})}),o.jsx(B,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]})]}):p?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Dica (hint)"}),o.jsx(Y,{value:e.hint||"",onChange:y=>s({hint:y.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(xe,{id:"req",checked:e.required||!1,onCheckedChange:y=>s({required:y===!0})}),o.jsx(B,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),o.jsx(Ne,{}),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(B,{className:"text-xs",children:"Texto dos termos"}),o.jsx(Mr,{value:e.termoTexto||"",onChange:y=>s({termoTexto:y.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(B,{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:()=>C("link"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${w==="link"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Link externo"}),o.jsx("button",{type:"button",onClick:()=>C("upload"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${w==="upload"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Upload de PDF"})]}),w==="link"?o.jsxs("div",{className:"space-y-1",children:[o.jsx(Y,{value:e.termoPdfUrl||"",onChange:y=>s({termoPdfUrl:y.target.value||void 0}),className:"h-8 text-sm",placeholder:"https://exemplo.com/termos.pdf"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"URL pública de um PDF. Tem prioridade sobre o texto acima."})]}):o.jsxs("div",{className:"space-y-2",children:[e.termoPdfUploadId&&N.status==="idle"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-green-500/40 bg-green-500/10 px-2 py-1.5",children:[o.jsx(k.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(le,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>{s({termoPdfUploadId:void 0})},children:o.jsx(k.X,{className:"h-3 w-3"})})]}):null,N.status==="uploading"?o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[o.jsx(k.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),o.jsx("span",{className:"truncate",children:N.fileName}),o.jsxs("span",{className:"ml-auto",children:[N.progress,"%"]})]}),o.jsx(Nl,{value:N.progress,className:"h-1"})]}):null,N.status==="error"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-destructive/40 bg-destructive/10 px-2 py-1.5",children:[o.jsx(k.AlertCircle,{className:"h-3.5 w-3.5 text-destructive shrink-0"}),o.jsx("span",{className:"text-[11px] text-destructive",children:N.message}),o.jsx(le,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 ml-auto",onClick:()=>j({status:"idle"}),children:o.jsx(k.X,{className:"h-3 w-3"})})]}):null,N.status!=="uploading"?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:S,type:"file",accept:"application/pdf",className:"hidden",onChange:y=>{var I;const A=(I=y.target.files)==null?void 0:I[0];A&&P(A),y.target.value=""}}),o.jsxs(le,{type:"button",variant:"outline",size:"sm",className:"w-full h-8 text-xs gap-1.5",disabled:!v,onClick:()=>{var y;return(y=S.current)==null?void 0:y.click()},children:[o.jsx(k.Upload,{className:"h-3.5 w-3.5"}),e.termoPdfUploadId?"Substituir PDF":"Selecionar PDF"]}),!v&&o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Salve o schema uma vez para habilitar o upload."})]}):null]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Nome (chave)"}),o.jsx(Y,{value:e.name||t.replace(/^field_/,""),onChange:y=>!c&&s({name:y.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(B,{className:"text-xs",children:"Tipo do campo"}),o.jsxs(Ce,{value:a,onValueChange:y=>!c&&s({fieldType:y}),disabled:c,children:[o.jsx(ye,{className:"h-8 text-sm",children:o.jsx(je,{})}),o.jsx(we,{children:at.map(y=>o.jsx(pe,{value:y.component,children:y.label},y.component))})]})]}),o.jsx(xl,{tamanho:e.tamanho||6,inicioColuna:e.inicioColuna||1,defaultTamanho:6,onTamanhoChange:y=>s({tamanho:y}),onPositionChange:y=>s({inicioColuna:y})}),a!=="file"&&!l&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(B,{className:"text-xs",children:"Placeholder"}),o.jsx($e,{})]}),o.jsx(Y,{value:e.placeholder||"",onChange:y=>s({placeholder:y.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(B,{className:"text-xs",children:"Dica (hint)"}),o.jsx($e,{})]}),o.jsx(Y,{value:e.hint||"",onChange:y=>s({hint:y.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),a!=="file"&&!l&&!h&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Valor padrão"}),o.jsx(Y,{value:e.defaultValue||"",onChange:y=>s({defaultValue:y.target.value}),className:"h-8 text-sm",placeholder:"Valor inicial do campo"})]}),a!=="file"&&!l&&!h&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(B,{className:"text-xs",children:"Valor inicial (runtime)"}),o.jsx($e,{})]}),o.jsx(Y,{value:e.initialValue||"",onChange:y=>s({initialValue:y.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&&!h&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{id:"req",checked:e.required||!1,onCheckedChange:y=>s({required:y===!0})}),o.jsx(B,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),!l&&!h&&!c&&o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{id:"readonly",checked:e.isReadOnly||!1,onCheckedChange:y=>s({isReadOnly:y===!0||void 0})}),o.jsx(B,{htmlFor:"readonly",className:"text-xs cursor-pointer",children:"Somente leitura"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{id:"disabled",checked:e.isDisabled||!1,onCheckedChange:y=>s({isDisabled:y===!0||void 0})}),o.jsx(B,{htmlFor:"disabled",className:"text-xs cursor-pointer",children:"Desabilitado"})]})]}),f&&o.jsxs(o.Fragment,{children:[o.jsx(Ne,{}),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(B,{className:"text-xs",children:"Mínimo"}),o.jsx(Y,{type:"number",value:e.minValue??0,onChange:y=>s({minValue:Number(y.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Máximo"}),o.jsx(Y,{type:"number",value:e.maxValue??100,onChange:y=>s({maxValue:Number(y.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Passo"}),o.jsx(Y,{type:"number",min:1,value:e.step??1,onChange:y=>s({step:Number(y.target.value)}),className:"h-8 text-sm"})]})]})]})]}),x&&o.jsxs(o.Fragment,{children:[o.jsx(Ne,{}),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(B,{className:"text-xs",children:"Número de estrelas"}),o.jsxs(Ce,{value:String(e.maxRating??5),onValueChange:y=>s({maxRating:Number(y)}),children:[o.jsx(ye,{className:"h-8 text-sm",children:o.jsx(je,{})}),o.jsx(we,{children:[3,4,5,6,7,10].map(y=>o.jsxs(pe,{value:String(y),children:[y," estrelas"]},y))})]})]})]})]}),g&&o.jsxs(o.Fragment,{children:[o.jsx(Ne,{}),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(B,{className:"text-xs",children:"Label da data inicial"}),o.jsx(Y,{value:e.dateRangeStartLabel??"Data inicial",onChange:y=>s({dateRangeStartLabel:y.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Label da data final"}),o.jsx(Y,{value:e.dateRangeEndLabel??"Data final",onChange:y=>s({dateRangeEndLabel:y.target.value}),className:"h-8 text-sm"})]})]})]}),!l&&o.jsx(Ne,{}),!l&&o.jsx(Yf,{fieldType:a,validation:e.validation,onChange:y=>s({validation:y})}),i&&o.jsxs(o.Fragment,{children:[o.jsx(Ne,{}),a==="radio"&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Estilo visual"}),o.jsxs(Ce,{value:e.visualStyle||"card",onValueChange:y=>s({visualStyle:y}),children:[o.jsx(ye,{className:"h-8 text-sm",children:o.jsx(je,{})}),o.jsxs(we,{children:[o.jsx(pe,{value:"card",children:"Card (padrão)"}),o.jsx(pe,{value:"default",children:"Radio simples"})]})]})]}),o.jsx(Il,{options:e.options||[],onChange:y=>s({options:y})})]}),l&&o.jsxs(o.Fragment,{children:[o.jsx(Ne,{}),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(B,{className:"text-xs",children:"Mín. itens"}),o.jsx(Y,{type:"number",min:0,value:e.minItems??"",onChange:y=>s({minItems:y.target.value?Number(y.target.value):void 0}),className:"h-8 text-sm",placeholder:"0"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Máx. itens"}),o.jsx(Y,{type:"number",min:0,value:e.maxItems??"",onChange:y=>s({maxItems:y.target.value?Number(y.target.value):void 0}),className:"h-8 text-sm",placeholder:"Sem limite"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Label do item"}),o.jsx(Y,{value:e.itemLabel||"",onChange:y=>s({itemLabel:y.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(B,{className:"text-xs",children:"Label do botão adicionar"}),o.jsx(Y,{value:e.addLabel||"",onChange:y=>s({addLabel:y.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."})})]})]}),h&&o.jsxs(o.Fragment,{children:[o.jsx(Ne,{}),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(B,{className:"text-xs",children:"Título do grupo (opcional)"}),o.jsx(Y,{value:e.subSchemaTitle||"",onChange:y=>s({subSchemaTitle:y.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Endereço, Responsável..."})]}),o.jsx(Qf,{subFields:e.subSchemaFields||[],onChange:y=>s({subSchemaFields:y})})]})]}),o.jsx(Ne,{}),o.jsx(Jf,{condition:e.condition,selectedId:t,allFieldIds:r,getFieldLabel:n,onChange:y=>s({condition:y})}),e.condition&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs",children:"Valor ao ocultar (clearedValue)"}),o.jsx(Y,{value:e.clearedValue??"",onChange:y=>s({clearedValue:y.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&&!h&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(B,{className:"text-xs text-muted-foreground",children:"Resolver de props (avançado)"}),o.jsx(Y,{value:e.resolvePropsKey||"",onChange:y=>s({resolvePropsKey:y.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."]})]})]})]})},th=()=>{const{selectedId:e,getConfig:t,updateConfig:r,getAllFieldIds:n}=ke();if(!e)return o.jsx("div",{className:"rounded-xl border bg-card p-4 text-center text-sm text-muted-foreground",children:"Clique em um item para configurá-lo"});const s=t(e),a=me(e),i=d=>r(e,d),l=n().filter(d=>d!==e),c=d=>t(d).label||d;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:a==="step"?"Step":a==="container"?"Container":"Campo"}),o.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:e})]}),o.jsx(Ne,{}),a==="step"&&o.jsx(xp,{config:s,onUpdate:i}),a==="container"&&o.jsx(hf,{config:s,onUpdate:i}),a==="field"&&o.jsx(eh,{config:s,selectedId:e,allFieldIds:l,getFieldLabel:c,onUpdate:i})]})},rh=(e,t)=>{var s,a,i,l,c,d;const r=((a=(s=e==null?void 0:e.containers)==null?void 0:s.root)==null?void 0:a.children)||[],n=[];for(const m of r){if(me(m)!=="step")continue;const p=((l=(i=e==null?void 0:e.containers)==null?void 0:i[m])==null?void 0:l.children)||[],f=[];for(const x of p){if(me(x)!=="container")continue;const h=(((d=(c=e==null?void 0:e.containers)==null?void 0:c[x])==null?void 0:d.children)||[]).filter(v=>me(v)==="field").map(v=>{var C,N;const b=t(v),w={id:v,config:b};if(b.fieldType==="field_array"){const j=((N=(C=e==null?void 0:e.containers)==null?void 0:C[v])==null?void 0:N.children)??[];w.subFields=j.filter(S=>me(S)==="field").map(S=>({id:S,config:t(S)}))}return w});f.push({id:x,config:t(x),fields:h})}n.push({id:m,config:t(m),containers:f})}return n},Br=(e,t,r)=>{var l;if(!e||!e.when)return!0;const n=e.source==="evento"?(r==null?void 0:r[e.when])||"":t[e.when]||"",s=parseFloat(n),a=parseFloat(e.value||"");let i;switch(e.operator){case"igual":i=n===(e.value||"");break;case"diferente":i=n!==(e.value||"");break;case"vazio":i=!n;break;case"naoVazio":i=!!n;break;case"contem":i=n.includes(e.value||"");break;case"naoContem":i=!n.includes(e.value||"");break;case"maiorQue":i=!isNaN(s)&&!isNaN(a)&&s>a;break;case"menorQue":i=!isNaN(s)&&!isNaN(a)&&s<a;break;case"maiorOuIgual":i=!isNaN(s)&&!isNaN(a)&&s>=a;break;case"menorOuIgual":i=!isNaN(s)&&!isNaN(a)&&s<=a;break;default:i=!0}if(e.logicOperator&&((l=e.extraConditions)!=null&&l.length)){const c=e.extraConditions.map(d=>Br(d,t,r));return e.logicOperator==="and"?i&&c.every(Boolean):i||c.some(Boolean)}return i},ts=(e,t,r,n)=>{if(!Br(t.condition,r,n))return;const s=t.validation,a=t.fieldType||"texto";if(t.required&&!e)return"Campo obrigatório";if(e){if(s!=null&&s.minLength&&e.length<s.minLength)return`Mínimo ${s.minLength} caracteres`;if(s!=null&&s.maxLength&&e.length>s.maxLength)return`Máximo ${s.maxLength} caracteres`;if(a==="number"){const i=Number(e);if(!isNaN(i)){if((s==null?void 0:s.min)!==void 0&&i<s.min)return`Valor mínimo: ${s.min}`;if((s==null?void 0:s.max)!==void 0&&i>s.max)return`Valor máximo: ${s.max}`}}if((a==="date"||a==="datetime")&&e){if(s!=null&&s.minDate&&e<s.minDate)return`Data mínima: ${s.minDate}`;if(s!=null&&s.maxDate&&e>s.maxDate)return`Data máxima: ${s.maxDate}`}if(s!=null&&s.regex)try{if(!new RegExp(s.regex).test(e))return s.regexMessage||"Formato inválido"}catch{}}},rs={email:"teste@email.com",number:"123",telefone:"(11) 99999-9999",cpf:"123.456.789-00",cep:"01001-000",date:new Date().toISOString().slice(0,10),datetime:new Date().toISOString().slice(0,10),textarea:"Texto de teste para preview",checkbox:"true",hidden:"",participation_type:JSON.stringify({tipo:"todos_os_dias",data:null,genero:null}),payment_method:JSON.stringify({metodo:"pix",valorTotal:0}),terms:""},Ll=(e,t)=>{var n;const r=e.fieldType||"texto";if(r==="field_array"){const s=Math.max(e.minItems??1,1),a=Array.from({length:s},()=>{const i={};return t==null||t.forEach(l=>{i[l.id]=Ll(l.config)}),i});return JSON.stringify(a)}return rs[r]!==void 0?rs[r]:(r==="select"||r==="radio")&&((n=e.options)!=null&&n.length)?e.options[0].value||"":"Teste"},oh={glassmorphism:"Glass",card:"Card",flat:"Flat",bordered:"Bordered"},nh=()=>{const{previewTemplateId:e,setPreviewTemplateId:t}=ke(),[r,n]=_.useState(!1),s=Object.values(Ye.TEMPLATE_REGISTRY),a=Ye.TEMPLATE_REGISTRY[e];return o.jsxs(Tr,{open:r,onOpenChange:n,children:[o.jsx(Ir,{asChild:!0,children:o.jsxs(le,{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:(a==null?void 0:a.colors.primary)??"#3b82f6"}}),o.jsx(k.Palette,{className:"w-3.5 h-3.5"}),o.jsx("span",{className:"hidden sm:inline",children:(a==null?void 0:a.displayName)??"Template"})]})}),o.jsxs(Vt,{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:s.map(i=>{const l=i.id===e,c=Ye.isDarkTemplate(i),d=oh[i.layout.containerStyle]??"";return o.jsxs("button",{onClick:()=>{t(i.id),n(!1)},className:U("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(k.Check,{className:"w-3 h-3 text-primary"})})]},i.id)})})]})]})},sh=({onFillMock:e,onClear:t})=>o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(nh,{}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(le,{variant:"outline",size:"sm",onClick:e,children:[o.jsx(k.FlaskConical,{className:"w-3.5 h-3.5 mr-1"}),"Preencher mock"]}),o.jsxs(le,{variant:"ghost",size:"sm",onClick:t,children:[o.jsx(k.Eraser,{className:"w-3.5 h-3.5 mr-1"}),"Limpar"]})]})]}),ah={texto:"text",number:"number",email:"email",telefone:"tel",cpf:"text",cep:"text",date:"date",datetime:"datetime-local"},Ol=e=>ah[e]||"text",xt=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,ih=({config:e,fieldId:t,subFields:r,tamanho:n,error:s,onChange:a,value:i})=>{const l=e.minItems??1,c=e.maxItems??10,d=e.itemLabel||"Item",m=e.addLabel||`Adicionar ${d}`,p=_.useRef(i||""),f=_.useCallback(()=>Object.fromEntries(r.map(j=>[j.id,""])),[r]),[x,g]=_.useState(()=>{if(i)try{const j=JSON.parse(i);if(Array.isArray(j)&&j.length>0)return j}catch{}return[f()]}),[h,v]=_.useState({});_.useEffect(()=>{if(i!==p.current){if(p.current=i||"",!i){g([f()]);return}try{const j=JSON.parse(i);Array.isArray(j)&&g(j)}catch{}}},[i,f]),_.useEffect(()=>{if(!s){v({});return}const j={};x.forEach((S,P)=>{r.forEach(y=>{const A=S[y.id]??"";y.config.required&&!A.trim()&&(j[`${P}.${y.id}`]="Campo obrigatório")})}),v(j)},[s,x,r]);const b=j=>{if(!a)return;const S=j.map(y=>{const A={};return r.forEach(I=>{A[I.id]=y[I.id]??""}),A}),P=JSON.stringify(S);p.current=P,a(P)},w=()=>{if(x.length>=c)return;const j=[...x,f()];g(j),b(j)},C=j=>{if(x.length<=l)return;const S=x.filter((P,y)=>y!==j);g(S),b(S)},N=(j,S,P)=>{const y=x.map((A,I)=>I===j?{...A,[S]:P}:A);g(y),b(y),v(A=>{const I={...A};return delete I[`${j}.${S}`],I})};return o.jsxs("div",{className:"space-y-2",style:{gridColumn:`span ${n}`},children:[e.label&&o.jsx(B,{className:"text-sm font-medium",children:e.label}),o.jsx("div",{className:"space-y-3",children:x.map((j,S)=>o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-3 shadow-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full bg-orange-500 text-white text-xs font-bold shrink-0",children:S+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[d," ",S+1]})]}),x.length>l&&o.jsx(le,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive/60 hover:text-destructive",onClick:()=>C(S),children:o.jsx(k.Trash2,{className:"h-4 w-4"})})]}),r.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Sem sub-campos configurados"}):o.jsx("div",{className:"grid grid-cols-12 gap-3",children:r.map(P=>{const y=P.config.fieldType||"texto",A=P.config.tamanho||6,I=j[P.id]??"",L=F=>N(S,P.id,F),D=h[`${S}.${P.id}`];return o.jsxs("div",{className:"space-y-1",style:{gridColumn:`span ${A}`},children:[o.jsxs(B,{className:"text-xs font-medium",children:[P.config.label,P.config.required&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),y==="textarea"?o.jsx(Mr,{placeholder:P.config.placeholder,className:D?"text-sm border-destructive":"text-sm",value:I,onChange:F=>L(F.target.value)}):y==="select"?o.jsxs(Ce,{value:I,onValueChange:L,children:[o.jsx(ye,{className:D?"text-sm border-destructive":"text-sm",children:o.jsx(je,{placeholder:P.config.placeholder||"Selecione..."})}),o.jsx(we,{children:(P.config.options||[]).map((F,M)=>o.jsx(pe,{value:F.value||`__opt_${M}`,children:F.label},`${M}-${F.value}`))})]}):y==="checkbox"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{checked:I==="true",onCheckedChange:F=>L(F?"true":"")}),o.jsx("span",{className:"text-sm text-muted-foreground",children:P.config.placeholder||P.config.label})]}):o.jsx(Y,{type:Ol(y),placeholder:P.config.placeholder,className:D?"text-sm border-destructive":"text-sm",value:I,onChange:F=>L(F.target.value)}),D&&o.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[o.jsx(k.AlertCircle,{className:"h-3 w-3 shrink-0"}),D]})]},P.id)})})]},S))}),o.jsxs(le,{type:"button",variant:"outline",className:"w-full border-dashed border-orange-500 text-orange-500 hover:bg-orange-500/10 hover:text-orange-500 font-semibold",onClick:w,disabled:x.length>=c,children:[o.jsx(k.Plus,{className:"h-4 w-4 mr-2"}),m]}),e.maxItems&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",e.maxItems," ",d.toLowerCase(),e.maxItems!==1?"s":""]}),!e.maxItems&&e.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:e.hint}),s&&o.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[o.jsx(k.AlertCircle,{className:"h-4 w-4 shrink-0"}),s]})]})},lh=({config:e,fieldId:t,value:r,onChange:n,visible:s,error:a,subFields:i,eventoData:l,allValues:c})=>{const d=e.fieldType||"texto",m=e.tamanho||6;if(!s)return null;if(d==="field_array")return o.jsx(ih,{config:e,fieldId:t,subFields:i??[],tamanho:m,error:a,onChange:n,value:r});const p=a?"border-destructive":"";return o.jsxs("div",{className:"space-y-1",style:{gridColumn:e.inicioColuna?`${e.inicioColuna} / span ${m}`:`span ${m}`},children:[d!=="terms"&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs(B,{className:"text-sm font-medium",children:[e.label,e.required&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.condition&&o.jsxs(Vr,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 border-amber-500/50 text-amber-600",children:[o.jsx(k.Zap,{className:"h-2.5 w-2.5 mr-0.5"}),"cond"]})]}),d==="textarea"?o.jsx(Mr,{placeholder:e.placeholder,className:U("text-sm",p),value:r,onChange:f=>n(f.target.value)}):d==="select"?o.jsxs(Ce,{value:r,onValueChange:n,children:[o.jsx(ye,{className:U("text-sm",p),children:o.jsx(je,{placeholder:e.placeholder||"Selecione..."})}),o.jsx(we,{children:(e.options||[]).map((f,x)=>o.jsx(pe,{value:f.value||`__opt_${x}`,children:f.label},`${x}-${f.value}`))})]}):d==="checkbox"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{checked:r==="true",onCheckedChange:f=>n(f?"true":"")}),o.jsx("span",{className:"text-sm text-muted-foreground",children:e.placeholder||e.label})]}):d==="checkbox_group"?o.jsx(ch,{config:e,value:r,onChange:n}):d==="radio"?o.jsx("div",{className:"space-y-2",children:(e.options||[{value:"1",label:"Opção 1"}]).map((f,x)=>e.visualStyle==="default"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"radio",readOnly:!0,checked:r===f.value,className:"accent-orange-500"}),o.jsx("span",{className:"text-sm",children:f.label})]},`${x}-${f.value}`):o.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border-2 transition-all cursor-pointer bg-card border-border",children:[o.jsx("input",{type:"radio",readOnly:!0,checked:r===f.value,className:"accent-orange-500"}),o.jsx("span",{className:"text-sm flex-1",children:f.label})]},`${x}-${f.value}`))}):d==="participation_type"?(()=>{const f=parseInt((l==null?void 0:l["evento.valor"])??"0")||0,x=parseInt((l==null?void 0:l["evento.valorPorDia"])??"0")||0,g=l==null?void 0:l["evento.vagasTotal"],h=l==null?void 0:l["evento.vagasPorDia"],v=l==null?void 0:l["evento.vagasMasculinas"],b=l==null?void 0:l["evento.vagasFemininas"],w=!!(v&&Number(v)>0)&&!!(b&&Number(b)>0),C=l==null?void 0:l["evento.dataInicioEvento"],N=l==null?void 0:l["evento.dataFimEvento"],j=E=>E?E.slice(8,10)+"/"+E.slice(5,7)+"/"+E.slice(0,4):"—",S=C&&N?`${j(C)} a ${j(N)}`:"Período do evento",y=(C&&N?Math.round((new Date(N.slice(0,10)+"T00:00:00Z").getTime()-new Date(C.slice(0,10)+"T00:00:00Z").getTime())/864e5)+1:0)>1;let A={};try{A=r?JSON.parse(r):{}}catch{}const I=A.tipo??null,L=A.data??null,D=A.genero??null,F=E=>n(JSON.stringify({tipo:E,data:null,...w?{genero:D}:{}})),M=E=>n(JSON.stringify({tipo:"por_dia",data:E,...w?{genero:D}:{}})),V=E=>n(JSON.stringify({tipo:I,data:L,genero:E})),R=[];if(y&&C&&N){const E=new Date(C.slice(0,10)+"T00:00:00Z"),z=new Date(N.slice(0,10)+"T00:00:00Z");let O=0;for(;E<=z&&O++<60;)R.push(E.toISOString().slice(0,10)),E.setUTCDate(E.getUTCDate()+1)}const T=E=>{const[z,O,q]=E.split("-").map(Number),se=new Date(Date.UTC(z,O-1,q)),ie=String(q).padStart(2,"0"),X=String(O).padStart(2,"0"),ne=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(se);return`${ie}/${X} — ${ne.charAt(0).toUpperCase()}${ne.slice(1)}`};return o.jsxs("div",{className:"space-y-2",children:[w&&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(E=>{const z=E==="masculino"?"Masculino":"Feminino";return o.jsx("button",{type:"button",onClick:()=>V(E),className:U("px-3 py-1 rounded-full text-xs font-medium border transition-all",D===E?"border-primary bg-primary text-primary-foreground":"border-border bg-card text-muted-foreground hover:border-primary/60"),children:z},E)})})]}),o.jsxs("button",{type:"button",onClick:()=>F("todos_os_dias"),className:U("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all bg-card",I==="todos_os_dias"?"border-primary bg-primary/10":"border-border hover:border-primary/40"),children:[o.jsx("div",{className:U("mt-0.5 p-2 rounded-lg shrink-0",I==="todos_os_dias"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:o.jsx(k.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar todos os dias"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:S})]}),o.jsxs("div",{className:"text-right shrink-0",children:[o.jsx("p",{className:U("text-sm font-bold",I==="todos_os_dias"?"text-primary":"text-foreground"),children:f>0?xt(f):"R$ —,—"}),g&&o.jsxs("p",{className:"text-xs text-emerald-500 flex items-center justify-end gap-1",children:[o.jsx(k.Users,{className:"w-3 h-3"}),g," vagas"]})]})]}),y?o.jsxs("button",{type:"button",onClick:()=>F("por_dia"),className:U("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all bg-card",I==="por_dia"?"border-primary bg-primary/10":"border-border hover:border-primary/40"),children:[o.jsx("div",{className:U("mt-0.5 p-2 rounded-lg shrink-0",I==="por_dia"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:o.jsx(k.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[o.jsx("p",{className:U("text-sm font-bold",I==="por_dia"?"text-primary":"text-foreground"),children:x>0?xt(x):"R$ —,—"}),h&&o.jsxs("p",{className:"text-xs text-emerald-500 flex items-center justify-end gap-1",children:[o.jsx(k.Users,{className:"w-3 h-3"}),h," vagas/dia"]})]})]}):C?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg bg-muted/50 border border-border",children:[o.jsx(k.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'Evento de 1 dia — a opção "Participar um dia" não é exibida.'})]}):o.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl border-2 border-border bg-card opacity-40",children:[o.jsx("div",{className:"mt-0.5 p-2 rounded-lg shrink-0 bg-muted text-muted-foreground",children:o.jsx(k.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Visível se evento tiver 2+ dias"})]}),o.jsx("div",{className:"text-right shrink-0",children:o.jsx("p",{className:"text-sm font-bold text-primary",children:"R$ —,—"})})]}),I==="por_dia"&&R.length>0&&o.jsxs("div",{className:"pl-2 space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold text-primary uppercase tracking-wide",children:"Selecione o dia:"}),R.map(E=>o.jsxs("button",{type:"button",onClick:()=>M(E),className:U("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",L===E?"border-primary bg-primary/10 text-primary":"border-border bg-card hover:border-primary/40"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:U("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center",L===E?"border-primary bg-primary":"border-muted-foreground"),children:L===E&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-primary-foreground"})}),o.jsx("span",{className:"text-sm",children:T(E)})]}),h&&o.jsxs("span",{className:"text-xs text-emerald-500",children:[h," vagas"]})]},E))]})]})})():d==="payment_method"?(()=>{const g=(c==null?void 0:c._participation_type_field)??"";let h={};try{h=g?JSON.parse(g):{}}catch{}const v=h.tipo??null,b=Number((l==null?void 0:l["evento.valor"])??0)||0,w=Number((l==null?void 0:l["evento.valorPorDia"])??0)||0,C=v==="por_dia"&&w>0?w:b,N=v==="por_dia"?(()=>{if(!h.data)return"Um dia";const[A,I,L]=h.data.split("-");return`${L}/${I}/${A}`})():"Todos os dias",j=v==="por_dia"?[{id:"pix",label:"PIX",desc:"Transferência instantânea (à vista)",taxa:0,parcelas:0},{id:"dinheiro",label:"Dinheiro",desc:"Pagamento em espécie",taxa:0,parcelas:0},{id:"cartao",label:"Cartão de Crédito",desc:"Débito ou crédito na maquininha",taxa:.0315,parcelas:0,taxaLabel:`Taxa InfinityPay: ${(.0315*100).toFixed(2).replace(".",",")}%`}]:[{id:"pix",label:"PIX à Vista",desc:"Pagamento instantâneo sem parcelamento",taxa:0,parcelas:0},{id:"pix_parcelado",label:"PIX Parcelado",desc:"Parcelado em até 7x sem juros",taxa:0,parcelas:7},{id:"cartao",label:"Cartão de Crédito",desc:"Parcelado em até 12x",taxa:.124,parcelas:12,taxaLabel:`Taxa InfinityPay: ${(.124*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",desc:"Pagamento em espécie",taxa:0,parcelas:0}];let S={};try{S=r?JSON.parse(r):{}}catch{}const P=S.metodo??null,y=A=>{const I=Math.round(C*(1+A.taxa)*100)/100,L={metodo:A.id,valorTotal:I};A.parcelas>1&&(L.parcelas=A.parcelas),n(JSON.stringify(L))};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border bg-card px-4 py-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:N})]}),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:xt(C)})]})]}),o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2.5",children:[o.jsx(k.Info,{className:"h-4 w-4 text-amber-500 mt-0.5 shrink-0"}),o.jsxs("p",{className:"text-xs text-amber-200",children:[o.jsx("span",{className:"font-bold text-amber-400",children:"Importante:"})," ","Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:j.map(A=>{const I=P===A.id,L=Math.round(C*(1+A.taxa)*100)/100,D=A.parcelas>1,F=D?Math.round(L/A.parcelas*100)/100:null;return o.jsxs("button",{type:"button",onClick:()=>y(A),className:U("w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all bg-card",I?"border-primary bg-primary/10":"border-border hover:border-primary/50"),children:[o.jsx("div",{className:U("flex items-center justify-center w-10 h-10 rounded-lg shrink-0",I?"bg-primary/20":"bg-muted"),children:o.jsx(k.Wallet,{className:U("h-5 w-5",I?"text-primary":"text-muted-foreground")})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:A.label}),o.jsx("p",{className:"text-xs text-muted-foreground",children:A.desc}),A.taxaLabel&&o.jsxs("p",{className:"text-xs text-amber-400 mt-0.5",children:["* ",A.taxaLabel]}),A.taxa>0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",xt(L)]})]}),o.jsx("div",{className:"text-right shrink-0",children:D?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[A.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold text-primary",children:xt(F)})]}):o.jsx("p",{className:"text-base font-bold text-primary",children:xt(L)})})]},A.id)})})]})})():d==="terms"?(()=>{const f=r==="accepted",x=e.termoTexto,g=e.termoPdfUrl,h=!!e.termoPdfUploadId,v=!!(x||g||h);return o.jsxs("div",{className:U("rounded-lg border p-4 space-y-4 transition-colors",f?"border-green-500/40 bg-green-500/5":"border-border bg-muted/30"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(k.ScrollText,{className:"h-4 w-4 text-primary shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:e.label||"Termos e condições"})]}),v?o.jsxs("div",{className:"flex items-center gap-1.5",children:[h&&o.jsx("span",{className:"flex items-center gap-1 text-[10px] text-green-600 dark:text-green-400 font-medium border border-green-500/40 bg-green-500/10 rounded px-1.5 py-0.5",children:"PDF enviado ✓"}),o.jsxs(le,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{},children:[o.jsx(k.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]})]}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx(xe,{checked:f,onCheckedChange:b=>n(b?"accepted":""),className:"mt-0.5"}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito"," ",e.label?`"${e.label}"`:"os termos e condições"]}),f&&o.jsx(k.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]})})():d==="file"?o.jsx(Y,{type:"file",className:U("text-sm",p)}):d==="hidden"?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Campo oculto"}):o.jsx(Y,{type:Ol(d),placeholder:e.placeholder,className:U("text-sm",p),value:r,onChange:f=>n(f.target.value)}),a?o.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[o.jsx(k.AlertCircle,{className:"h-3 w-3 shrink-0"}),a]}):e.hint?o.jsx("p",{className:"text-xs text-muted-foreground",children:e.hint}):null]})},ch=({config:e,value:t,onChange:r})=>{var i;const n=new Set(t?t.split(","):[]),s=(i=e.options)!=null&&i.length?e.options:[{value:"1",label:"Opção 1"}],a=l=>{const c=new Set(n);c.has(l)?c.delete(l):c.add(l),r(Array.from(c).join(","))};return o.jsx("div",{className:"space-y-1",children:s.map((l,c)=>o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{checked:n.has(l.value),onCheckedChange:()=>a(l.value),disabled:l.disabled}),o.jsx("span",{className:"text-sm",children:l.label})]},`${c}-${l.value}`))})},dh=({step:e,stepIndex:t,formValues:r,errors:n,eventoData:s,onChange:a})=>o.jsxs("div",{className:"rounded-xl border bg-card p-5 space-y-5",children:[o.jsxs("div",{children:[e.config.showLabel!==!1&&o.jsxs("h2",{className:"text-base font-bold text-foreground",children:["Step ",t+1," — ",e.config.label]}),e.config.description&&o.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:e.config.description})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4",children:e.containers.map(i=>o.jsxs("div",{className:U("space-y-3",i.config.showAsCard&&"rounded-lg border bg-card p-4 shadow-sm"),style:{gridColumn:i.config.inicioColuna?`${i.config.inicioColuna} / span ${i.config.tamanho||12}`:`span ${i.config.tamanho||12}`},children:[i.config.showLabel!==!1&&i.config.label!=="Novo Container"&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold text-foreground",children:i.config.label}),i.config.description&&o.jsx("p",{className:"text-xs text-muted-foreground",children:i.config.description})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-3",children:i.fields.map(l=>o.jsx(lh,{config:l.config,fieldId:l.id,subFields:l.subFields,value:r[l.id]||"",onChange:c=>a(l.id,c),visible:Br(l.config.condition,r,s),error:n[l.id],eventoData:s,allValues:r},l.id))})]},i.id))})]}),uh=({currentStep:e,isLastStep:t,onBack:r,onNext:n})=>o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs(le,{variant:"outline",onClick:r,disabled:e===0,children:[o.jsx(k.ChevronLeft,{className:"w-4 h-4 mr-1"}),"Voltar"]}),o.jsx(le,{onClick:n,children:t?o.jsxs(o.Fragment,{children:[o.jsx(k.Check,{className:"w-4 h-4 mr-1"}),"Finalizar"]}):o.jsxs(o.Fragment,{children:[o.jsx(k.ChevronRight,{className:"w-4 h-4 mr-1"}),"Próximo"]})})]}),mh=({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(k.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(le,{variant:"outline",onClick:e,children:[o.jsx(k.RotateCcw,{className:"w-4 h-4 mr-1"}),"Recomeçar"]})]}),pr=e=>{if(e)return Lt[e]},ph=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,s)=>o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(s),onKeyDown:a=>a.key==="Enter"&&(r==null?void 0:r(s)),className:U("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:s===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:s<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:s<t?o.jsx(k.Check,{className:"w-4 h-4"}):s+1},n.id))}),fh=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((n,s)=>{const a=pr(n.icone)??k.CircleDot;return o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(s),onKeyDown:i=>i.key==="Enter"&&(r==null?void 0:r(s)),className:U("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:s===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:s<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:s<t?o.jsx(k.Check,{className:"w-4 h-4"}):o.jsx(a,{className:"w-4 h-4"})},n.id)})}),hh=({steps:e,currentStep:t,position:r,orientation:n="horizontal",onStepClick:s})=>n==="vertical"?o.jsx("div",{className:"flex flex-col gap-0",children:e.map((a,i)=>{const l=pr(a.icone)??k.CircleDot,c=i===t,d=i<t,m=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:()=>s==null?void 0:s(i),className:U("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",s&&"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(k.Check,{className:"w-3.5 h-3.5"}):o.jsx(l,{className:"w-3.5 h-3.5"})}),!m&&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:a.label})]},a.id)})}):o.jsx("div",{className:"w-full flex items-start",children:e.map((a,i)=>{const l=pr(a.icone)??k.CircleDot,c=i===t,d=i<t,m=i===e.length-1;return o.jsxs("div",{className:U("flex items-start",!m&&"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:()=>s==null?void 0:s(i),className:U("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",s&&"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(k.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:a.label})]}),!m&&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)"}})]},a.id)})}),xh=({steps:e,currentStep:t,onStepClick:r,className:n})=>{const s=Ye.useTemplate(),{layout:a}=s;if(!a.showStepIndicators||e.length<=1)return null;const i=a.stepIndicatorVariant??"numbers",l=a.stepIndicatorPosition??"top-center",c=a.stepIndicatorOrientation??"horizontal",d=(t+1)/e.length*100,m=e[t],p=pr(m==null?void 0:m.icone)??k.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:`${d}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),x=o.jsxs("div",{className:"block sm:hidden space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:o.jsx(p,{className:"w-5 h-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:m==null?void 0:m.label}),o.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),f]}),g=o.jsxs("div",{className:"hidden sm:block",children:[i==="numbers"&&o.jsx(ph,{steps:e,currentStep:t,onStepClick:r}),i==="icons"&&o.jsx(fh,{steps:e,currentStep:t,onStepClick:r}),i==="icons-labeled"&&o.jsx(hh,{steps:e,currentStep:t,position:l,orientation:c,onStepClick:r})]}),h=a.showProgressBar?o.jsx("div",{className:"hidden sm:block",children:f}):null;return c==="vertical"?o.jsxs("div",{className:U("flex gap-6 items-start",n),children:[x,o.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[g,h&&o.jsx("div",{className:"flex-1 pt-4",children:h})]})]}):o.jsxs("div",{className:U("space-y-3",n),children:[x,o.jsxs("div",{className:"hidden sm:block space-y-3",children:[g,h]})]})},gh=({eventoData:e})=>{const{getConfig:t,containers:r,previewTemplateId:n}=ke(),s=rh({containers:r},t),[a,i]=_.useState({}),[l,c]=_.useState(0),[d,m]=_.useState(!1),[p,f]=_.useState({}),[x,g]=_.useState(!1),h=Math.min(l,Math.max(s.length-1,0));_.useEffect(()=>{h!==l&&c(h)},[h,l,c]);const v=_.useCallback((L,D)=>{var F;if(i(M=>({...M,[L]:D})),x){const M=(F=s[h])==null?void 0:F.containers.flatMap(V=>V.fields).find(V=>V.id===L);if(M){const V=ts(D,M.config,{...a,[L]:D},e);f(R=>{const T={...R};return V?T[L]=V:delete T[L],T})}}},[x,s,h,a,e,i,f]),b=_.useCallback(()=>{const L=s[h];if(!L)return!0;const D={};for(const M of L.containers)for(const V of M.fields){if(V.config.fieldType==="field_array"){let T=!1;try{const E=a[V.id],z=E?JSON.parse(E):[],O=V.config.minItems??1;if(z.length<O)D[V.id]=`Mínimo de ${O} item${O!==1?"s":""} obrigatório${O!==1?"s":""}`,T=!0;else{for(const q of z){for(const se of V.subFields??[]){const ie=q[se.id]??"";if(se.config.required&&!ie.trim()){T=!0;break}}if(T)break}T&&(D[V.id]="Preencha todos os campos obrigatórios")}}catch{V.config.required&&(D[V.id]="Campo obrigatório")}continue}const R=ts(a[V.id]||"",V.config,a,e);R&&(D[V.id]=R)}f(D),g(!0);const F=Object.keys(D).length;return F>0?(console.warn(`Corrija ${F} campo(s) destacado(s) antes de continuar`),!1):!0},[s,h,a,e,f,g]),w=_.useCallback(()=>{b()&&(g(!1),f({}),h>=s.length-1?m(!0):c(L=>L+1))},[b,h,s.length,g,f,m,c]),C=_.useCallback(()=>{c(L=>L-1),g(!1),f({})},[c,g,f]),N=_.useCallback(()=>{const L={};for(const D of s)for(const F of D.containers)for(const M of F.fields)Br(M.config.condition,a,e)&&(L[M.id]=Ll(M.config,M.subFields));i(D=>({...D,...L}))},[s,a,e,i]),j=_.useCallback(()=>{i({}),f({}),g(!1)},[i,f,g]),S=_.useCallback(()=>{m(!1),c(0),j()},[m,c,j]);if(s.length===0)return o.jsx("div",{className:"rounded-lg border border-dashed border-border/40 p-6 text-center text-xs text-muted-foreground/50",children:"Adicione steps, containers e campos para ver o preview ao vivo"});if(d)return o.jsx(mh,{onRestart:S});const P=s[h],y=s.length,A=h===y-1,I=Ye.getTemplateConfig(n);return o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"px-1",children:o.jsx(sh,{onFillMock:N,onClear:j})}),o.jsx(Ye.TemplateProvider,{config:I,className:I.wrapperClass,style:{minHeight:"100%",padding:"12px",borderRadius:"12px"},children:o.jsxs("div",{className:"max-w-4xl mx-auto space-y-4",children:[o.jsx(xh,{steps:s.map(L=>({id:L.id,label:L.config.label,icone:L.config.icone})),currentStep:h}),o.jsx(dh,{step:P,stepIndex:h,formValues:a,errors:p,eventoData:e,onChange:v}),o.jsx(uh,{currentStep:h,isLastStep:A,onBack:C,onNext:w})]})})]})},_l=({id:e,currentTamanho:t,inicioColuna:r,onResize:n,pushSnapshot:s})=>{const a=_.useRef(null),[i,l]=_.useState(!1),[c,d]=_.useState(null),m=_.useRef(null);_.useEffect(()=>()=>{var f;(f=m.current)==null||f.call(m)},[]);const p=_.useCallback(f=>{f.preventDefault(),f.stopPropagation(),s==null||s();const x=a.current;if(!x)return;const g=x.parentElement;if(!g)return;const h=g.getBoundingClientRect().width,v=x.getBoundingClientRect().width,b=f.clientX,w=r?13-r:12;l(!0);const C=j=>{const S=j.clientX-b,y=(v+S)/h,A=Math.max(1,Math.min(w,Math.round(y*12)));d(A),n(A)},N=()=>{l(!1),d(null),m.current=null,window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",N)};m.current=()=>{l(!1),d(null),window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",N)},window.addEventListener("mousemove",C),window.addEventListener("mouseup",N)},[r,n,s]);return{resizeRef:a,resizing:i,resizePreview:c,handleResizeStart:p}},vh=({id:e,elementRef:t,onPositionApply:r,setPositionDrag:n,setSelected:s,pushSnapshot:a})=>{const i=_.useRef(null);return _.useEffect(()=>()=>{var c;(c=i.current)==null||c.call(i)},[]),{handlePositionMouseDown:_.useCallback(c=>{c.preventDefault(),c.stopPropagation(),a==null||a(),s(e);const d=t.current;if(!d)return;const m=d.parentElement;if(!m)return;const p=m.getBoundingClientRect(),f=p.width/12,x=d.getBoundingClientRect(),g=Math.max(1,Math.round(x.width/f)),h=x.left-p.left,v=c.clientX-x.left,b=j=>{const S=j-p.left-v,P=Math.round(S/f)+1;return Math.max(1,Math.min(13-g,P))},w=Math.max(1,Math.min(12,Math.round(h/f)+1));n({itemId:e,ghostStart:w,ghostSpan:g,cursorX:c.clientX,cursorY:c.clientY});const C=j=>{n({itemId:e,ghostStart:b(j.clientX),ghostSpan:g,cursorX:j.clientX,cursorY:j.clientY})},N=j=>{r(b(j.clientX)),n(null),i.current=null,window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",N)};i.current=()=>{n(null),window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",N)},window.addEventListener("mousemove",C),window.addEventListener("mouseup",N)},[e,t,r,n,s,a])}},Bt=({id:e,container:t})=>{const{attributes:r,listeners:n,setNodeRef:s,transform:a,transition:i,isDragging:l}=Fe.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{selectedId:c,setSelected:d,getConfig:m,updateConfig:p,removeItem:f,setPositionDrag:x,positionDrag:g,pushSnapshot:h}=ke(),v=m(e),b=as(e),w=(b==null?void 0:b.icon)||k.Type,C=c===e,N=v.tamanho||6,j=(g==null?void 0:g.itemId)===e,[S,P]=_.useState(!1),y="var(--t-primary, hsl(var(--primary)))",A=C?y:S?`color-mix(in srgb, ${y} 60%, transparent)`:`color-mix(in srgb, ${y} 25%, transparent)`,I=C?`0 0 0 2px color-mix(in srgb, ${y} 30%, transparent)`:void 0,{resizeRef:L,resizing:D,resizePreview:F,handleResizeStart:M}=_l({id:e,currentTamanho:N,inicioColuna:v.inicioColuna,onResize:R=>p(e,{tamanho:R}),pushSnapshot:h}),{handlePositionMouseDown:V}=vh({id:e,elementRef:L,onPositionApply:R=>p(e,{inicioColuna:R}),setPositionDrag:x,setSelected:d,pushSnapshot:h});return o.jsxs("div",{ref:R=>{s(R),L.current=R},onClick:R=>{R.stopPropagation(),d(e)},"data-field-id":e,onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1),className:U("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",D&&"ring-2 ring-blue-400/50",j&&"opacity-0 pointer-events-none"),style:{gridColumn:v.inicioColuna?`${v.inicioColuna} / span ${N}`:`span ${N}`,transform:Mt.CSS.Transform.toString(a),transition:i,opacity:l?0:1,borderColor:A,boxShadow:I},children:[o.jsx("div",{onMouseDown:V,onClick:R=>R.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(k.ArrowLeftRight,{className:"h-3 w-3 text-primary/60"})}),o.jsx("div",{...n,...r,className:"cursor-grab shrink-0",onClick:R=>R.stopPropagation(),children:o.jsx(k.GripVertical,{className:"h-3 w-3 text-primary"})}),o.jsx(w,{className:"h-3.5 w-3.5 text-primary shrink-0"}),o.jsx("span",{className:"font-medium truncate flex-1",children:v.label}),v.condition&&o.jsx(k.Zap,{className:"h-3 w-3 text-amber-500 shrink-0"}),v.required&&o.jsx("span",{className:"text-destructive font-bold",children:"*"}),o.jsxs("span",{className:"text-[9px] text-muted-foreground shrink-0",children:[F??N,"/12"]}),o.jsx("button",{onClick:R=>{R.stopPropagation(),f(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:S?1:0},children:o.jsx(k.Trash2,{className:"h-3 w-3 text-destructive"})}),o.jsx("div",{className:"absolute left-2 -bottom-0.5 font-mono truncate max-w-[90%] pointer-events-none text-[8px] text-muted-foreground/30",children:e}),o.jsx("div",{"data-resize":!0,onMouseDown:M,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-primary/20 transition-colors flex items-center justify-center",children:o.jsx(k.GripHorizontal,{className:"h-3 w-3 text-primary/40 rotate-90"})})]})},bh=({id:e,container:t})=>{var j;const{attributes:r,listeners:n,setNodeRef:s,transform:a,transition:i,isDragging:l}=Fe.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{setNodeRef:c,isOver:d}=jt.useDroppable({id:`zone-${e}`}),{selectedId:m,setSelected:p,getConfig:f,removeItem:x,moveItem:g,containers:h}=ke(),v=f(e),w=(((j=h[e])==null?void 0:j.children)??[]).filter(S=>me(S)==="field"),C=m===e,N=v.tamanho||12;return o.jsxs("div",{ref:s,onClick:S=>{S.stopPropagation(),p(e)},className:U("group/fa relative rounded-lg border overflow-hidden transition-all",l&&"opacity-0 pointer-events-none",C?"border-amber-500 ring-2 ring-amber-500/20 shadow-lg":"border-amber-500/30 hover:border-amber-500/55"),style:{gridColumn:v.inicioColuna?`${v.inicioColuna} / span ${N}`:`span ${N}`,transform:Mt.CSS.Transform.toString(a),transition:i},children:[o.jsxs("div",{className:U("flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",C?"bg-amber-500/15 border-amber-500/30":"bg-amber-500/10 border-amber-500/20"),children:[o.jsx("div",{...n,...r,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-amber-500/20 transition-colors",onClick:S=>S.stopPropagation(),children:o.jsx(k.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:S=>{S.stopPropagation(),g(e,"up")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(k.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})}),o.jsx("button",{onClick:S=>{S.stopPropagation(),g(e,"down")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(k.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})})]}),o.jsx(k.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:v.label}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-amber-500/10 px-1.5 rounded",children:[v.itemLabel||"Item"," · ",w.length," campo",w.length!==1?"s":""]}),o.jsx("button",{onClick:S=>{S.stopPropagation(),x(e)},className:"opacity-0 group-hover/fa:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",children:o.jsx(k.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:c,className:U("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",d?"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:[w.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(Fe.SortableContext,{items:w,strategy:Fe.rectSortingStrategy,children:w.map(S=>o.jsx(Bt,{id:S,container:e},S))})]})]})},os=5,yh=({id:e,elementRef:t,tamanho:r,inicioColuna:n,onPositionApply:s,setPositionDrag:a,setSelected:i,reorderStrategy:l})=>{const c=_.useRef({inicioColuna:n,tamanho:r});c.current={inicioColuna:n,tamanho:r};const d=_.useRef(null);return _.useEffect(()=>()=>{var p;(p=d.current)==null||p.call(d)},[]),{handleGripMouseDown:_.useCallback(p=>{p.preventDefault(),p.stopPropagation(),i(e);const f=p.clientX,x=p.clientY;let g=!1;const h=()=>{d.current=null,window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",b)},v=N=>{const j=Math.abs(N.clientX-f),S=Math.abs(N.clientY-x);j<os&&S<os||(g=!0,h(),j>=S?w(N):C(N))},b=()=>{g||h()};window.addEventListener("mousemove",v),window.addEventListener("mouseup",b),d.current=h;const w=N=>{const j=t.current;if(!j)return;const S=j.parentElement;if(!S)return;const P=S.getBoundingClientRect(),A=P.width/12,{tamanho:I}=c.current,L=j.getBoundingClientRect(),D=L.left-P.left,F=Math.max(1,Math.min(12,Math.round(D/A)+1)),M=L.left;a({itemId:e,ghostStart:F,ghostSpan:I,cursorX:N.clientX,cursorY:N.clientY});const V=E=>{const z=E-M,O=Math.round(z/A)+1;return Math.max(1,Math.min(13-I,O))};a({itemId:e,ghostStart:V(N.clientX),ghostSpan:I,cursorX:N.clientX,cursorY:N.clientY});const R=E=>{a({itemId:e,ghostStart:V(E.clientX),ghostSpan:I,cursorX:E.clientX,cursorY:E.clientY})},T=E=>{s(V(E.clientX)),a(null),d.current=null,window.removeEventListener("mousemove",R),window.removeEventListener("mouseup",T)};window.addEventListener("mousemove",R),window.addEventListener("mouseup",T),d.current=()=>{a(null),window.removeEventListener("mousemove",R),window.removeEventListener("mouseup",T)}},C=N=>{const j=l,S=t.current;if(!S)return;const P=S.parentElement;if(!P)return;const y=j.dataAttribute||"data-container-id";j.pushSnapshot(),j.setReorderDrag({draggingId:e});let A=N.clientY;const I=D=>{const F=Array.from(P.children).filter(M=>M!==S&&M.getAttribute(y));for(const M of F){const V=M.getBoundingClientRect(),R=V.top+V.height/2;if(D.clientY<R&&D.clientY>V.top&&D.clientY<A){j.moveItemNoSnapshot(e,"up"),A=D.clientY;break}else if(D.clientY>R&&D.clientY<V.bottom&&D.clientY>A){j.moveItemNoSnapshot(e,"down"),A=D.clientY;break}}},L=()=>{j.setReorderDrag(null),d.current=null,window.removeEventListener("mousemove",I),window.removeEventListener("mouseup",L)};window.addEventListener("mousemove",I),window.addEventListener("mouseup",L),d.current=()=>{j.setReorderDrag(null),window.removeEventListener("mousemove",I),window.removeEventListener("mouseup",L)}}},[e,t,s,a,i,l])}},un=({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]})})]}),mn=({id:e,container:t})=>{var ie;const{setNodeRef:r,isOver:n}=jt.useDroppable({id:`zone-${e}`}),{selectedId:s,setSelected:a,getConfig:i,updateConfig:l,removeItem:c,moveItem:d,moveItemNoSnapshot:m,setPositionDrag:p,positionDrag:f,reorderDrag:x,setReorderDrag:g,pushSnapshot:h,containers:v}=ke(),b=i(e),w=((ie=v[e])==null?void 0:ie.children)??[],C=w.filter(X=>me(X)==="field"),N=s===e,j=b.tamanho||12,S=(f==null?void 0:f.itemId)===e,P=(x==null?void 0:x.draggingId)===e,y=f&&w.includes(f.itemId),A=s&&w.includes(s)&&me(s)==="field",[I,L]=_.useState(!1),D="var(--t-primary, hsl(var(--primary)))",F=N?D:I?"rgba(59,130,246,0.55)":"rgba(59,130,246,0.3)",M=N?`color-mix(in srgb, ${D} 15%, transparent)`:I?"rgba(59,130,246,0.12)":"rgba(59,130,246,0.07)",V=N?`color-mix(in srgb, ${D} 30%, transparent)`:I?"rgba(59,130,246,0.28)":"rgba(59,130,246,0.18)",R=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:T,resizing:E,resizePreview:z,handleResizeStart:O}=_l({id:e,currentTamanho:j,inicioColuna:b.inicioColuna,onResize:X=>l(e,{tamanho:X}),pushSnapshot:h}),q=_.useMemo(()=>({kind:"custom",moveItemNoSnapshot:m,pushSnapshot:h,setReorderDrag:g,dataAttribute:"data-container-id"}),[m,h,g]),{handleGripMouseDown:se}=yh({id:e,elementRef:T,tamanho:j,inicioColuna:b.inicioColuna||1,onPositionApply:X=>l(e,{inicioColuna:X}),setPositionDrag:p,setSelected:a,reorderStrategy:q});return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:X=>{T.current=X},onClick:X=>{X.stopPropagation(),a(e)},onMouseEnter:()=>L(!0),onMouseLeave:()=>L(!1),className:U("relative rounded-lg border overflow-hidden transition-all",E&&"ring-2 ring-blue-400/50",S&&"opacity-0 pointer-events-none",P&&"opacity-50"),"data-container-id":e,style:{gridColumn:b.inicioColuna?`${b.inicioColuna} / span ${j}`:`span ${j}`,minWidth:"80px",borderColor:F,boxShadow:R},children:[o.jsxs("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",style:{backgroundColor:M,borderColor:V},children:[o.jsx("div",{"data-grip":!0,onMouseDown:se,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-primary/20 transition-colors",children:o.jsx(k.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:X=>{X.stopPropagation(),d(e,"up")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(k.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})}),o.jsx("button",{onClick:X=>{X.stopPropagation(),d(e,"down")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(k.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})})]}),o.jsx(k.BoxSelect,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"}),o.jsx("span",{className:U("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(k.SquareStack,{className:"h-3 w-3 text-blue-400 shrink-0"}),b.showLabel===!1&&o.jsx(k.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:[z??j,"/12"]}),o.jsx("button",{onClick:X=>{X.stopPropagation(),c(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:I?1:0},children:o.jsx(k.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:r,className:U("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",n?"bg-primary/15 ring-2 ring-inset ring-primary/50":(y||A)&&"bg-muted/30"),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[o.jsx(un,{showGuides:!!y||!!A,positionDrag:y?f:null}),w.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(Fe.SortableContext,{items:C,strategy:Fe.rectSortingStrategy,children:w.filter(X=>me(X)==="field").map(X=>i(X).fieldType==="field_array"?o.jsx(bh,{id:X,container:e},X):o.jsx(Bt,{id:X,container:e},X))})]}),o.jsx("div",{onMouseDown:O,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(k.GripHorizontal,{className:"h-3 w-3 text-blue-500/40 rotate-90"})})]}),S&&f&&So.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(k.BoxSelect,{className:"h-2.5 w-2.5"}),"col ",f.ghostStart,"–",f.ghostStart+f.ghostSpan-1]}),document.body)," "]})},Dl=({id:e,container:t,index:r})=>{var F;const{attributes:n,listeners:s,setNodeRef:a,transform:i,transition:l,isDragging:c}=Fe.useSortable({id:e,data:{isCanvasItem:!0,type:"step",id:e}}),{setNodeRef:d,isOver:m}=jt.useDroppable({id:`zone-${e}`}),{selectedId:p,setSelected:f,getConfig:x,removeItem:g,containers:h,positionDrag:v}=ke(),b=x(e),w=((F=h[e])==null?void 0:F.children)??[],C=p===e,N=v&&w.includes(v.itemId),[j,S]=_.useState(!1),P="var(--t-primary, hsl(var(--primary)))",y=C?P:j?`color-mix(in srgb, ${P} 60%, transparent)`:`color-mix(in srgb, ${P} 25%, transparent)`,A=C?`color-mix(in srgb, ${P} 14%, transparent)`:j?`color-mix(in srgb, ${P} 10%, transparent)`:`color-mix(in srgb, ${P} 6%, transparent)`,I=C?`color-mix(in srgb, ${P} 28%, transparent)`:`color-mix(in srgb, ${P} 15%, transparent)`,L=C?`0 0 0 3px color-mix(in srgb, ${P} 20%, transparent)`:void 0,D={transform:Mt.CSS.Transform.toString(i),transition:l,opacity:c?0:1};return o.jsxs("div",{ref:a,style:{...D,borderWidth:"2px",borderStyle:"solid",borderColor:y,boxShadow:L},onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),onClick:M=>{M.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:A,borderColor:I},children:[o.jsx("div",{...s,...n,className:"cursor-grab shrink-0",onClick:M=>M.stopPropagation(),children:o.jsx(k.GripVertical,{className:"h-3.5 w-3.5 text-primary"})}),o.jsx(k.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:M=>{M.stopPropagation(),g(e)},className:"transition-opacity shrink-0 p-1 rounded hover:bg-destructive/10",style:{opacity:j?1:0},children:o.jsx(k.Trash2,{className:"h-3.5 w-3.5 text-destructive"})})]}),o.jsxs("div",{ref:d,className:U("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(un,{showGuides:!!N,positionDrag:N?v:null}),w.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"}),w.map(M=>me(M)==="container"?o.jsx(mn,{id:M,container:e},M):o.jsx(Bt,{id:M,container:e},M))]})]})},wh=()=>{var i;const{containers:e,setSelected:t}=ke(),r=((i=e.root)==null?void 0:i.children)??[],n=r.filter(l=>me(l)==="step"),{setNodeRef:s,isOver:a}=jt.useDroppable({id:"root"});return o.jsxs("div",{ref:s,onClick:()=>t(null),className:`min-h-[500px] rounded-xl border p-4 space-y-4 transition-all duration-150 ${a?"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:a?void 0:"hsl(var(--muted) / 0.3)"},children:[r.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(k.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(Fe.SortableContext,{items:n,strategy:Fe.verticalListSortingStrategy,children:r.map((l,c)=>{const d=me(l);return d==="step"?o.jsx(Dl,{id:l,container:"root",index:c},l):d==="container"?o.jsx(mn,{id:l,container:"root"},l):o.jsx(Bt,{id:l,container:"root"},l)})})]})},Nh={personal:"Pessoal",address:"Endereço",health:"Saúde",event:"Evento",payment:"Pagamento",emergency:"Emergência"},Ch={texto:"Texto",selecao:"Seleção",range:"Numérico / Visual",data:"Data e Hora",contato:"Contato / Endereço",outros:"Arquivo / Outros"},jh=()=>{const e=at.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"}),ss.map(t=>o.jsx(ns,{component:t.component,label:t.label,icon:t.icon,color:t.color},t.component))]}),Object.entries(e).map(([t,r])=>o.jsx(ro,{label:Ch[t]??t,children:r.map(n=>o.jsx(ns,{component:n.component,label:n.label,icon:n.icon,color:"border-border"},n.component))},t)),o.jsx(ro,{label:"Blocos pré-configurados",defaultOpen:!1,children:Ye.PRESET_BLOCKS.map(t=>o.jsx(Sh,{block:t},t.id))}),o.jsx(ro,{label:"Blocos de steps",defaultOpen:!1,children:Ye.PRESET_STEP_BLOCKS.map(t=>o.jsx(Ph,{block:t},t.id))})]})},ro=({label:e,children:t,defaultOpen:r=!0})=>{const[n,s]=_.useState(r);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("button",{type:"button",onClick:()=>s(a=>!a),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(k.ChevronDown,{className:`h-3.5 w-3.5 transition-transform ${n?"":"-rotate-90"}`})]}),n&&o.jsx("div",{className:"space-y-1.5",children:t})]})},ns=({component:e,label:t,icon:r,color:n})=>{const{attributes:s,listeners:a,setNodeRef:i,transform:l,isDragging:c}=jt.useDraggable({id:`palette-${e}`,data:{isPaletteItem:!0,componentType:e}});return o.jsxs("div",{ref:i,...a,...s,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:Mt.CSS.Translate.toString(l)},children:[o.jsx(k.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})]})},Sh=({block:e})=>{const{attributes:t,listeners:r,setNodeRef:n,transform:s,isDragging:a}=jt.useDraggable({id:`preset-${e.id}`,data:{isPalettePreset:!0,presetId:e.id}}),i=e.icon?Lt[e.icon]:void 0,l=Nh[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 ${a?"opacity-50":""}`,style:{transform:a?void 0:Mt.CSS.Translate.toString(s)},title:e.description,children:[o.jsx(k.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(Lt.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})]})]})},Ph=({block:e})=>{const{addPresetStepBlock:t}=ke(),r=e.icon?Lt[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(Lt.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"]})]})},oo=e=>({when:e.campoId,operator:e.operador,value:e.valor,source:e.source}),Ml=e=>{var r;const t={campoId:e.when,operador:e.operator,valor:e.value,source:e.source};if(e.logicOperator&&((r=e.extraConditions)!=null&&r.length)){const n=e.extraConditions.map(a=>({campoId:a.when,operador:a.operator,valor:a.value,source:a.source})),s=[t,...n];return e.logicOperator==="or"?{or:s}:{and:s}}return t},$l=e=>{if("campoId"in e)return oo(e);const t=("and"in e?e.and:e.or)??[];if(t.length===0)return;const r="and"in e?"and":"or",[n,...s]=t;if(!("campoId"in n))return;const a=oo(n);return s.length===0?a:{...a,logicOperator:r,extraConditions:s.filter(i=>"campoId"in i).map(oo)}},Rh=(e,t,r)=>{var i,l;const n=c=>t[c]||{label:c,name:c},a=(((l=(i=e==null?void 0:e.containers)==null?void 0:i.root)==null?void 0:l.children)||[]).filter(c=>me(c)==="step").map((c,d)=>{var x,g;const m=n(c),f=(((g=(x=e==null?void 0:e.containers)==null?void 0:x[c])==null?void 0:g.children)||[]).filter(h=>me(h)==="container").map((h,v)=>{var j,S;const b=n(h),C=(((S=(j=e==null?void 0:e.containers)==null?void 0:j[h])==null?void 0:S.children)||[]).filter(P=>me(P)==="field").map((P,y)=>{var L,D;const A=n(P),I=Co(A,P,y);if(I.tipo===de.FieldType.FIELD_ARRAY){const F=((D=(L=e==null?void 0:e.containers)==null?void 0:L[P])==null?void 0:D.children)??[];I.subFields=F.filter(M=>me(M)==="field").map((M,V)=>Co(n(M),M,V))}return I}),N={id:h,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:C};return b.condition&&(N.condicional=Ml(b.condition)),N});return{id:c,titulo:m.label||"Step",descricao:m.description,icone:m.icone,ordem:d,showLabel:m.showLabel,containers:f}});return{id:r.id||"",nome:r.nome,descricao:r.descricao,status:r.status,template:r.template??null,steps:a}},Co=(e,t,r)=>{var s,a,i,l;const n={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((s=e.validate)!=null&&s.length&&(n.validate=e.validate),(a=e.warn)!=null&&a.length&&(n.warn=e.warn),(i=e.options)!=null&&i.length&&(n.opcoes=e.options.map(c=>({valor:c.value,label:c.label,disabled:c.disabled}))),e.validation){const c=e.validation;n.validacao={},c.minLength!==void 0&&(n.validacao.minLength=c.minLength),c.maxLength!==void 0&&(n.validacao.maxLength=c.maxLength),c.min!==void 0&&(n.validacao.min=c.min),c.max!==void 0&&(n.validacao.max=c.max),c.regex&&(n.validacao.regex=c.regex),c.regexMessage&&(n.validacao.regexMessage=c.regexMessage),c.minDate&&(n.validacao.minDate=c.minDate),c.maxDate&&(n.validacao.maxDate=c.maxDate),c.minAge!==void 0&&(n.validacao.minAge=c.minAge),c.maxAge!==void 0&&(n.validacao.maxAge=c.maxAge),(l=c.fileTypes)!=null&&l.length&&(n.validacao.fileTypes=c.fileTypes),c.maxFileSize!==void 0&&(n.validacao.maxFileSize=c.maxFileSize)}if(n.tipo===de.FieldType.FIELD_ARRAY&&(e.itemLabel&&(n.itemLabel=e.itemLabel),e.minItems!==void 0&&(n.minItems=e.minItems),e.maxItems!==void 0&&(n.maxItems=e.maxItems),e.addLabel&&(n.addLabel=e.addLabel)),n.tipo===de.FieldType.TERMS&&(e.termoTexto&&(n.termoTexto=e.termoTexto),e.termoPdfUrl&&(n.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(n.termoPdfUploadId=e.termoPdfUploadId)),n.tipo===de.FieldType.SLIDER&&(e.step!==void 0&&(n.step=e.step),e.minValue!==void 0&&(n.minValue=e.minValue),e.maxValue!==void 0&&(n.maxValue=e.maxValue)),n.tipo===de.FieldType.RATING&&e.maxRating!==void 0&&(n.maxRating=e.maxRating),n.tipo===de.FieldType.DATE_RANGE&&(e.dateRangeStartLabel&&(n.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(n.dateRangeEndLabel=e.dateRangeEndLabel)),n.tipo===de.FieldType.SUB_FORM){const c=e.subSchemaFields??[];(c.length>0||e.subSchemaTitle)&&(n.subSchema={titulo:e.subSchemaTitle,fields:c.map((d,m)=>Co(d,d.name??`subfield-${m}`,m))})}return e.condition&&(n.condicional=Ml(e.condition)),n},Eh=e=>{const t={},r={root:{children:[]}},n=[...e.steps].sort((s,a)=>s.ordem-a.ordem);for(const s of n){const a=s.id||`step-${de.v4Fallback()}`;r.root.children.push(a),t[a]={label:s.titulo,name:a,fieldType:"step",description:s.descricao,icone:s.icone,showLabel:s.showLabel};const i=[],l=[...s.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l){const d=c.id||`container-${de.v4Fallback()}`;i.push(d);const m=c.condicional?$l(c.condicional):void 0;t[d]={label:c.titulo,name:d,fieldType:"container",description:c.descricao,icone:c.icone,columns:c.colunas,tamanho:c.tamanho||12,inicioColuna:c.inicioColuna,showLabel:c.showLabel,showAsCard:c.showAsCard,...m?{condition:m}:{}};const p=[],f=[...c.campos].sort((x,g)=>x.ordem-g.ordem);for(const x of f){const g=x.id||`${x.tipo}-${de.v4Fallback()}`;if(p.push(g),t[g]=jo(x),x.tipo===de.FieldType.FIELD_ARRAY){const h=[];for(const v of x.subFields??[]){const b=v.id||`${v.tipo}-${de.v4Fallback()}`;h.push(b),t[b]=jo(v)}r[g]={children:h}}}r[d]={children:p}}r[a]={children:i}}return{dndState:{containers:r},configs:t,templateId:e.template??null}},jo=(e,t)=>{var n,s,a,i;const r={label:e.label,name:e.nome,fieldType:e.tipo,required:e.obrigatorio,tamanho:e.tamanho,inicioColuna:e.inicioColuna,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!=null?String(e.clearedValue):void 0,initialValue:e.initialValue!==void 0?String(e.initialValue):void 0,resolvePropsKey:e.resolvePropsKey||void 0,validate:(n=e.validate)!=null&&n.length?e.validate:void 0,warn:(s=e.warn)!=null&&s.length?e.warn:void 0};if((a=e.opcoes)!=null&&a.length&&(r.options=e.opcoes.map(l=>({value:l.valor,label:l.label,disabled:l.disabled}))),e.validacao){const l=e.validacao;r.validation={},l.minLength!==void 0&&(r.validation.minLength=l.minLength),l.maxLength!==void 0&&(r.validation.maxLength=l.maxLength),l.min!==void 0&&(r.validation.min=l.min),l.max!==void 0&&(r.validation.max=l.max),l.regex&&(r.validation.regex=l.regex),l.regexMessage&&(r.validation.regexMessage=l.regexMessage),l.minDate&&(r.validation.minDate=l.minDate),l.maxDate&&(r.validation.maxDate=l.maxDate),l.minAge!==void 0&&(r.validation.minAge=l.minAge),l.maxAge!==void 0&&(r.validation.maxAge=l.maxAge),(i=l.fileTypes)!=null&&i.length&&(r.validation.fileTypes=l.fileTypes),l.maxFileSize!==void 0&&(r.validation.maxFileSize=l.maxFileSize)}if(e.tipo===de.FieldType.FIELD_ARRAY&&(e.itemLabel&&(r.itemLabel=e.itemLabel),e.minItems!==void 0&&(r.minItems=e.minItems),e.maxItems!==void 0&&(r.maxItems=e.maxItems),e.addLabel&&(r.addLabel=e.addLabel)),e.tipo===de.FieldType.TERMS&&(e.termoTexto&&(r.termoTexto=e.termoTexto),e.termoPdfUrl&&(r.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(r.termoPdfUploadId=e.termoPdfUploadId)),e.tipo===de.FieldType.SLIDER&&(e.step!==void 0&&(r.step=e.step),e.minValue!==void 0&&(r.minValue=e.minValue),e.maxValue!==void 0&&(r.maxValue=e.maxValue)),e.tipo===de.FieldType.RATING&&e.maxRating!==void 0&&(r.maxRating=e.maxRating),e.tipo===de.FieldType.DATE_RANGE&&(e.dateRangeStartLabel&&(r.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(r.dateRangeEndLabel=e.dateRangeEndLabel)),e.tipo===de.FieldType.SUB_FORM&&e.subSchema&&(r.subSchemaTitle=e.subSchema.titulo,r.subSchemaFields=e.subSchema.fields.map(l=>jo(l,l.id))),e.condicional){const l=$l(e.condicional);l&&(r.condition=l)}return r},Ah=(e,t)=>{var l,c,d,m,p,f,x;const r=[],n=[],s=g=>t[g]||{label:g,name:g},a=((c=(l=e==null?void 0:e.containers)==null?void 0:l.root)==null?void 0:c.children)||[],i=new Set;for(const g of a){if(me(g)!=="step")continue;const h=s(g).label||g,v=((m=(d=e==null?void 0:e.containers)==null?void 0:d[g])==null?void 0:m.children)||[];if(v.length===0){n.push(`Step "${h}" está vazio (sem containers).`);continue}for(const b of v){if(me(b)!=="container")continue;const w=s(b).label||b,C=((f=(p=e==null?void 0:e.containers)==null?void 0:p[b])==null?void 0:f.children)||[],N=new Map;for(const j of C){if(me(j)!=="field")continue;i.add(j);const S=s(j).name||j;N.has(S)||N.set(S,[]),N.get(S).push(j)}for(const[j,S]of N.entries())S.length>1&&r.push(`Nome duplicado "${j}" no container "${w}" (IDs: ${S.join(", ")}).`)}}for(const[g,h]of Object.entries(t)){if(!((x=h.condition)!=null&&x.when))continue;const v=h.condition.when;if(!i.has(v)){const b=h.label||g;n.push(`Campo "${b}" referencia campo inexistente na condição (when: "${v}").`)}}return{errors:r,warnings:n}};exports.BuilderProvider=Bl;exports.Canvas=wh;exports.ConfigPanel=th;exports.DroppedContainer=mn;exports.DroppedField=Bt;exports.DroppedStep=Dl;exports.EVENT_VARIABLES=Ro;exports.FIELD_TYPES=at;exports.GridOverlay=un;exports.LivePreview=gh;exports.Palette=jh;exports.STRUCTURE_TYPES=ss;exports.builderToFormSchema=Rh;exports.findParentContainer=cs;exports.formSchemaToBuilder=Eh;exports.getFieldMeta=zl;exports.getFieldMetaById=as;exports.getItemType=me;exports.useBuilder=ke;exports.validateBuilderIntegrity=Ah;
|
|
51
51
|
//# sourceMappingURL=index.cjs.map
|