@schema-forms-data/builder 0.3.12 → 0.3.14

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 CHANGED
@@ -1,51 +1,51 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`react`);c=s(c);let l=require(`lucide-react`);l=s(l);let u=require(`@schema-forms-data/core`),d=require(`react/jsx-runtime`),f=require(`react-dom`);f=s(f);let p=require(`@schema-forms-data/templates`),m=require(`@dnd-kit/sortable`),h=require(`@dnd-kit/utilities`),g=require(`@dnd-kit/core`);var _=[{component:`texto`,label:`Texto`,icon:l.Type,group:`texto`},{component:`textarea`,label:`Área de texto`,icon:l.AlignLeft,group:`texto`},{component:`number`,label:`Número`,icon:l.Hash,group:`texto`},{component:`email`,label:`E-mail`,icon:l.Mail,group:`texto`},{component:`password`,label:`Senha`,icon:l.Lock,group:`texto`},{component:`select`,label:`Seleção`,icon:l.ChevronDown,group:`selecao`},{component:`autocomplete`,label:`Autocomplete`,icon:l.Search,group:`selecao`},{component:`radio`,label:`Radio`,icon:l.CircleDot,group:`selecao`},{component:`checkbox`,label:`Checkbox`,icon:l.CheckSquare,group:`selecao`},{component:`checkbox_group`,label:`Grupo de checkboxes`,icon:l.ListChecks,group:`selecao`},{component:`switch`,label:`Switch (toggle)`,icon:l.ToggleLeft,group:`selecao`},{component:`slider`,label:`Slider`,icon:l.SlidersHorizontal,group:`range`},{component:`rating`,label:`Avaliação (estrelas)`,icon:l.Star,group:`range`},{component:`color`,label:`Cor`,icon:l.Palette,group:`range`},{component:`date`,label:`Data`,icon:l.Calendar,group:`data`},{component:`datetime`,label:`Data e hora`,icon:l.Clock,group:`data`},{component:`time`,label:`Horário`,icon:l.Timer,group:`data`},{component:`date_range`,label:`Período`,icon:l.CalendarRange,group:`data`},{component:`telefone`,label:`Telefone`,icon:l.Phone,group:`contato`},{component:`cpf`,label:`CPF`,icon:l.CreditCard,group:`contato`},{component:`cep`,label:`CEP`,icon:l.MapPin,group:`contato`},{component:`file`,label:`Arquivo`,icon:l.Upload,group:`outros`},{component:`hidden`,label:`Oculto`,icon:l.EyeOff,group:`outros`},{component:`field_array`,label:`Lista de itens`,icon:l.List,group:`outros`},{component:`terms`,label:`Termos e condições`,icon:l.ScrollText,group:`outros`},{component:`sub_form`,label:`Sub-formulário`,icon:l.LayoutList,group:`outros`}],v=[{component:`step`,label:`Step`,icon:l.Layers,color:`border-primary/40 bg-primary/5`},{component:`container`,label:`Container`,icon:l.BoxSelect,color:`border-blue-500/40 bg-blue-500/5`}],y=[{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`}],b=e=>e.startsWith(`step-`)||e===`step`?`step`:e.startsWith(`container-`)||e===`container`?`container`:`field`,x=e=>_.find(t=>t.component===e),S=e=>{let t=_.map(e=>e.component).filter(e=>e.includes(`_`));for(let n of t)if(e.startsWith(n))return _.find(e=>e.component===n);let n=e.split(`-`)[0];return _.find(e=>e.component===n)},C=(0,c.createContext)(null),w=e=>{if(e.startsWith(`step`))return`step`;if(e.startsWith(`container`))return`container`;let t=e.match(/^([a-z_]+)-/);return t?t[1]:e.split(`-`)[0]},T=(e,t)=>{let n=t||w(e),r=n===`step`,i=n===`container`,a=n===`field_array`;return{label:r?`Novo Step`:i?`Novo Container`:a?`Lista de itens`:n||e,name:e,fieldType:n||`texto`,required:!1,columns:2,tamanho:i||a?12:r?void 0:6,showLabel:i?!0:void 0,itemLabel:a?`Item`:void 0}},E=50,D=e=>({containers:JSON.parse(JSON.stringify(e.containers)),configs:JSON.parse(JSON.stringify(e.configs))}),O=(e,t)=>{let n=[e],r=t[e];if(r?.children)for(let e of r.children)n.push(...O(e,t));return n},k=(e,t)=>{for(let[n,r]of Object.entries(t))if(r.children.includes(e))return n;return null},A=({children:e,initialConfigs:t,initialContainers:n,initialTemplateId:r,schemaId:i,uploadTermsPdf:a})=>{let[o,s]=(0,c.useState)({selectedId:null,configs:t||{},showPreview:!1,containers:n??{root:{children:[]}},previewTemplateId:r||`moderno`}),[l,f]=(0,c.useState)(null),[p,m]=(0,c.useState)(null),h=(0,c.useRef)([]),g=(0,c.useRef)([]),_=e=>{h.current=[...h.current.slice(-E+1),D(e)],g.current=[]},v=(0,c.useCallback)(()=>{s(e=>(_(e),{...e}))},[]),y=(0,c.useCallback)(()=>{h.current.length!==0&&s(e=>{g.current=[...g.current,D(e)];let t=h.current.pop();return{...e,containers:t.containers,configs:t.configs}})},[]),x=(0,c.useCallback)(()=>{g.current.length!==0&&s(e=>{h.current=[...h.current,D(e)];let t=g.current.pop();return{...e,containers:t.containers,configs:t.configs}})},[]);(0,c.useEffect)(()=>{let e=e=>{let t=e.metaKey||e.ctrlKey;t&&e.key===`z`&&!e.shiftKey&&(e.preventDefault(),y()),t&&e.key===`z`&&e.shiftKey&&(e.preventDefault(),x()),t&&e.key===`y`&&(e.preventDefault(),x())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[y,x]);let S=(0,c.useCallback)(e=>o.configs[e]??T(e),[o.configs]),w=(0,c.useCallback)(()=>{let e=[],t=n=>{let r=o.containers[n]?.children??[];for(let n of r)b(n)===`field`?e.push(n):o.containers[n]&&t(n)};return t(`root`),e},[o.containers]),A=(0,c.useCallback)(e=>{s(t=>({...t,selectedId:e}))},[]),j=(0,c.useCallback)(e=>{s(t=>({...t,showPreview:e}))},[]),M=(0,c.useCallback)(e=>{s(t=>({...t,previewTemplateId:e}))},[]),N=(0,c.useCallback)((e,t)=>{s(n=>({...n,configs:{...n.configs,[e]:{...n.configs[e]??T(e),...t}}}))},[]),P=(0,c.useCallback)((e,t,n)=>{let r=`${e}-${(0,u.v4Fallback)()}`,i=b(r);return s(a=>{_(a);let o={...a.containers};(i===`step`||i===`container`||e===`field_array`)&&(o[r]={children:[]});let s=[...o[t]?.children??[]];return n!==void 0&&n>=0?s.splice(n,0,r):s.push(r),o[t]={children:s},{...a,containers:o,configs:{...a.configs,[r]:T(r,e)},selectedId:r}}),r},[]),ee=(0,c.useCallback)((e,t)=>{let n=`container-${(0,u.v4Fallback)()}`;return s(r=>{_(r);let i={...r.containers},a={...r.configs},o=[];for(let t of e.containerTemplate.campos){let e=t.locked?t.id:`${String(t.tipo).toLowerCase()}-${(0,u.v4Fallback)()}`;if(o.push(e),a[e]={label:t.label,name:t.locked?t.id:t.nome,fieldType:t.tipo,required:t.obrigatorio||!1,placeholder:t.placeholder,hint:t.hint,tamanho:t.tamanho||6,inicioColuna:t.inicioColuna,defaultValue:t.defaultValue==null?void 0:String(t.defaultValue),locked:t.locked||!1,options:t.opcoes?.map(e=>({value:e.valor,label:e.label})),...t.tipo===`field_array`&&{itemLabel:t.itemLabel,minItems:t.minItems,maxItems:t.maxItems,addLabel:t.addLabel}},t.tipo===`field_array`){let n=[];for(let e of t.subFields??[]){let t=`${String(e.tipo).toLowerCase()}-${(0,u.v4Fallback)()}`;n.push(t),a[t]={label:e.label,name:e.nome,fieldType:e.tipo,required:e.obrigatorio||!1,placeholder:e.placeholder,hint:e.hint,tamanho:e.tamanho||6,inicioColuna:e.inicioColuna,options:e.opcoes?.map(e=>({value:e.valor,label:e.label}))}}i[e]={children:n}}}i[n]={children:o},a[n]={label:e.containerTemplate.titulo||e.name,description:e.containerTemplate.descricao,icone:e.containerTemplate.icone,tamanho:e.containerTemplate.tamanho||12,inicioColuna:e.containerTemplate.inicioColuna,showLabel:!0};let s=[...i[t]?.children??[]];return s.push(n),i[t]={children:s},{...r,containers:i,configs:a,selectedId:n}}),n},[]),F=(0,c.useCallback)(e=>{let t=[];return s(n=>{_(n);let r={...n.containers},i={...n.configs};for(let n of e.steps){let e=`step-${(0,u.v4Fallback)()}`;t.push(e);let a=[];for(let e of n.containers){let t=`container-${(0,u.v4Fallback)()}`;a.push(t);let n=[];for(let t of e.campos){let e=t.locked?t.id:`${String(t.tipo).toLowerCase()}-${(0,u.v4Fallback)()}`;if(n.push(e),i[e]={label:t.label,name:t.locked?t.id:t.nome,fieldType:t.tipo,required:t.obrigatorio||!1,placeholder:t.placeholder,hint:t.hint,tamanho:t.tamanho||12,inicioColuna:t.inicioColuna,defaultValue:t.defaultValue==null?void 0:String(t.defaultValue),locked:t.locked||!1,options:t.opcoes?.map(e=>({value:e.valor,label:e.label})),...t.tipo===`field_array`&&{itemLabel:t.itemLabel,minItems:t.minItems,maxItems:t.maxItems,addLabel:t.addLabel}},t.tipo===`field_array`){let n=[];for(let e of t.subFields??[]){let t=`${String(e.tipo).toLowerCase()}-${(0,u.v4Fallback)()}`;n.push(t),i[t]={label:e.label,name:e.nome,fieldType:e.tipo,required:e.obrigatorio||!1,placeholder:e.placeholder,hint:e.hint,tamanho:e.tamanho||6,inicioColuna:e.inicioColuna,options:e.opcoes?.map(e=>({value:e.valor,label:e.label}))}}r[e]={children:n}}}r[t]={children:n},i[t]={label:e.titulo,description:e.descricao,icone:e.icone,tamanho:e.tamanho||12,showLabel:!0}}r[e]={children:a},i[e]={label:n.titulo,description:n.descricao,icone:n.icone},r.root={children:[...r.root?.children??[],e]}}return{...n,containers:r,configs:i,selectedId:t[0]??n.selectedId}}),t},[]),I=(0,c.useCallback)((e,t,n,r)=>{s(i=>{_(i);let a={...i.containers};a[t]={children:(a[t]?.children??[]).filter(t=>t!==e)};let o=[...(a[n]?.children??[]).filter(t=>t!==e)],s=Math.max(0,Math.min(r,o.length));return o.splice(s,0,e),a[n]={children:o},{...i,containers:a}})},[]),te=(0,c.useCallback)((e,t)=>{s(n=>({...n,containers:{...n.containers,[e]:{children:t}}}))},[]),ne=(0,c.useCallback)(e=>{s(t=>{_(t);let n=O(e,t.containers),r={};for(let[i,a]of Object.entries(t.containers))n.includes(i)||(r[i]={children:a.children.filter(t=>t!==e)});let i={...t.configs};for(let e of n)delete i[e];return{...t,containers:r,configs:i,selectedId:n.includes(t.selectedId??``)?null:t.selectedId}})},[]),re=(0,c.useCallback)((e,t)=>{s(n=>{let r=k(e,n.containers);if(!r)return n;let i=[...n.containers[r].children],a=i.indexOf(e),o=t===`up`?a-1:a+1;return o<0||o>=i.length?n:([i[a],i[o]]=[i[o],i[a]],{...n,containers:{...n.containers,[r]:{children:i}}})})},[]),L=(0,c.useCallback)((e,t)=>{v(),re(e,t)},[re,v]);return(0,d.jsx)(C.Provider,{value:{selectedId:o.selectedId,configs:o.configs,showPreview:o.showPreview,containers:o.containers,positionDrag:l,reorderDrag:p,canUndo:h.current.length>0,canRedo:g.current.length>0,schemaId:i,uploadTermsPdf:a,previewTemplateId:o.previewTemplateId,setPreviewTemplateId:M,getConfig:S,getAllFieldIds:w,setSelected:A,updateConfig:N,setShowPreview:j,addItem:P,addPresetBlock:ee,addPresetStepBlock:F,moveCanvasItem:I,reorderInContainer:te,removeItem:ne,moveItem:L,moveItemNoSnapshot:re,setPositionDrag:f,setReorderDrag:m,undo:y,redo:x,pushSnapshot:v},children:e})},j=()=>{let e=(0,c.useContext)(C);if(!e)throw Error(`useBuilder must be inside BuilderProvider`);return e};function M(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function N(...e){return t=>{let n=!1,r=e.map(e=>{let r=M(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():M(e[t],null)}}}}function P(...e){return c.useCallback(N(...e),e)}var ee=Symbol.for(`react.lazy`),F=c.use;function I(e){return typeof e==`object`&&!!e&&`then`in e}function te(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===ee&&`_payload`in e&&I(e._payload)}function ne(e){let t=L(e),n=c.forwardRef((e,n)=>{let{children:r,...i}=e;te(r)&&typeof F==`function`&&(r=F(r._payload));let a=c.Children.toArray(r),o=a.find(ie);if(o){let e=o.props.children,r=a.map(t=>t===o?c.Children.count(e)>1?c.Children.only(null):c.isValidElement(e)?e.props.children:null:t);return(0,d.jsx)(t,{...i,ref:n,children:c.isValidElement(e)?c.cloneElement(e,void 0,r):null})}return(0,d.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var re=ne(`Slot`);function L(e){let t=c.forwardRef((e,t)=>{let{children:n,...r}=e;if(te(n)&&typeof F==`function`&&(n=F(n._payload)),c.isValidElement(n)){let e=z(n),i=ae(r,n.props);return n.type!==c.Fragment&&(i.ref=t?N(t,e):e),c.cloneElement(n,i)}return c.Children.count(n)>1?c.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var R=Symbol(`radix.slottable`);function ie(e){return c.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===R}function ae(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function z(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var oe=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ne(`Primitive.${t}`),r=c.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,d.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),se=`Separator`,ce=`horizontal`,le=[`horizontal`,`vertical`],ue=c.forwardRef((e,t)=>{let{decorative:n,orientation:r=ce,...i}=e,a=de(r)?r:ce,o=a===`vertical`?a:void 0,s=n?{role:`none`}:{"aria-orientation":o,role:`separator`};return(0,d.jsx)(oe.div,{"data-orientation":a,...s,...i,ref:t})});ue.displayName=se;function de(e){return le.includes(e)}var fe=ue;function pe(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=pe(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function me(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=pe(e))&&(r&&(r+=` `),r+=t);return r}var he=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ge=(e,t)=>({classGroupId:e,validator:t}),_e=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ve=`-`,ye=[],be=`arbitrary..`,xe=e=>{let t=we(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Ce(e);let n=e.split(ve);return Se(n,n[0]===``&&n.length>1?1:0,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?he(i,t):t:i||ye}return n[e]||ye}}},Se=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Se(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(ve):e.slice(t).join(ve),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Ce=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?be+r:void 0})(),we=e=>{let{theme:t,classGroups:n}=e;return Te(n,t)},Te=(e,t)=>{let n=_e();for(let r in e){let i=e[r];Ee(i,n,r,t)}return n},Ee=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];De(i,t,n,r)}},De=(e,t,n,r)=>{if(typeof e==`string`){Oe(e,t,n);return}if(typeof e==`function`){ke(e,t,n,r);return}Ae(e,t,n,r)},Oe=(e,t,n)=>{let r=e===``?t:je(t,e);r.classGroupId=n},ke=(e,t,n,r)=>{if(Me(e)){Ee(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ge(n,e))},Ae=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Ee(o,je(t,a),n,r)}},je=(e,t)=>{let n=e,r=t.split(ve),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=_e(),n.nextPart.set(t,i)),n=i}return n},Me=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Ne=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Pe=`!`,Fe=`:`,Ie=[],Le=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Re=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===Fe){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Pe)?(c=s.slice(0,-1),l=!0):s.startsWith(Pe)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Le(t,l,c,u)};if(t){let e=t+Fe,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Le(Ie,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},ze=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Be=e=>({cache:Ne(e.cacheSize),parseClassName:Re(e),sortModifiers:ze(e),...xe(e)}),Ve=/\s+/,He=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Ve),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Pe:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Ue=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=We(n))&&(i&&(i+=` `),i+=r);return i},We=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=We(e[r]))&&(n&&(n+=` `),n+=t);return n},Ge=(e,...t)=>{let n,r,i,a,o=o=>(n=Be(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=He(e,n);return i(e,a),a};return a=o,(...e)=>a(Ue(...e))},Ke=[],B=e=>{let t=t=>t[e]||Ke;return t.isThemeGetter=!0,t},qe=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Je=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ye=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Xe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ze=/\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$/,Qe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$e=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,et=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,tt=e=>Ye.test(e),V=e=>!!e&&!Number.isNaN(Number(e)),nt=e=>!!e&&Number.isInteger(Number(e)),rt=e=>e.endsWith(`%`)&&V(e.slice(0,-1)),it=e=>Xe.test(e),at=()=>!0,ot=e=>Ze.test(e)&&!Qe.test(e),st=()=>!1,ct=e=>$e.test(e),lt=e=>et.test(e),ut=e=>!H(e)&&!U(e),dt=e=>Et(e,At,st),H=e=>qe.test(e),ft=e=>Et(e,jt,ot),pt=e=>Et(e,Mt,V),mt=e=>Et(e,Pt,at),ht=e=>Et(e,Nt,st),gt=e=>Et(e,Ot,st),_t=e=>Et(e,kt,lt),vt=e=>Et(e,Ft,ct),U=e=>Je.test(e),yt=e=>Dt(e,jt),bt=e=>Dt(e,Nt),xt=e=>Dt(e,Ot),St=e=>Dt(e,At),Ct=e=>Dt(e,kt),wt=e=>Dt(e,Ft,!0),Tt=e=>Dt(e,Pt,!0),Et=(e,t,n)=>{let r=qe.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Dt=(e,t,n=!1)=>{let r=Je.exec(e);return r?r[1]?t(r[1]):n:!1},Ot=e=>e===`position`||e===`percentage`,kt=e=>e===`image`||e===`url`,At=e=>e===`length`||e===`size`||e===`bg-size`,jt=e=>e===`length`,Mt=e=>e===`number`,Nt=e=>e===`family-name`,Pt=e=>e===`number`||e===`weight`,Ft=e=>e===`shadow`,It=Ge(()=>{let e=B(`color`),t=B(`font`),n=B(`text`),r=B(`font-weight`),i=B(`tracking`),a=B(`leading`),o=B(`breakpoint`),s=B(`container`),c=B(`spacing`),l=B(`radius`),u=B(`shadow`),d=B(`inset-shadow`),f=B(`text-shadow`),p=B(`drop-shadow`),m=B(`blur`),h=B(`perspective`),g=B(`aspect`),_=B(`ease`),v=B(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),U,H],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[U,H,c],T=()=>[tt,`full`,`auto`,...w()],E=()=>[nt,`none`,`subgrid`,U,H],D=()=>[`auto`,{span:[`full`,nt,U,H]},nt,U,H],O=()=>[nt,`auto`,U,H],k=()=>[`auto`,`min`,`max`,`fr`,U,H],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[tt,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[tt,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ee=()=>[tt,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],F=()=>[e,U,H],I=()=>[...b(),xt,gt,{position:[U,H]}],te=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ne=()=>[`auto`,`cover`,`contain`,St,dt,{size:[U,H]}],re=()=>[rt,yt,ft],L=()=>[``,`none`,`full`,l,U,H],R=()=>[``,V,yt,ft],ie=()=>[`solid`,`dashed`,`dotted`,`double`],ae=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],z=()=>[V,rt,xt,gt],oe=()=>[``,`none`,m,U,H],se=()=>[`none`,V,U,H],ce=()=>[`none`,V,U,H],le=()=>[V,U,H],ue=()=>[tt,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[it],breakpoint:[it],color:[at],container:[it],"drop-shadow":[it],ease:[`in`,`out`,`in-out`],font:[ut],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[it],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[it],shadow:[it],spacing:[`px`,V],text:[it],"text-shadow":[it],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,tt,H,U,g]}],container:[`container`],columns:[{columns:[V,H,U,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[nt,`auto`,U,H]}],basis:[{basis:[tt,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[V,tt,`auto`,`initial`,`none`,H]}],grow:[{grow:[``,V,U,H]}],shrink:[{shrink:[``,V,U,H]}],order:[{order:[nt,`first`,`last`,`none`,U,H]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...ee()]}],"min-block-size":[{"min-block":[`auto`,...ee()]}],"max-block-size":[{"max-block":[`none`,...ee()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,yt,ft]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Tt,mt]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,rt,H]}],"font-family":[{font:[bt,ht,t]}],"font-features":[{"font-features":[H]}],"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:[i,U,H]}],"line-clamp":[{"line-clamp":[V,`none`,U,pt]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,U,H]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,U,H]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ie(),`wavy`]}],"text-decoration-thickness":[{decoration:[V,`from-font`,`auto`,U,ft]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[V,`auto`,U,H]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,U,H]}],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`,U,H]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},nt,U,H],radial:[``,U,H],conic:[nt,U,H]},Ct,_t]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:R()}],"border-w-x":[{"border-x":R()}],"border-w-y":[{"border-y":R()}],"border-w-s":[{"border-s":R()}],"border-w-e":[{"border-e":R()}],"border-w-bs":[{"border-bs":R()}],"border-w-be":[{"border-be":R()}],"border-w-t":[{"border-t":R()}],"border-w-r":[{"border-r":R()}],"border-w-b":[{"border-b":R()}],"border-w-l":[{"border-l":R()}],"divide-x":[{"divide-x":R()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":R()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ie(),`hidden`,`none`]}],"divide-style":[{divide:[...ie(),`hidden`,`none`]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...ie(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[V,U,H]}],"outline-w":[{outline:[``,V,yt,ft]}],"outline-color":[{outline:F()}],shadow:[{shadow:[``,`none`,u,wt,vt]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":[`none`,d,wt,vt]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:R()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[V,ft]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":[`none`,f,wt,vt]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[V,U,H]}],"mix-blend":[{"mix-blend":[...ae(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ae()}],"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":[V]}],"mask-image-linear-from-pos":[{"mask-linear-from":z()}],"mask-image-linear-to-pos":[{"mask-linear-to":z()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":z()}],"mask-image-t-to-pos":[{"mask-t-to":z()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":z()}],"mask-image-r-to-pos":[{"mask-r-to":z()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":z()}],"mask-image-b-to-pos":[{"mask-b-to":z()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":z()}],"mask-image-l-to-pos":[{"mask-l-to":z()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":z()}],"mask-image-x-to-pos":[{"mask-x-to":z()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":z()}],"mask-image-y-to-pos":[{"mask-y-to":z()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[U,H]}],"mask-image-radial-from-pos":[{"mask-radial-from":z()}],"mask-image-radial-to-pos":[{"mask-radial-to":z()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"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":b()}],"mask-image-conic-pos":[{"mask-conic":[V]}],"mask-image-conic-from-pos":[{"mask-conic-from":z()}],"mask-image-conic-to-pos":[{"mask-conic-to":z()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,U,H]}],filter:[{filter:[``,`none`,U,H]}],blur:[{blur:oe()}],brightness:[{brightness:[V,U,H]}],contrast:[{contrast:[V,U,H]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,wt,vt]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:[``,V,U,H]}],"hue-rotate":[{"hue-rotate":[V,U,H]}],invert:[{invert:[``,V,U,H]}],saturate:[{saturate:[V,U,H]}],sepia:[{sepia:[``,V,U,H]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,U,H]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[V,U,H]}],"backdrop-contrast":[{"backdrop-contrast":[V,U,H]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,V,U,H]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[V,U,H]}],"backdrop-invert":[{"backdrop-invert":[``,V,U,H]}],"backdrop-opacity":[{"backdrop-opacity":[V,U,H]}],"backdrop-saturate":[{"backdrop-saturate":[V,U,H]}],"backdrop-sepia":[{"backdrop-sepia":[``,V,U,H]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,U,H]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[V,`initial`,U,H]}],ease:[{ease:[`linear`,`initial`,_,U,H]}],delay:[{delay:[V,U,H]}],animate:[{animate:[`none`,v,U,H]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,U,H]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:se()}],"rotate-x":[{"rotate-x":se()}],"rotate-y":[{"rotate-y":se()}],"rotate-z":[{"rotate-z":se()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":[`scale-3d`],skew:[{skew:le()}],"skew-x":[{"skew-x":le()}],"skew-y":[{"skew-y":le()}],transform:[{transform:[U,H,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ue()}],"translate-x":[{"translate-x":ue()}],"translate-y":[{"translate-y":ue()}],"translate-z":[{"translate-z":ue()}],"translate-none":[`translate-none`],accent:[{accent:F()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:F()}],"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`,U,H]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,U,H]}],fill:[{fill:[`none`,...F()]}],"stroke-w":[{stroke:[V,yt,ft,pt]}],stroke:[{stroke:[`none`,...F()]}],"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`]}});function W(...e){return It(me(e))}var Lt=c.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,d.jsx)(fe,{ref:i,decorative:n,orientation:t,className:W(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));Lt.displayName=fe.displayName;var G=c.forwardRef(({className:e,type:t,...n},r)=>(0,d.jsx)(`input`,{type:t,className:W(`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:r,...n}));G.displayName=`Input`;var Rt=`Label`,zt=c.forwardRef((e,t)=>(0,d.jsx)(oe.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));zt.displayName=Rt;var Bt=zt,Vt=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Ht=me,Ut=(e,t)=>n=>{if(t?.variants==null)return Ht(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Vt(t)||Vt(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Ht(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Wt=Ut(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),K=c.forwardRef(({className:e,...t},n)=>(0,d.jsx)(Bt,{ref:n,className:W(Wt(),e),...t}));K.displayName=Bt.displayName;function Gt(e,t){let n=c.createContext(t),r=e=>{let{children:t,...r}=e,i=c.useMemo(()=>r,Object.values(r));return(0,d.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=c.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Kt(e,t=[]){let n=[];function r(t,r){let i=c.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,l=c.useMemo(()=>o,Object.values(o));return(0,d.jsx)(s.Provider,{value:l,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,l=c.useContext(s);if(l)return l;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>c.createContext(e));return function(n){let r=n?.[e]||t;return c.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,qt(i,...t)]}function qt(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}typeof window<`u`&&window.document&&window.document.createElement;function q(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var J=globalThis?.document?c.useLayoutEffect:()=>{},Jt=c.useInsertionEffect||J;function Yt({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Xt({defaultProp:t,onChange:n}),s=e!==void 0,l=s?e:i;{let t=c.useRef(e!==void 0);c.useEffect(()=>{let e=t.current;if(e!==s){let t=e?`controlled`:`uncontrolled`,n=s?`controlled`:`uncontrolled`;console.warn(`${r} is changing from ${t} to ${n}. 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.`)}t.current=s},[s,r])}return[l,c.useCallback(t=>{if(s){let n=Zt(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Xt({defaultProp:e,onChange:t}){let[n,r]=c.useState(e),i=c.useRef(n),a=c.useRef(t);return Jt(()=>{a.current=t},[t]),c.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Zt(e){return typeof e==`function`}function Qt(e){let t=c.useRef({value:e,previous:e});return c.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function $t(e){let[t,n]=c.useState(void 0);return J(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}function en(e,t){return c.useReducer((e,n)=>t[e][n]??e,e)}var tn=e=>{let{present:t,children:n}=e,r=nn(t),i=typeof n==`function`?n({present:r.isPresent}):c.Children.only(n),a=P(r.ref,an(i));return typeof n==`function`||r.isPresent?c.cloneElement(i,{ref:a}):null};tn.displayName=`Presence`;function nn(e){let[t,n]=c.useState(),r=c.useRef(null),i=c.useRef(e),a=c.useRef(`none`),[o,s]=en(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return c.useEffect(()=>{let e=rn(r.current);a.current=o===`mounted`?e:`none`},[o]),J(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=rn(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),J(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=rn(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=rn(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:c.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function rn(e){return e?.animationName||`none`}function an(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function on(e){let t=sn(e),n=c.forwardRef((e,n)=>{let{children:r,...i}=e,a=c.Children.toArray(r),o=a.find(un);if(o){let e=o.props.children,r=a.map(t=>t===o?c.Children.count(e)>1?c.Children.only(null):c.isValidElement(e)?e.props.children:null:t);return(0,d.jsx)(t,{...i,ref:n,children:c.isValidElement(e)?c.cloneElement(e,void 0,r):null})}return(0,d.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function sn(e){let t=c.forwardRef((e,t)=>{let{children:n,...r}=e;if(c.isValidElement(n)){let e=fn(n),i=dn(r,n.props);return n.type!==c.Fragment&&(i.ref=t?N(t,e):e),c.cloneElement(n,i)}return c.Children.count(n)>1?c.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var cn=Symbol(`radix.slottable`);function ln(e){let t=({children:e})=>(0,d.jsx)(d.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=cn,t}function un(e){return c.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===cn}function dn(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function fn(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Y=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=on(`Primitive.${t}`),r=c.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,d.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function pn(e,t){e&&f.flushSync(()=>e.dispatchEvent(t))}var mn=`Checkbox`,[hn,gn]=Kt(mn),[_n,vn]=hn(mn);function yn(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:l,required:u,value:f=`on`,internal_do_not_use_render:p}=e,[m,h]=Yt({prop:n,defaultProp:i??!1,onChange:l,caller:mn}),[g,_]=c.useState(null),[v,y]=c.useState(null),b=c.useRef(!1),x=g?!!o||!!g.closest(`form`):!0,S={checked:m,disabled:a,setChecked:h,control:g,setControl:_,name:s,form:o,value:f,hasConsumerStoppedPropagationRef:b,required:u,defaultChecked:On(i)?!1:i,isFormControl:x,bubbleInput:v,setBubbleInput:y};return(0,d.jsx)(_n,{scope:t,...S,children:Dn(p)?p(S):r})}var bn=`CheckboxTrigger`,xn=c.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:l,required:u,setControl:f,setChecked:p,hasConsumerStoppedPropagationRef:m,isFormControl:h,bubbleInput:g}=vn(bn,e),_=P(i,f),v=c.useRef(l);return c.useEffect(()=>{let e=a?.form;if(e){let t=()=>p(v.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,p]),(0,d.jsx)(Y.button,{type:`button`,role:`checkbox`,"aria-checked":On(l)?`mixed`:l,"aria-required":u,"data-state":kn(l),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:_,onKeyDown:q(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:q(n,e=>{p(e=>On(e)?!0:!e),g&&h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})})});xn.displayName=bn;var Sn=c.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...f}=e;return(0,d.jsx)(yn,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(xn,{...f,ref:t,__scopeCheckbox:n}),e&&(0,d.jsx)(En,{__scopeCheckbox:n})]})})});Sn.displayName=mn;var Cn=`CheckboxIndicator`,wn=c.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=vn(Cn,n);return(0,d.jsx)(tn,{present:r||On(a.checked)||a.checked===!0,children:(0,d.jsx)(Y.span,{"data-state":kn(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});wn.displayName=Cn;var Tn=`CheckboxBubbleInput`,En=c.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:l,name:u,value:f,form:p,bubbleInput:m,setBubbleInput:h}=vn(Tn,e),g=P(n,h),_=Qt(a),v=$t(r);c.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(_!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=On(a),n.call(e,On(a)?!1:a),e.dispatchEvent(t)}},[m,_,a,i]);let y=c.useRef(On(a)?!1:a);return(0,d.jsx)(Y.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??y.current,required:s,disabled:l,name:u,value:f,form:p,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});En.displayName=Tn;function Dn(e){return typeof e==`function`}function On(e){return e===`indeterminate`}function kn(e){return On(e)?`indeterminate`:e?`checked`:`unchecked`}var X=c.forwardRef(({className:e,...t},n)=>(0,d.jsx)(Sn,{ref:n,className:W(`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:(0,d.jsx)(wn,{className:W(`flex items-center justify-center text-current`),children:(0,d.jsx)(l.Check,{className:`h-4 w-4`})})}));X.displayName=Sn.displayName;var An=Ut(`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`}}),Z=c.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,d.jsx)(r?re:`button`,{className:W(An({variant:t,size:n,className:e})),ref:a,...i}));Z.displayName=`Button`;function Q(e){let t=c.useRef(e);return c.useEffect(()=>{t.current=e}),c.useMemo(()=>(...e)=>t.current?.(...e),[])}var jn=c.createContext(void 0);function Mn(e){let t=c.useContext(jn);return e||t||`ltr`}function Nn(e,[t,n]){return Math.min(n,Math.max(t,e))}function Pn(e,t){return c.useReducer((e,n)=>t[e][n]??e,e)}var Fn=`ScrollArea`,[In,Ln]=Kt(Fn),[Rn,zn]=In(Fn),Bn=c.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,l]=c.useState(null),[u,f]=c.useState(null),[p,m]=c.useState(null),[h,g]=c.useState(null),[_,v]=c.useState(null),[y,b]=c.useState(0),[x,S]=c.useState(0),[C,w]=c.useState(!1),[T,E]=c.useState(!1),D=P(t,e=>l(e)),O=Mn(i);return(0,d.jsx)(Rn,{scope:n,type:r,dir:O,scrollHideDelay:a,scrollArea:s,viewport:u,onViewportChange:f,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:w,scrollbarY:_,onScrollbarYChange:v,scrollbarYEnabled:T,onScrollbarYEnabledChange:E,onCornerWidthChange:b,onCornerHeightChange:S,children:(0,d.jsx)(Y.div,{dir:O,...o,ref:D,style:{position:`relative`,"--radix-scroll-area-corner-width":y+`px`,"--radix-scroll-area-corner-height":x+`px`,...e.style}})})});Bn.displayName=Fn;var Vn=`ScrollAreaViewport`,Hn=c.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=zn(Vn,n),s=P(t,c.useRef(null),o.onViewportChange);return(0,d.jsxs)(d.Fragment,{children:[(0,d.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:i}),(0,d.jsx)(Y.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,d.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});Hn.displayName=Vn;var Un=`ScrollAreaScrollbar`,Wn=c.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=zn(Un,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return c.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,d.jsx)(Gn,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,d.jsx)(Kn,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,d.jsx)(qn,{...r,ref:t,forceMount:n}):i.type===`always`?(0,d.jsx)(Jn,{...r,ref:t}):null});Wn.displayName=Un;var Gn=c.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=zn(Un,e.__scopeScrollArea),[a,o]=c.useState(!1);return c.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,d.jsx)(tn,{present:n||a,children:(0,d.jsx)(qn,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),Kn=c.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=zn(Un,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=mr(()=>l(`SCROLL_END`),100),[s,l]=Pn(`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 c.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>l(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,l]),c.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(l(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,l,o]),(0,d.jsx)(tn,{present:n||s!==`hidden`,children:(0,d.jsx)(Jn,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:q(e.onPointerEnter,()=>l(`POINTER_ENTER`)),onPointerLeave:q(e.onPointerLeave,()=>l(`POINTER_LEAVE`))})})}),qn=c.forwardRef((e,t)=>{let n=zn(Un,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=c.useState(!1),s=e.orientation===`horizontal`,l=mr(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return hr(n.viewport,l),hr(n.content,l),(0,d.jsx)(tn,{present:r||a,children:(0,d.jsx)(Jn,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),Jn=c.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=zn(Un,e.__scopeScrollArea),a=c.useRef(null),o=c.useRef(0),[s,l]=c.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=sr(s.viewport,s.content),f={...r,sizes:s,onSizesChange:l,hasThumb:u>0&&u<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function p(e,t){return lr(e,o.current,s,t)}return n===`horizontal`?(0,d.jsx)(Yn,{...f,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=ur(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=p(e,i.dir))}}):n===`vertical`?(0,d.jsx)(Xn,{...f,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=ur(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=p(e))}}):null}),Yn=c.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=zn(Un,e.__scopeScrollArea),[o,s]=c.useState(),l=c.useRef(null),u=P(t,l,a.onScrollbarXChange);return c.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),(0,d.jsx)($n,{"data-orientation":`horizontal`,...i,ref:u,sizes:n,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":cr(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),fr(r,n)&&t.preventDefault()}},onResize:()=>{l.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:or(o.paddingLeft),paddingEnd:or(o.paddingRight)}})}})}),Xn=c.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=zn(Un,e.__scopeScrollArea),[o,s]=c.useState(),l=c.useRef(null),u=P(t,l,a.onScrollbarYChange);return c.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),(0,d.jsx)($n,{"data-orientation":`vertical`,...i,ref:u,sizes:n,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":cr(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),fr(r,n)&&t.preventDefault()}},onResize:()=>{l.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:or(o.paddingTop),paddingEnd:or(o.paddingBottom)}})}})}),[Zn,Qn]=In(Un),$n=c.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:f,onResize:p,...m}=e,h=zn(Un,n),[g,_]=c.useState(null),v=P(t,e=>_(e)),y=c.useRef(null),b=c.useRef(``),x=h.viewport,S=r.content-r.viewport,C=Q(f),w=Q(l),T=mr(p,10);function E(e){y.current&&u({x:e.clientX-y.current.left,y:e.clientY-y.current.top})}return c.useEffect(()=>{let e=e=>{let t=e.target;g?.contains(t)&&C(e,S)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[x,g,S,C]),c.useEffect(w,[r,w]),hr(g,T),hr(h.content,T),(0,d.jsx)(Zn,{scope:n,scrollbar:g,hasThumb:i,onThumbChange:Q(a),onThumbPointerUp:Q(o),onThumbPositionChange:w,onThumbPointerDown:Q(s),children:(0,d.jsx)(Y.div,{...m,ref:v,style:{position:`absolute`,...m.style},onPointerDown:q(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),y.current=g.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,h.viewport&&(h.viewport.style.scrollBehavior=`auto`),E(e))}),onPointerMove:q(e.onPointerMove,E),onPointerUp:q(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=b.current,h.viewport&&(h.viewport.style.scrollBehavior=``),y.current=null})})})}),er=`ScrollAreaThumb`,tr=c.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Qn(er,e.__scopeScrollArea);return(0,d.jsx)(tn,{present:n||i.hasThumb,children:(0,d.jsx)(nr,{ref:t,...r})})}),nr=c.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=zn(er,n),o=Qn(er,n),{onThumbPositionChange:s}=o,l=P(t,e=>o.onThumbChange(e)),u=c.useRef(void 0),f=mr(()=>{u.current&&=(u.current(),void 0)},100);return c.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{f(),u.current||(u.current=pr(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,f,s]),(0,d.jsx)(Y.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:l,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:q(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:q(e.onPointerUp,o.onThumbPointerUp)})});tr.displayName=er;var rr=`ScrollAreaCorner`,ir=c.forwardRef((e,t)=>{let n=zn(rr,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,d.jsx)(ar,{...e,ref:t}):null});ir.displayName=rr;var ar=c.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=zn(rr,n),[a,o]=c.useState(0),[s,l]=c.useState(0),u=!!(a&&s);return hr(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),l(e)}),hr(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),u?(0,d.jsx)(Y.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function or(e){return e?parseInt(e,10):0}function sr(e,t){let n=e/t;return isNaN(n)?0:n}function cr(e){let t=sr(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function lr(e,t,n,r=`ltr`){let i=cr(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return dr([c,l],d)(e)}function ur(e,t,n=`ltr`){let r=cr(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=Nn(e,n===`ltr`?[0,o]:[o*-1,0]);return dr([0,o],[0,s])(c)}function dr(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function fr(e,t){return e>0&&e<t}var pr=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function mr(e,t){let n=Q(e),r=c.useRef(0);return c.useEffect(()=>()=>window.clearTimeout(r.current),[]),c.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function hr(e,t){let n=Q(t);J(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var gr=Bn,_r=Hn,vr=ir,yr=c.forwardRef(({className:e,children:t,...n},r)=>(0,d.jsxs)(gr,{ref:r,className:W(`relative overflow-hidden`,e),...n,children:[(0,d.jsx)(_r,{className:`h-full w-full rounded-[inherit]`,children:t}),(0,d.jsx)(br,{}),(0,d.jsx)(vr,{})]}));yr.displayName=gr.displayName;var br=c.forwardRef(({className:e,orientation:t=`vertical`,...n},r)=>(0,d.jsx)(Wn,{ref:r,orientation:t,className:W(`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),...n,children:(0,d.jsx)(tr,{className:`relative flex-1 rounded-full bg-border`})}));br.displayName=Wn.displayName;var xr=c.useId||(()=>void 0),Sr=0;function Cr(e){let[t,n]=c.useState(xr());return J(()=>{e||n(e=>e??String(Sr++))},[e]),e||(t?`radix-${t}`:``)}function wr(e,t=globalThis?.document){let n=Q(e);c.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Tr=`DismissableLayer`,Er=`dismissableLayer.update`,Dr=`dismissableLayer.pointerDownOutside`,Or=`dismissableLayer.focusOutside`,kr,Ar=c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),jr=c.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...l}=e,u=c.useContext(Ar),[f,p]=c.useState(null),m=f?.ownerDocument??globalThis?.document,[,h]=c.useState({}),g=P(t,e=>p(e)),_=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=_.indexOf(v),b=f?_.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,C=Pr(e=>{let t=e.target,n=[...u.branches].some(e=>e.contains(t));!S||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},m),w=Fr(e=>{let t=e.target;[...u.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},m);return wr(e=>{b===u.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},m),c.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(kr=m.body.style.pointerEvents,m.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Ir(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=kr)}},[f,m,n,u]),c.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Ir())},[f,u]),c.useEffect(()=>{let e=()=>h({});return document.addEventListener(Er,e),()=>document.removeEventListener(Er,e)},[]),(0,d.jsx)(Y.div,{...l,ref:g,style:{pointerEvents:x?S?`auto`:`none`:void 0,...e.style},onFocusCapture:q(e.onFocusCapture,w.onFocusCapture),onBlurCapture:q(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:q(e.onPointerDownCapture,C.onPointerDownCapture)})});jr.displayName=Tr;var Mr=`DismissableLayerBranch`,Nr=c.forwardRef((e,t)=>{let n=c.useContext(Ar),r=c.useRef(null),i=P(t,r);return c.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,d.jsx)(Y.div,{...e,ref:i})});Nr.displayName=Mr;function Pr(e,t=globalThis?.document){let n=Q(e),r=c.useRef(!1),i=c.useRef(()=>{});return c.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Lr(Dr,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Fr(e,t=globalThis?.document){let n=Q(e),r=c.useRef(!1);return c.useEffect(()=>{let e=e=>{e.target&&!r.current&&Lr(Or,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ir(){let e=new CustomEvent(Er);document.dispatchEvent(e)}function Lr(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?pn(i,a):i.dispatchEvent(a)}var Rr=`focusScope.autoFocusOnMount`,zr=`focusScope.autoFocusOnUnmount`,Br={bubbles:!1,cancelable:!0},Vr=`FocusScope`,Hr=c.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,l]=c.useState(null),u=Q(i),f=Q(a),p=c.useRef(null),m=P(t,e=>l(e)),h=c.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;c.useEffect(()=>{if(r){let e=function(e){if(h.paused||!s)return;let t=e.target;s.contains(t)?p.current=t:Yr(p.current,{select:!0})},t=function(e){if(h.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Yr(p.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Yr(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,h.paused]),c.useEffect(()=>{if(s){Xr.add(h);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Rr,Br);s.addEventListener(Rr,u),s.dispatchEvent(t),t.defaultPrevented||(Ur($r(Gr(s)),{select:!0}),document.activeElement===e&&Yr(s))}return()=>{s.removeEventListener(Rr,u),setTimeout(()=>{let t=new CustomEvent(zr,Br);s.addEventListener(zr,f),s.dispatchEvent(t),t.defaultPrevented||Yr(e??document.body,{select:!0}),s.removeEventListener(zr,f),Xr.remove(h)},0)}}},[s,u,f,h]);let g=c.useCallback(e=>{if(!n&&!r||h.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Wr(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Yr(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Yr(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,h.paused]);return(0,d.jsx)(Y.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});Hr.displayName=Vr;function Ur(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Yr(r,{select:t}),document.activeElement!==n)return}function Wr(e){let t=Gr(e);return[Kr(t,e),Kr(t.reverse(),e)]}function Gr(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Kr(e,t){for(let n of e)if(!qr(n,{upTo:t}))return n}function qr(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 Jr(e){return e instanceof HTMLInputElement&&`select`in e}function Yr(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Jr(e)&&t&&e.select()}}var Xr=Zr();function Zr(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Qr(e,t),e.unshift(t)},remove(t){e=Qr(e,t),e[0]?.resume()}}}function Qr(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function $r(e){return e.filter(e=>e.tagName!==`A`)}var ei=`Portal`,ti=c.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=c.useState(!1);J(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?f.default.createPortal((0,d.jsx)(Y.div,{...r,ref:t}),o):null});ti.displayName=ei;var ni=0;function ri(){c.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??ii()),document.body.insertAdjacentElement(`beforeend`,e[1]??ii()),ni++,()=>{ni===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),ni--}},[])}function ii(){let 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 ai=function(){return ai=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ai.apply(this,arguments)};function oi(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function si(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var ci=`right-scroll-bar-position`,li=`width-before-scroll-bar`,ui=`with-scroll-bars-hidden`,di=`--removed-body-scroll-bar-size`;function fi(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function pi(e,t){var n=(0,c.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var mi=typeof window<`u`?c.useLayoutEffect:c.useEffect,hi=new WeakMap;function gi(e,t){var n=pi(t||null,function(t){return e.forEach(function(e){return fi(e,t)})});return mi(function(){var t=hi.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||fi(e,null)}),i.forEach(function(e){r.has(e)||fi(e,a)})}hi.set(n,e)},[e]),n}function _i(e){return e}function vi(e,t){t===void 0&&(t=_i);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function yi(e){e===void 0&&(e={});var t=vi(null);return t.options=ai({async:!0,ssr:!1},e),t}var bi=function(e){var t=e.sideCar,n=oi(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return c.createElement(r,ai({},n))};bi.isSideCarExport=!0;function xi(e,t){return e.useMedium(t),bi}var Si=yi(),Ci=function(){},wi=c.forwardRef(function(e,t){var n=c.useRef(null),r=c.useState({onScrollCapture:Ci,onWheelCapture:Ci,onTouchMoveCapture:Ci}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,l=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=oi(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=p,C=gi([n,t]),w=ai(ai({},x),i);return c.createElement(c.Fragment,null,d&&c.createElement(S,{sideCar:Si,removeScrollBar:u,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?c.cloneElement(c.Children.only(s),ai(ai({},w),{ref:C})):c.createElement(y,ai({},w,{className:l,ref:C}),s))});wi.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},wi.classNames={fullWidth:li,zeroRight:ci};var Ti,Ei=function(){if(Ti)return Ti;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Di(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Ei();return t&&e.setAttribute(`nonce`,t),e}function Oi(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ki(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Ai=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Di())&&(Oi(t,n),ki(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ji=function(){var e=Ai();return function(t,n){c.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Mi=function(){var e=ji();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Ni={left:0,top:0,right:0,gap:0},Pi=function(e){return parseInt(e||``,10)||0},Fi=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Pi(n),Pi(r),Pi(i)]},Ii=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Ni;var t=Fi(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Li=Mi(),Ri=`data-scroll-locked`,zi=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
- .${ui} {
3
- overflow: hidden ${r};
4
- padding-right: ${s}px ${r};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),_=require("react"),T=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(T),fr=Po(So),at=[{component:"texto",label:"Texto",icon:T.Type,group:"texto"},{component:"textarea",label:"Área de texto",icon:T.AlignLeft,group:"texto"},{component:"number",label:"Número",icon:T.Hash,group:"texto"},{component:"email",label:"E-mail",icon:T.Mail,group:"texto"},{component:"password",label:"Senha",icon:T.Lock,group:"texto"},{component:"select",label:"Seleção",icon:T.ChevronDown,group:"selecao"},{component:"autocomplete",label:"Autocomplete",icon:T.Search,group:"selecao"},{component:"radio",label:"Radio",icon:T.CircleDot,group:"selecao"},{component:"checkbox",label:"Checkbox",icon:T.CheckSquare,group:"selecao"},{component:"checkbox_group",label:"Grupo de checkboxes",icon:T.ListChecks,group:"selecao"},{component:"switch",label:"Switch (toggle)",icon:T.ToggleLeft,group:"selecao"},{component:"slider",label:"Slider",icon:T.SlidersHorizontal,group:"range"},{component:"rating",label:"Avaliação (estrelas)",icon:T.Star,group:"range"},{component:"color",label:"Cor",icon:T.Palette,group:"range"},{component:"date",label:"Data",icon:T.Calendar,group:"data"},{component:"datetime",label:"Data e hora",icon:T.Clock,group:"data"},{component:"time",label:"Horário",icon:T.Timer,group:"data"},{component:"date_range",label:"Período",icon:T.CalendarRange,group:"data"},{component:"telefone",label:"Telefone",icon:T.Phone,group:"contato"},{component:"cpf",label:"CPF",icon:T.CreditCard,group:"contato"},{component:"cep",label:"CEP",icon:T.MapPin,group:"contato"},{component:"file",label:"Arquivo",icon:T.Upload,group:"outros"},{component:"hidden",label:"Oculto",icon:T.EyeOff,group:"outros"},{component:"field_array",label:"Lista de itens",icon:T.List,group:"outros"},{component:"terms",label:"Termos e condições",icon:T.ScrollText,group:"outros"},{component:"sub_form",label:"Sub-formulário",icon:T.LayoutList,group:"outros"}],ss=[{component:"step",label:"Step",icon:T.Layers,color:"border-primary/40 bg-primary/5"},{component:"container",label:"Container",icon:T.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=k=>{f.current=[...f.current.slice(-49),Hr(k)],x.current=[]},h=_.useCallback(()=>{l(k=>(g(k),{...k}))},[]),v=_.useCallback(()=>{f.current.length!==0&&l(k=>{x.current=[...x.current,Hr(k)];const E=f.current.pop();return{...k,containers:E.containers,configs:E.configs}})},[]),b=_.useCallback(()=>{x.current.length!==0&&l(k=>{f.current=[...f.current,Hr(k)];const E=x.current.pop();return{...k,containers:E.containers,configs:E.configs}})},[]);_.useEffect(()=>{const k=E=>{const R=E.metaKey||E.ctrlKey;R&&E.key==="z"&&!E.shiftKey&&(E.preventDefault(),v()),R&&E.key==="z"&&E.shiftKey&&(E.preventDefault(),b()),R&&E.key==="y"&&(E.preventDefault(),b())};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[v,b]);const w=_.useCallback(k=>i.configs[k]??Wr(k),[i.configs]),N=_.useCallback(()=>{const k=[],E=R=>{var L;const $=((L=i.containers[R])==null?void 0:L.children)??[];for(const q of $)me(q)==="field"?k.push(q):i.containers[q]&&E(q)};return E("root"),k},[i.containers]),C=_.useCallback(k=>{l(E=>({...E,selectedId:k}))},[]),j=_.useCallback(k=>{l(E=>({...E,showPreview:k}))},[]),S=_.useCallback(k=>{l(E=>({...E,previewTemplateId:k}))},[]),P=_.useCallback((k,E)=>{l(R=>({...R,configs:{...R.configs,[k]:{...R.configs[k]??Wr(k),...E}}}))},[]),y=_.useCallback((k,E,R)=>{const $=`${k}-${de.v4Fallback()}`,L=me($);return l(q=>{var ie;g(q);const ne={...q.containers};(L==="step"||L==="container"||k==="field_array")&&(ne[$]={children:[]});const ae=[...((ie=ne[E])==null?void 0:ie.children)??[]];return R!==void 0&&R>=0?ae.splice(R,0,$):ae.push($),ne[E]={children:ae},{...q,containers:ne,configs:{...q.configs,[$]:Wr($,k)},selectedId:$}}),$},[]),A=_.useCallback((k,E)=>{const R=`container-${de.v4Fallback()}`;return l($=>{var ie,oe,se;g($);const L={...$.containers},q={...$.configs},ne=[];for(const M of k.containerTemplate.campos){const re=M.locked?M.id:`${String(M.tipo).toLowerCase()}-${de.v4Fallback()}`;if(ne.push(re),q[re]={label:M.label,name:M.locked?M.id:M.nome,fieldType:M.tipo,required:M.obrigatorio||!1,placeholder:M.placeholder,hint:M.hint,tamanho:M.tamanho||6,inicioColuna:M.inicioColuna,defaultValue:M.defaultValue!=null?String(M.defaultValue):void 0,locked:M.locked||!1,options:(ie=M.opcoes)==null?void 0:ie.map(Z=>({value:Z.valor,label:Z.label})),...M.tipo==="field_array"&&{itemLabel:M.itemLabel,minItems:M.minItems,maxItems:M.maxItems,addLabel:M.addLabel}},M.tipo==="field_array"){const Z=[];for(const K of M.subFields??[]){const G=`${String(K.tipo).toLowerCase()}-${de.v4Fallback()}`;Z.push(G),q[G]={label:K.label,name:K.nome,fieldType:K.tipo,required:K.obrigatorio||!1,placeholder:K.placeholder,hint:K.hint,tamanho:K.tamanho||6,inicioColuna:K.inicioColuna,options:(oe=K.opcoes)==null?void 0:oe.map(Q=>({value:Q.valor,label:Q.label}))}}L[re]={children:Z}}}L[R]={children:ne},q[R]={label:k.containerTemplate.titulo||k.name,description:k.containerTemplate.descricao,icone:k.containerTemplate.icone,tamanho:k.containerTemplate.tamanho||12,inicioColuna:k.containerTemplate.inicioColuna,showLabel:!0};const ae=[...((se=L[E])==null?void 0:se.children)??[]];return ae.push(R),L[E]={children:ae},{...$,containers:L,configs:q,selectedId:R}}),R},[]),I=_.useCallback(k=>{const E=[];return l(R=>{var q,ne,ae;g(R);const $={...R.containers},L={...R.configs};for(const ie of k.steps){const oe=`step-${de.v4Fallback()}`;E.push(oe);const se=[];for(const re of ie.containers){const Z=`container-${de.v4Fallback()}`;se.push(Z);const K=[];for(const G of re.campos){const Q=G.locked?G.id:`${String(G.tipo).toLowerCase()}-${de.v4Fallback()}`;if(K.push(Q),L[Q]={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),L[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:(ne=ce.opcoes)==null?void 0:ne.map(Ue=>({value:Ue.valor,label:Ue.label}))}}$[Q]={children:ue}}}$[Z]={children:K},L[Z]={label:re.titulo,description:re.descricao,icone:re.icone,tamanho:re.tamanho||12,showLabel:!0}}$[oe]={children:se},L[oe]={label:ie.titulo,description:ie.descricao,icone:ie.icone};const M=[...((ae=$.root)==null?void 0:ae.children)??[],oe];$.root={children:M}}return{...R,containers:$,configs:L,selectedId:E[0]??R.selectedId}}),E},[]),O=_.useCallback((k,E,R,$)=>{l(L=>{var oe,se;g(L);const q={...L.containers},ne=(((oe=q[E])==null?void 0:oe.children)??[]).filter(M=>M!==k);q[E]={children:ne};const ae=[...(((se=q[R])==null?void 0:se.children)??[]).filter(M=>M!==k)],ie=Math.max(0,Math.min($,ae.length));return ae.splice(ie,0,k),q[R]={children:ae},{...L,containers:q}})},[]),D=_.useCallback((k,E)=>{l(R=>({...R,containers:{...R.containers,[k]:{children:E}}}))},[]),F=_.useCallback(k=>{l(E=>{g(E);const R=ls(k,E.containers),$={};for(const[q,ne]of Object.entries(E.containers))R.includes(q)||($[q]={children:ne.children.filter(ae=>ae!==k)});const L={...E.configs};for(const q of R)delete L[q];return{...E,containers:$,configs:L,selectedId:R.includes(E.selectedId??"")?null:E.selectedId}})},[]),z=_.useCallback((k,E)=>{l(R=>{const $=cs(k,R.containers);if(!$)return R;const L=[...R.containers[$].children],q=L.indexOf(k),ne=E==="up"?q-1:q+1;return ne<0||ne>=L.length?R:([L[q],L[ne]]=[L[ne],L[q]],{...R,containers:{...R.containers,[$]:{children:L}}})})},[]),V=_.useCallback((k,E)=>{h(),z(k,E)},[z,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:A,addPresetStepBlock:I,moveCanvasItem:O,reorderInContainer:D,removeItem:F,moveItem:V,moveItemNoSnapshot:z,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 te(...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),ee=e=>!!e&&!Number.isNaN(Number(e)),qe=e=>!!e&&Number.isInteger(Number(e)),Ur=e=>e.endsWith("%")&&ee(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=>!H(e)&&!U(e),Lc=e=>et(e,Ss,ko),H=e=>ys.test(e),nt=e=>et(e,Ps,Ac),vn=e=>et(e,Vc,ee),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),U=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(),U,H],S=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],y=()=>[U,H,c],A=()=>[Ge,"full","auto",...y()],I=()=>[qe,"none","subgrid",U,H],O=()=>["auto",{span:["full",qe,U,H]},qe,U,H],D=()=>[qe,"auto",U,H],F=()=>["auto","min","max","fr",U,H],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],k=()=>["auto",...y()],E=()=>[Ge,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...y()],R=()=>[Ge,"screen","full","dvw","lvw","svw","min","max","fit",...y()],$=()=>[Ge,"screen","full","lh","dvh","lvh","svh","min","max","fit",...y()],L=()=>[e,U,H],q=()=>[...C(),yn,bn,{position:[U,H]}],ne=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ae=()=>["auto","cover","contain",$c,Lc,{size:[U,H]}],ie=()=>[Ur,Tt,nt],oe=()=>["","none","full",d,U,H],se=()=>["",ee,Tt,nt],M=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>[ee,Ur,yn,bn],K=()=>["","none",g,U,H],G=()=>["none",ee,U,H],Q=()=>["none",ee,U,H],ue=()=>[ee,U,H],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",ee],text:[Me],"text-shadow":[Me],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ge,H,U,v]}],container:["container"],columns:[{columns:[ee,H,U,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: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",U,H]}],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:[ee,Ge,"auto","initial","none",H]}],grow:[{grow:["",ee,U,H]}],shrink:[{shrink:["",ee,U,H]}],order:[{order:[qe,"first","last","none",U,H]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:O()}],"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:[...z(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"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:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mbs:[{mbs:k()}],mbe:[{mbe:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":y()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":y()}],"space-y-reverse":["space-y-reverse"],size:[{size:E()}],"inline-size":[{inline:["auto",...R()]}],"min-inline-size":[{"min-inline":["auto",...R()]}],"max-inline-size":[{"max-inline":["none",...R()]}],"block-size":[{block:["auto",...$()]}],"min-block-size":[{"min-block":["auto",...$()]}],"max-block-size":[{"max-block":["none",...$()]}],w:[{w:[l,"screen",...E()]}],"min-w":[{"min-w":[l,"screen","none",...E()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...E()]}],h:[{h:["screen","lh",...E()]}],"min-h":[{"min-h":["screen","lh","none",...E()]}],"max-h":[{"max-h":["screen","lh",...E()]}],"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,H]}],"font-family":[{font:[Mc,_c,t]}],"font-features":[{"font-features":[H]}],"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,U,H]}],"line-clamp":[{"line-clamp":[ee,"none",U,vn]}],leading:[{leading:[a,...y()]}],"list-image":[{"list-image":["none",U,H]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",U,H]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...M(),"wavy"]}],"text-decoration-thickness":[{decoration:[ee,"from-font","auto",U,nt]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[ee,"auto",U,H]}],"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",U,H]}],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",U,H]}],"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:ne()}],"bg-size":[{bg:ae()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qe,U,H],radial:["",U,H],conic:[qe,U,H]},Fc,Dc]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-bs":[{"border-bs":se()}],"border-w-be":[{"border-be":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...M(),"hidden","none"]}],"divide-style":[{divide:[...M(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...M(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ee,U,H]}],"outline-w":[{outline:["",ee,Tt,nt]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",m,Ut,Ht]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",p,Ut,Ht]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[ee,nt]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",f,Ut,Ht]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[ee,U,H]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ee]}],"mask-image-linear-from-pos":[{"mask-linear-from":Z()}],"mask-image-linear-to-pos":[{"mask-linear-to":Z()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":Z()}],"mask-image-t-to-pos":[{"mask-t-to":Z()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":Z()}],"mask-image-r-to-pos":[{"mask-r-to":Z()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":Z()}],"mask-image-b-to-pos":[{"mask-b-to":Z()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":Z()}],"mask-image-l-to-pos":[{"mask-l-to":Z()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":Z()}],"mask-image-x-to-pos":[{"mask-x-to":Z()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":Z()}],"mask-image-y-to-pos":[{"mask-y-to":Z()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[U,H]}],"mask-image-radial-from-pos":[{"mask-radial-from":Z()}],"mask-image-radial-to-pos":[{"mask-radial-to":Z()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[ee]}],"mask-image-conic-from-pos":[{"mask-conic-from":Z()}],"mask-image-conic-to-pos":[{"mask-conic-to":Z()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:ne()}],"mask-size":[{mask:ae()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",U,H]}],filter:[{filter:["","none",U,H]}],blur:[{blur:K()}],brightness:[{brightness:[ee,U,H]}],contrast:[{contrast:[ee,U,H]}],"drop-shadow":[{"drop-shadow":["","none",x,Ut,Ht]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",ee,U,H]}],"hue-rotate":[{"hue-rotate":[ee,U,H]}],invert:[{invert:["",ee,U,H]}],saturate:[{saturate:[ee,U,H]}],sepia:[{sepia:["",ee,U,H]}],"backdrop-filter":[{"backdrop-filter":["","none",U,H]}],"backdrop-blur":[{"backdrop-blur":K()}],"backdrop-brightness":[{"backdrop-brightness":[ee,U,H]}],"backdrop-contrast":[{"backdrop-contrast":[ee,U,H]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ee,U,H]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ee,U,H]}],"backdrop-invert":[{"backdrop-invert":["",ee,U,H]}],"backdrop-opacity":[{"backdrop-opacity":[ee,U,H]}],"backdrop-saturate":[{"backdrop-saturate":[ee,U,H]}],"backdrop-sepia":[{"backdrop-sepia":["",ee,U,H]}],"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",U,H]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ee,"initial",U,H]}],ease:[{ease:["linear","initial",b,U,H]}],delay:[{delay:[ee,U,H]}],animate:[{animate:["none",w,U,H]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,U,H]}],"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:Q()}],"scale-x":[{"scale-x":Q()}],"scale-y":[{"scale-y":Q()}],"scale-z":[{"scale-z":Q()}],"scale-3d":["scale-3d"],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[U,H,"","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:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",U,H]}],"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",U,H]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[ee,Tt,nt,vn]}],stroke:[{stroke:["none",...L()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Wc=wc(Bc);function W(...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:W("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Ne.displayName=ps.displayName;const X=u.forwardRef(({className:e,type:t,...r},n)=>o.jsx("input",{type:t,className:W("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}));X.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:W(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 Y(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=te(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"],J=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=te(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(J.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:Y(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:Y(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(J.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=te(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(J.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:W("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:W("flex items-center justify-center text-current"),children:o.jsx(T.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:W(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),A=te(t,O=>c(O)),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(J.div,{dir:I,...i,ref:A,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=te(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(J.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:Y(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Y(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=te(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=te(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=te(t,A=>h(A)),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(A){if(b.current){const I=A.clientX-b.current.left,O=A.clientY-b.current.top;d({x:I,y:O})}}return u.useEffect(()=>{const A=I=>{const O=I.target;(g==null?void 0:g.contains(O))&&j(I,C)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{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(J.div,{...f,ref:v,style:{position:"absolute",...f.style},onPointerDown:Y(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:Y(e.onPointerMove,y),onPointerUp:Y(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=te(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(J.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:Y(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:Y(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(J.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:W("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:W("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=te(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,A=[...d.branches].some(I=>I.contains(y));!C||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(J.div,{...c,ref:g,style:{pointerEvents:N?C?"auto":"none":void 0,...e.style},onFocusCapture:Y(e.onFocusCapture,S.onFocusCapture),onBlurCapture:Y(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Y(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=te(t,n);return u.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),o.jsx(J.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=te(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(J.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(J.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"),`
2
+ .`.concat(Ud,` {
3
+ overflow: hidden `).concat(n,`;
4
+ padding-right: `).concat(l,"px ").concat(n,`;
5
5
  }
6
- body[${Ri}] {
7
- overflow: hidden ${r};
6
+ body[`).concat(gt,`] {
7
+ overflow: hidden `).concat(n,`;
8
8
  overscroll-behavior: contain;
9
- ${[t&&`position: relative ${r};`,n===`margin`&&`
10
- padding-left: ${i}px;
11
- padding-top: ${a}px;
12
- padding-right: ${o}px;
9
+ `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
10
+ padding-left: `.concat(s,`px;
11
+ padding-top: `).concat(a,`px;
12
+ padding-right: `).concat(i,`px;
13
13
  margin-left:0;
14
14
  margin-top:0;
15
- margin-right: ${s}px ${r};
16
- `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
15
+ margin-right: `).concat(l,"px ").concat(n,`;
16
+ `),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),`
17
17
  }
18
18
 
19
- .${ci} {
20
- right: ${s}px ${r};
19
+ .`).concat(Jt,` {
20
+ right: `).concat(l,"px ").concat(n,`;
21
21
  }
22
22
 
23
- .${li} {
24
- margin-right: ${s}px ${r};
23
+ .`).concat(Qt,` {
24
+ margin-right: `).concat(l,"px ").concat(n,`;
25
25
  }
26
26
 
27
- .${ci} .${ci} {
28
- right: 0 ${r};
27
+ .`).concat(Jt," .").concat(Jt,` {
28
+ right: 0 `).concat(n,`;
29
29
  }
30
30
 
31
- .${li} .${li} {
32
- margin-right: 0 ${r};
31
+ .`).concat(Qt," .").concat(Qt,` {
32
+ margin-right: 0 `).concat(n,`;
33
33
  }
34
34
 
35
- body[${Ri}] {
36
- ${di}: ${s}px;
35
+ body[`).concat(gt,`] {
36
+ `).concat(Gd,": ").concat(l,`px;
37
37
  }
38
- `},Bi=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Vi=function(){c.useEffect(function(){return document.body.setAttribute(Ri,(Bi()+1).toString()),function(){var e=Bi()-1;e<=0?document.body.removeAttribute(Ri):document.body.setAttribute(Ri,e.toString())}},[])},Hi=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Vi();var a=c.useMemo(function(){return Ii(i)},[i]);return c.createElement(Li,{styles:zi(a,!t,i,n?``:`!important`)})},Ui=!1;if(typeof window<`u`)try{var Wi=Object.defineProperty({},`passive`,{get:function(){return Ui=!0,!0}});window.addEventListener(`test`,Wi,Wi),window.removeEventListener(`test`,Wi,Wi)}catch{Ui=!1}var Gi=Ui?{passive:!1}:!1,Ki=function(e){return e.tagName===`TEXTAREA`},qi=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Ki(e)&&n[t]===`visible`)},Ji=function(e){return qi(e,`overflowY`)},Yi=function(e){return qi(e,`overflowX`)},Xi=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),$i(e,r)){var i=ea(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Zi=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Qi=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},$i=function(e,t){return e===`v`?Ji(t):Yi(t)},ea=function(e,t){return e===`v`?Zi(t):Qi(t)},ta=function(e,t){return e===`h`&&t===`rtl`?-1:1},na=function(e,t,n,r,i){var a=ta(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=ea(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&$i(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},ra=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ia=function(e){return[e.deltaX,e.deltaY]},aa=function(e){return e&&`current`in e?e.current:e},oa=function(e,t){return e[0]===t[0]&&e[1]===t[1]},sa=function(e){return`
39
- .block-interactivity-${e} {pointer-events: none;}
40
- .allow-interactivity-${e} {pointer-events: all;}
41
- `},ca=0,la=[];function ua(e){var t=c.useRef([]),n=c.useRef([0,0]),r=c.useRef(),i=c.useState(ca++)[0],a=c.useState(Mi)[0],o=c.useRef(e);c.useEffect(function(){o.current=e},[e]),c.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=si([e.lockRef.current],(e.shards||[]).map(aa),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=c.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=ra(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Xi(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Xi(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return na(h,t,e,h===`h`?s:c,!0)},[]),l=c.useCallback(function(e){var n=e;if(!(!la.length||la[la.length-1]!==a)){var r=`deltaY`in n?ia(n):ra(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&oa(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(aa).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),u=c.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:da(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),d=c.useCallback(function(e){n.current=ra(e),r.current=void 0},[]),f=c.useCallback(function(t){u(t.type,ia(t),t.target,s(t,e.lockRef.current))},[]),p=c.useCallback(function(t){u(t.type,ra(t),t.target,s(t,e.lockRef.current))},[]);c.useEffect(function(){return la.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,l,Gi),document.addEventListener(`touchmove`,l,Gi),document.addEventListener(`touchstart`,d,Gi),function(){la=la.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,l,Gi),document.removeEventListener(`touchmove`,l,Gi),document.removeEventListener(`touchstart`,d,Gi)}},[]);var m=e.removeScrollBar,h=e.inert;return c.createElement(c.Fragment,null,h?c.createElement(a,{styles:sa(i)}):null,m?c.createElement(Hi,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function da(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var fa=xi(Si,ua),pa=c.forwardRef(function(e,t){return c.createElement(wi,ai({},e,{ref:t,sideCar:fa}))});pa.classNames=wi.classNames;var ma=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},ha=new WeakMap,ga=new WeakMap,_a={},va=0,ya=function(e){return e&&(e.host||ya(e.parentNode))},ba=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ya(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},xa=function(e,t,n,r){var i=ba(t,Array.isArray(e)?e:[e]);_a[n]||(_a[n]=new WeakMap);var a=_a[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(ha.get(e)||0)+1,l=(a.get(e)||0)+1;ha.set(e,c),a.set(e,l),o.push(e),c===1&&i&&ga.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),va++,function(){o.forEach(function(e){var t=ha.get(e)-1,i=a.get(e)-1;ha.set(e,t),a.set(e,i),t||(ga.has(e)||e.removeAttribute(r),ga.delete(e)),i||e.removeAttribute(n)}),va--,va||(ha=new WeakMap,ha=new WeakMap,ga=new WeakMap,_a={})}},Sa=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||ma(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),xa(r,i,n,`aria-hidden`)):function(){return null}},Ca=`Dialog`,[wa,Ta]=Kt(Ca),[Ea,Da]=wa(Ca),Oa=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=c.useRef(null),l=c.useRef(null),[u,f]=Yt({prop:r,defaultProp:i??!1,onChange:a,caller:Ca});return(0,d.jsx)(Ea,{scope:t,triggerRef:s,contentRef:l,contentId:Cr(),titleId:Cr(),descriptionId:Cr(),open:u,onOpenChange:f,onOpenToggle:c.useCallback(()=>f(e=>!e),[f]),modal:o,children:n})};Oa.displayName=Ca;var ka=`DialogTrigger`,Aa=c.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Da(ka,n),a=P(t,i.triggerRef);return(0,d.jsx)(Y.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Xa(i.open),...r,ref:a,onClick:q(e.onClick,i.onOpenToggle)})});Aa.displayName=ka;var ja=`DialogPortal`,[Ma,Na]=wa(ja,{forceMount:void 0}),Pa=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Da(ja,t);return(0,d.jsx)(Ma,{scope:t,forceMount:n,children:c.Children.map(r,e=>(0,d.jsx)(tn,{present:n||a.open,children:(0,d.jsx)(ti,{asChild:!0,container:i,children:e})}))})};Pa.displayName=ja;var Fa=`DialogOverlay`,Ia=c.forwardRef((e,t)=>{let n=Na(Fa,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Da(Fa,e.__scopeDialog);return a.modal?(0,d.jsx)(tn,{present:r||a.open,children:(0,d.jsx)(Ra,{...i,ref:t})}):null});Ia.displayName=Fa;var La=on(`DialogOverlay.RemoveScroll`),Ra=c.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Da(Fa,n);return(0,d.jsx)(pa,{as:La,allowPinchZoom:!0,shards:[i.contentRef],children:(0,d.jsx)(Y.div,{"data-state":Xa(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),za=`DialogContent`,Ba=c.forwardRef((e,t)=>{let n=Na(za,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Da(za,e.__scopeDialog);return(0,d.jsx)(tn,{present:r||a.open,children:a.modal?(0,d.jsx)(Va,{...i,ref:t}):(0,d.jsx)(Ha,{...i,ref:t})})});Ba.displayName=za;var Va=c.forwardRef((e,t)=>{let n=Da(za,e.__scopeDialog),r=c.useRef(null),i=P(t,n.contentRef,r);return c.useEffect(()=>{let e=r.current;if(e)return Sa(e)},[]),(0,d.jsx)(Ua,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:q(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:q(e.onFocusOutside,e=>e.preventDefault())})}),Ha=c.forwardRef((e,t)=>{let n=Da(za,e.__scopeDialog),r=c.useRef(!1),i=c.useRef(!1);return(0,d.jsx)(Ua,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Ua=c.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Da(za,n),l=c.useRef(null),u=P(t,l);return ri(),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Hr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,d.jsx)(jr,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Xa(s.open),...o,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(eo,{titleId:s.titleId}),(0,d.jsx)(no,{contentRef:l,descriptionId:s.descriptionId})]})]})}),Wa=`DialogTitle`,Ga=c.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Da(Wa,n);return(0,d.jsx)(Y.h2,{id:i.titleId,...r,ref:t})});Ga.displayName=Wa;var Ka=`DialogDescription`,qa=c.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Da(Ka,n);return(0,d.jsx)(Y.p,{id:i.descriptionId,...r,ref:t})});qa.displayName=Ka;var Ja=`DialogClose`,Ya=c.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Da(Ja,n);return(0,d.jsx)(Y.button,{type:`button`,...r,ref:t,onClick:q(e.onClick,()=>i.onOpenChange(!1))})});Ya.displayName=Ja;function Xa(e){return e?`open`:`closed`}var Za=`DialogTitleWarning`,[Qa,$a]=Gt(Za,{contentName:za,titleName:Wa,docsSlug:`dialog`}),eo=({titleId:e})=>{let t=$a(Za),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
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
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
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,N="deltaX"in h?h.deltaX:w[0]-b[0],C="deltaY"in h?h.deltaY:w[1]-b[1],j,S=h.target,P=Math.abs(N)>Math.abs(C)?"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 O=Ln(P,S);if(!O)return!0;if(O?j=P:(j=P==="v"?"h":"v",O=Ln(P,S)),!O)return!1;if(!n.current&&"changedTouches"in h&&(N||C)&&(n.current=j),!j)return!0;var D=n.current||j;return bu(D,v,h,D==="h"?N:C)},[]),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 N=(i.current.shards||[]).map(_n).filter(Boolean).filter(function(j){return j.contains(v.target)}),C=N.length>0?l(v,N[0]):!i.current.noIsolation;C&&v.cancelable&&v.preventDefault()}}},[]),d=u.useCallback(function(h,v,b,w){var N={name:h,delta:v,target:b,should:w,shadowParent:ju(b)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(C){return C!==N})},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=te(t,s.triggerRef);return o.jsx(J.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Uo(s.open),...n,ref:a,onClick:Y(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(J.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=te(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:Y(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:Y(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&a.preventDefault()}),onFocusOutside:Y(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=te(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(J.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(J.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(J.button,{type:"button",...n,ref:t,onClick:Y(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 c.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},to=`DialogDescriptionWarning`,no=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$a(to).contentName}}.`;return c.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},ro=Oa,io=Pa,ao=Ia,oo=Ba,so=Ga,co=qa,lo=Ya,uo=ro,fo=io,po=c.forwardRef(({className:e,...t},n)=>(0,d.jsx)(ao,{ref:n,className:W(`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}));po.displayName=ao.displayName;var mo=c.forwardRef(({className:e,children:t,...n},r)=>(0,d.jsxs)(fo,{children:[(0,d.jsx)(po,{}),(0,d.jsxs)(oo,{ref:r,className:W(`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),...n,children:[t,(0,d.jsxs)(lo,{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:[(0,d.jsx)(l.X,{className:`h-4 w-4`}),(0,d.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));mo.displayName=oo.displayName;var ho=({className:e,...t})=>(0,d.jsx)(`div`,{className:W(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});ho.displayName=`DialogHeader`;var go=({className:e,...t})=>(0,d.jsx)(`div`,{className:W(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});go.displayName=`DialogFooter`;var _o=c.forwardRef(({className:e,...t},n)=>(0,d.jsx)(so,{ref:n,className:W(`text-lg font-semibold leading-none tracking-tight`,e),...t}));_o.displayName=so.displayName;var vo=c.forwardRef(({className:e,...t},n)=>(0,d.jsx)(co,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));vo.displayName=co.displayName;function yo(e){return e?e.includes(`-`)?l.icons[e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)]??null:l.icons[e]??null:null}var bo=Object.entries(l.icons).map(([e,t])=>({name:e,kebab:e.replace(/([A-Z])/g,(e,t,n)=>n===0?t.toLowerCase():`-${t.toLowerCase()}`),component:t})),xo=({value:e,onChange:t,label:n=`Ícone (Lucide)`,hideLabel:r=!1,className:i})=>{let[a,o]=(0,c.useState)(!1),[s,u]=(0,c.useState)(``),f=(0,c.useMemo)(()=>yo(e),[e]),p=(0,c.useMemo)(()=>{let e=s.toLowerCase();return e?bo.filter(t=>t.name.toLowerCase().includes(e)||t.kebab.includes(e)):bo},[s]),m=e=>{t(e),o(!1)};return(0,d.jsxs)(`div`,{className:`space-y-1 ${i??``}`,children:[!r&&(0,d.jsx)(K,{className:`text-xs`,children:n}),(0,d.jsx)(Z,{type:`button`,variant:`outline`,className:`w-full h-8 justify-start text-xs font-normal gap-2`,onClick:()=>o(!0),children:f?(0,d.jsxs)(d.Fragment,{children:[c.default.createElement(f,{className:`h-3.5 w-3.5 shrink-0`}),(0,d.jsx)(`span`,{className:`truncate`,children:e})]}):(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:`Selecionar ícone…`})}),(0,d.jsx)(uo,{open:a,onOpenChange:e=>{o(e),e||u(``)},children:(0,d.jsxs)(mo,{className:`max-w-3xl max-h-[85vh] flex flex-col gap-0 p-0`,children:[(0,d.jsxs)(ho,{className:`px-4 pt-4 pb-2 border-b`,children:[(0,d.jsx)(_o,{children:`Selecionar ícone`}),(0,d.jsx)(vo,{children:`Pesquise e clique em um ícone da biblioteca Lucide.`})]}),(0,d.jsx)(`div`,{className:`px-4 py-2 border-b`,children:(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(l.Search,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,d.jsx)(G,{autoFocus:!0,placeholder:`Buscar ícones…`,value:s,onChange:e=>u(e.target.value),className:`pl-8 h-9 text-sm`})]})}),(0,d.jsx)(yr,{className:`flex-1 px-4 py-2`,children:(0,d.jsxs)(`div`,{className:`grid grid-cols-5 gap-2 sm:grid-cols-7 md:grid-cols-8 pb-2`,children:[(0,d.jsxs)(Z,{type:`button`,variant:e?`outline`:`secondary`,className:`flex flex-col items-center justify-center h-20 gap-1 p-1`,onClick:()=>m(void 0),children:[(0,d.jsx)(`div`,{className:`h-6 w-6 rounded border-2 border-dashed border-muted-foreground/30`}),(0,d.jsx)(`span`,{className:`text-[10px] leading-tight text-center`,children:`Nenhum`})]}),p.map(({name:t,component:n})=>(0,d.jsxs)(Z,{type:`button`,variant:e===t?`secondary`:`outline`,className:`flex flex-col items-center justify-center h-20 gap-1 p-1 overflow-hidden`,onClick:()=>m(t),children:[c.default.createElement(n,{size:24}),(0,d.jsx)(`span`,{className:`text-[9px] leading-tight text-center break-all line-clamp-2`,children:t})]},t))]})})]})})]})},So=[`top`,`right`,`bottom`,`left`],Co=Math.min,wo=Math.max,To=Math.round,Eo=Math.floor,Do=e=>({x:e,y:e}),Oo={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ko(e,t,n){return wo(e,Co(t,n))}function Ao(e,t){return typeof e==`function`?e(t):e}function jo(e){return e.split(`-`)[0]}function Mo(e){return e.split(`-`)[1]}function No(e){return e===`x`?`y`:`x`}function Po(e){return e===`y`?`height`:`width`}function Fo(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Io(e){return No(Fo(e))}function Lo(e,t,n){n===void 0&&(n=!1);let r=Mo(e),i=Io(e),a=Po(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ko(o)),[o,Ko(o)]}function Ro(e){let t=Ko(e);return[zo(e),t,zo(t)]}function zo(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Bo=[`left`,`right`],Vo=[`right`,`left`],Ho=[`top`,`bottom`],Uo=[`bottom`,`top`];function Wo(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Vo:Bo:t?Bo:Vo;case`left`:case`right`:return t?Ho:Uo;default:return[]}}function Go(e,t,n,r){let i=Mo(e),a=Wo(jo(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(zo)))),a}function Ko(e){let t=jo(e);return Oo[t]+e.slice(t.length)}function qo(e){return{top:0,right:0,bottom:0,left:0,...e}}function Jo(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:qo(e)}function Yo(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Xo(e,t,n){let{reference:r,floating:i}=e,a=Fo(t),o=Io(t),s=Po(o),c=jo(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Mo(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Zo(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Ao(t,e),p=Jo(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Yo(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Yo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Qo=50,$o=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Zo},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Xo(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Qo&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Xo(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},es=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Ao(e,t)||{};if(l==null)return{};let d=Jo(u),f={x:n,y:r},p=Io(i),m=Po(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Co(d[_],T),D=Co(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=ko(O,A,k),M=!c.arrow&&Mo(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),ts=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Ao(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=jo(r),_=Fo(o),v=jo(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ko(o)]:Ro(o)),x=p!==`none`;!d&&x&&b.push(...Go(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Lo(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Fo(t))||T.every(e=>Fo(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Fo(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function ns(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function rs(e){return So.some(t=>e[t]>=0)}var is=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Ao(e,t);switch(i){case`referenceHidden`:{let e=ns(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:rs(e)}}}case`escaped`:{let e=ns(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:rs(e)}}}default:return{}}}}},as=new Set([`left`,`top`]);async function os(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=jo(n),s=Mo(n),c=Fo(n)===`y`,l=as.has(o)?-1:1,u=a&&c?-1:1,d=Ao(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ss=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await os(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},cs=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Ao(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Fo(jo(i)),p=No(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=ko(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=ko(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},ls=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Ao(e,t),u={x:n,y:r},d=Fo(i),f=No(d),p=u[f],m=u[d],h=Ao(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=as.has(jo(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},us=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Ao(e,t),u=await o.detectOverflow(t,l),d=jo(i),f=Mo(i),p=Fo(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Co(h-u[g],v),x=Co(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=wo(u.left,0),t=wo(u.right,0),n=wo(u.top,0),r=wo(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:wo(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:wo(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function ds(){return typeof window<`u`}function fs(e){return hs(e)?(e.nodeName||``).toLowerCase():`#document`}function ps(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ms(e){return((hs(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function hs(e){return ds()?e instanceof Node||e instanceof ps(e).Node:!1}function gs(e){return ds()?e instanceof Element||e instanceof ps(e).Element:!1}function _s(e){return ds()?e instanceof HTMLElement||e instanceof ps(e).HTMLElement:!1}function vs(e){return!ds()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof ps(e).ShadowRoot}function ys(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=As(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function bs(e){return/^(table|td|th)$/.test(fs(e))}function xs(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ss=/transform|translate|scale|rotate|perspective|filter/,Cs=/paint|layout|strict|content/,ws=e=>!!e&&e!==`none`,Ts;function Es(e){let t=gs(e)?As(e):e;return ws(t.transform)||ws(t.translate)||ws(t.scale)||ws(t.rotate)||ws(t.perspective)||!Os()&&(ws(t.backdropFilter)||ws(t.filter))||Ss.test(t.willChange||``)||Cs.test(t.contain||``)}function Ds(e){let t=Ms(e);for(;_s(t)&&!ks(t);){if(Es(t))return t;if(xs(t))return null;t=Ms(t)}return null}function Os(){return Ts??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Ts}function ks(e){return/^(html|body|#document)$/.test(fs(e))}function As(e){return ps(e).getComputedStyle(e)}function js(e){return gs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ms(e){if(fs(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||vs(e)&&e.host||ms(e);return vs(t)?t.host:t}function Ns(e){let t=Ms(e);return ks(t)?e.ownerDocument?e.ownerDocument.body:e.body:_s(t)&&ys(t)?t:Ns(t)}function Ps(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ns(e),i=r===e.ownerDocument?.body,a=ps(r);if(i){let e=Fs(a);return t.concat(a,a.visualViewport||[],ys(r)?r:[],e&&n?Ps(e):[])}else return t.concat(r,Ps(r,[],n))}function Fs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Is(e){let t=As(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=_s(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=To(n)!==a||To(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ls(e){return gs(e)?e:e.contextElement}function Rs(e){let t=Ls(e);if(!_s(t))return Do(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Is(t),o=(a?To(n.width):n.width)/r,s=(a?To(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var zs=Do(0);function Bs(e){let t=ps(e);return!Os()||!t.visualViewport?zs:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Vs(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ps(e)?!1:t}function Hs(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ls(e),o=Do(1);t&&(r?gs(r)&&(o=Rs(r)):o=Rs(e));let s=Vs(a,n,r)?Bs(a):Do(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=ps(a),t=r&&gs(r)?ps(r):r,n=e,i=Fs(n);for(;i&&r&&t!==n;){let e=Rs(i),t=i.getBoundingClientRect(),r=As(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=ps(i),i=Fs(n)}}return Yo({width:u,height:d,x:c,y:l})}function Us(e,t){let n=js(e).scrollLeft;return t?t.left+n:Hs(ms(e)).left+n}function Ws(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Us(e,n),y:n.top+t.scrollTop}}function Gs(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ms(r),s=t?xs(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Do(1),u=Do(0),d=_s(r);if((d||!d&&!a)&&((fs(r)!==`body`||ys(o))&&(c=js(r)),d)){let e=Hs(r);l=Rs(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ws(o,c):Do(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ks(e){return Array.from(e.getClientRects())}function qs(e){let t=ms(e),n=js(e),r=e.ownerDocument.body,i=wo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=wo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Us(e),s=-n.scrollTop;return As(r).direction===`rtl`&&(o+=wo(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Js=25;function Ys(e,t){let n=ps(e),r=ms(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Os();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Us(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Js&&(a-=o)}else l<=Js&&(a+=l);return{width:a,height:o,x:s,y:c}}function Xs(e,t){let n=Hs(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=_s(e)?Rs(e):Do(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Zs(e,t,n){let r;if(t===`viewport`)r=Ys(e,n);else if(t===`document`)r=qs(ms(e));else if(gs(t))r=Xs(t,n);else{let n=Bs(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Yo(r)}function Qs(e,t){let n=Ms(e);return n===t||!gs(n)||ks(n)?!1:As(n).position===`fixed`||Qs(n,t)}function $s(e,t){let n=t.get(e);if(n)return n;let r=Ps(e,[],!1).filter(e=>gs(e)&&fs(e)!==`body`),i=null,a=As(e).position===`fixed`,o=a?Ms(e):e;for(;gs(o)&&!ks(o);){let t=As(o),n=Es(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||ys(o)&&!n&&Qs(e,o))?r=r.filter(e=>e!==o):i=t,o=Ms(o)}return t.set(e,r),r}function ec(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?xs(t)?[]:$s(t,this._c):[].concat(n),r],o=Zs(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Zs(t,a[e],i);s=wo(n.top,s),c=Co(n.right,c),l=Co(n.bottom,l),u=wo(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function tc(e){let{width:t,height:n}=Is(e);return{width:t,height:n}}function nc(e,t,n){let r=_s(t),i=ms(t),a=n===`fixed`,o=Hs(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Do(0);function l(){c.x=Us(i)}if(r||!r&&!a)if((fs(t)!==`body`||ys(i))&&(s=js(t)),r){let e=Hs(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Ws(i,s):Do(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function rc(e){return As(e).position===`static`}function ic(e,t){if(!_s(e)||As(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ms(e)===n&&(n=n.ownerDocument.body),n}function ac(e,t){let n=ps(e);if(xs(e))return n;if(!_s(e)){let t=Ms(e);for(;t&&!ks(t);){if(gs(t)&&!rc(t))return t;t=Ms(t)}return n}let r=ic(e,t);for(;r&&bs(r)&&rc(r);)r=ic(r,t);return r&&ks(r)&&rc(r)&&!Es(r)?n:r||Ds(e)||n}var oc=async function(e){let t=this.getOffsetParent||ac,n=this.getDimensions,r=await n(e.floating);return{reference:nc(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function sc(e){return As(e).direction===`rtl`}var cc={convertOffsetParentRelativeRectToViewportRelativeRect:Gs,getDocumentElement:ms,getClippingRect:ec,getOffsetParent:ac,getElementRects:oc,getClientRects:Ks,getDimensions:tc,getScale:Rs,isElement:gs,isRTL:sc};function lc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function uc(e,t){let n=null,r,i=ms(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Eo(d),h=Eo(i.clientWidth-(u+f)),g=Eo(i.clientHeight-(d+p)),_=Eo(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:wo(0,Co(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!lc(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function dc(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ls(e),u=i||a?[...l?Ps(l):[],...t?Ps(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?uc(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Hs(e):null;c&&g();function g(){let t=Hs(e);h&&!lc(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var fc=ss,pc=cs,mc=ts,hc=us,gc=is,_c=es,vc=ls,yc=(e,t,n)=>{let r=new Map,i={platform:cc,...n},a={...i.platform,_c:r};return $o(e,t,{...i,platform:a})},bc=typeof document<`u`?c.useLayoutEffect:function(){};function xc(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 n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!xc(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!xc(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Sc(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Cc(e,t){let n=Sc(e);return Math.round(t*n)/n}function wc(e){let t=c.useRef(e);return bc(()=>{t.current=e}),t}function Tc(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:l,open:u}=e,[d,p]=c.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=c.useState(r);xc(m,r)||h(r);let[g,_]=c.useState(null),[v,y]=c.useState(null),b=c.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=c.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||g,C=o||v,w=c.useRef(null),T=c.useRef(null),E=c.useRef(d),D=l!=null,O=wc(l),k=wc(i),A=wc(u),j=c.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:m};k.current&&(e.platform=k.current),yc(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!xc(E.current,t)&&(E.current=t,f.flushSync(()=>{p(t)}))})},[m,t,n,k,A]);bc(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);let M=c.useRef(!1);bc(()=>(M.current=!0,()=>{M.current=!1}),[]),bc(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=c.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=c.useMemo(()=>({reference:S,floating:C}),[S,C]),ee=c.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Cc(P.floating,d.x),r=Cc(P.floating,d.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Sc(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,d.x,d.y]);return c.useMemo(()=>({...d,update:j,refs:N,elements:P,floatingStyles:ee}),[d,j,N,P,ee])}var Ec=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:_c({element:r.current,padding:i}).fn(n):r?_c({element:r,padding:i}).fn(n):{}}}},Dc=(e,t)=>{let n=fc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Oc=(e,t)=>{let n=pc(e);return{name:n.name,fn:n.fn,options:[e,t]}},kc=(e,t)=>({fn:vc(e).fn,options:[e,t]}),Ac=(e,t)=>{let n=mc(e);return{name:n.name,fn:n.fn,options:[e,t]}},jc=(e,t)=>{let n=hc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mc=(e,t)=>{let n=gc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Nc=(e,t)=>{let n=Ec(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pc=`Arrow`,Fc=c.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,d.jsx)(Y.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,d.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Fc.displayName=Pc;var Ic=Fc,Lc=`Popper`,[Rc,zc]=Kt(Lc),[Bc,Vc]=Rc(Lc),Hc=e=>{let{__scopePopper:t,children:n}=e,[r,i]=c.useState(null);return(0,d.jsx)(Bc,{scope:t,anchor:r,onAnchorChange:i,children:n})};Hc.displayName=Lc;var Uc=`PopperAnchor`,Wc=c.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Vc(Uc,n),o=c.useRef(null),s=P(t,o),l=c.useRef(null);return c.useEffect(()=>{let e=l.current;l.current=r?.current||o.current,e!==l.current&&a.onAnchorChange(l.current)}),r?null:(0,d.jsx)(Y.div,{...i,ref:s})});Wc.displayName=Uc;var Gc=`PopperContent`,[Kc,qc]=Rc(Gc),Jc=c.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p=`partial`,hideWhenDetached:m=!1,updatePositionStrategy:h=`optimized`,onPlaced:g,..._}=e,v=Vc(Gc,n),[y,b]=c.useState(null),x=P(t,e=>b(e)),[S,C]=c.useState(null),w=$t(S),T=w?.width??0,E=w?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof f==`number`?f:{top:0,right:0,bottom:0,left:0,...f},k=Array.isArray(u)?u:[u],A=k.length>0,j={padding:O,boundary:k.filter(Qc),altBoundary:A},{refs:M,floatingStyles:N,placement:ee,isPositioned:F,middlewareData:I}=Tc({strategy:`fixed`,placement:D,whileElementsMounted:(...e)=>dc(...e,{animationFrame:h===`always`}),elements:{reference:v.anchor},middleware:[Dc({mainAxis:i+E,alignmentAxis:o}),l&&Oc({mainAxis:!0,crossAxis:!1,limiter:p===`partial`?kc():void 0,...j}),l&&Ac({...j}),jc({...j,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),S&&Nc({element:S,padding:s}),$c({arrowWidth:T,arrowHeight:E}),m&&Mc({strategy:`referenceHidden`,...j})]}),[te,ne]=el(ee),re=Q(g);J(()=>{F&&re?.()},[F,re]);let L=I.arrow?.x,R=I.arrow?.y,ie=I.arrow?.centerOffset!==0,[ae,z]=c.useState();return J(()=>{y&&z(window.getComputedStyle(y).zIndex)},[y]),(0,d.jsx)(`div`,{ref:M.setFloating,"data-radix-popper-content-wrapper":``,style:{...N,transform:F?N.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(` `),...I.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,d.jsx)(Kc,{scope:n,placedSide:te,onArrowChange:C,arrowX:L,arrowY:R,shouldHideArrow:ie,children:(0,d.jsx)(Y.div,{"data-side":te,"data-align":ne,..._,ref:x,style:{..._.style,animation:F?void 0:`none`}})})})});Jc.displayName=Gc;var Yc=`PopperArrow`,Xc={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Zc=c.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=qc(Yc,n),a=Xc[i.placedSide];return(0,d.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,d.jsx)(Ic,{...r,ref:t,style:{...r.style,display:`block`}})})});Zc.displayName=Yc;function Qc(e){return e!==null}var $c=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=el(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function el(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var tl=Hc,nl=Wc,rl=Jc,il=Zc,al=`Popover`,[ol,sl]=Kt(al,[zc]),cl=zc(),[ll,ul]=ol(al),dl=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=cl(t),l=c.useRef(null),[u,f]=c.useState(!1),[p,m]=Yt({prop:r,defaultProp:i??!1,onChange:a,caller:al});return(0,d.jsx)(tl,{...s,children:(0,d.jsx)(ll,{scope:t,contentId:Cr(),triggerRef:l,open:p,onOpenChange:m,onOpenToggle:c.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:c.useCallback(()=>f(!0),[]),onCustomAnchorRemove:c.useCallback(()=>f(!1),[]),modal:o,children:n})})};dl.displayName=al;var fl=`PopoverAnchor`,pl=c.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=ul(fl,n),a=cl(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return c.useEffect(()=>(o(),()=>s()),[o,s]),(0,d.jsx)(nl,{...a,...r,ref:t})});pl.displayName=fl;var ml=`PopoverTrigger`,hl=c.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=ul(ml,n),a=cl(n),o=P(t,i.triggerRef),s=(0,d.jsx)(Y.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Al(i.open),...r,ref:o,onClick:q(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,d.jsx)(nl,{asChild:!0,...a,children:s})});hl.displayName=ml;var gl=`PopoverPortal`,[_l,vl]=ol(gl,{forceMount:void 0}),yl=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=ul(gl,t);return(0,d.jsx)(_l,{scope:t,forceMount:n,children:(0,d.jsx)(tn,{present:n||a.open,children:(0,d.jsx)(ti,{asChild:!0,container:i,children:r})})})};yl.displayName=gl;var bl=`PopoverContent`,xl=c.forwardRef((e,t)=>{let n=vl(bl,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=ul(bl,e.__scopePopover);return(0,d.jsx)(tn,{present:r||a.open,children:a.modal?(0,d.jsx)(Cl,{...i,ref:t}):(0,d.jsx)(wl,{...i,ref:t})})});xl.displayName=bl;var Sl=on(`PopoverContent.RemoveScroll`),Cl=c.forwardRef((e,t)=>{let n=ul(bl,e.__scopePopover),r=c.useRef(null),i=P(t,r),a=c.useRef(!1);return c.useEffect(()=>{let e=r.current;if(e)return Sa(e)},[]),(0,d.jsx)(pa,{as:Sl,allowPinchZoom:!0,children:(0,d.jsx)(Tl,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:q(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:q(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),wl=c.forwardRef((e,t)=>{let n=ul(bl,e.__scopePopover),r=c.useRef(!1),i=c.useRef(!1);return(0,d.jsx)(Tl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Tl=c.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...f}=e,p=ul(bl,n),m=cl(n);return ri(),(0,d.jsx)(Hr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,d.jsx)(jr,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>p.onOpenChange(!1),children:(0,d.jsx)(rl,{"data-state":Al(p.open),role:`dialog`,id:p.contentId,...m,...f,ref:t,style:{...f.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)`}})})})}),El=`PopoverClose`,Dl=c.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=ul(El,n);return(0,d.jsx)(Y.button,{type:`button`,...r,ref:t,onClick:q(e.onClick,()=>i.onOpenChange(!1))})});Dl.displayName=El;var Ol=`PopoverArrow`,kl=c.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=cl(n);return(0,d.jsx)(il,{...i,...r,ref:t})});kl.displayName=Ol;function Al(e){return e?`open`:`closed`}var jl=dl,Ml=hl,Nl=yl,Pl=xl,Fl=jl,Il=Ml,Ll=c.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,d.jsx)(Nl,{children:(0,d.jsx)(Pl,{ref:i,align:t,sideOffset:n,className:W(`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),...r})}));Ll.displayName=Pl.displayName;var Rl=({onInsert:e})=>{let[t,n]=(0,c.useState)(null),r=async t=>{let r=`{{${t}}}`;try{await navigator.clipboard.writeText(r)}catch{let e=document.createElement(`textarea`);e.value=r,e.style.position=`fixed`,e.style.opacity=`0`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}e&&e(r),n(t),setTimeout(()=>n(null),1500)};return(0,d.jsxs)(Fl,{children:[(0,d.jsx)(Il,{asChild:!0,children:(0,d.jsx)(Z,{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:(0,d.jsx)(l.Braces,{className:`h-3.5 w-3.5`})})}),(0,d.jsxs)(Ll,{className:`w-80 p-0`,align:`end`,side:`left`,sideOffset:6,children:[(0,d.jsxs)(`div`,{className:`px-3 py-2 border-b border-border`,children:[(0,d.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:`Variáveis do evento`}),(0,d.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[`Clique para copiar. Use`,` `,(0,d.jsx)(`code`,{className:`bg-muted px-1 rounded text-[10px]`,children:`{{evento.xxx}}`}),` `,`em labels, placeholders e hints.`]})]}),(0,d.jsx)(`div`,{className:`max-h-64 overflow-y-auto py-1`,children:y.map(e=>{let n=t===e.key;return(0,d.jsxs)(`button`,{type:`button`,onClick:()=>r(e.key),className:W(`w-full flex items-center justify-between px-3 py-1.5 text-left hover:bg-accent transition-colors`,n&&`bg-primary/10`),children:[(0,d.jsxs)(`div`,{className:`min-w-0`,children:[(0,d.jsx)(`p`,{className:`text-xs font-medium truncate`,children:e.label}),(0,d.jsx)(`code`,{className:`text-[10px] text-muted-foreground font-mono`,children:`{{${e.key}}}`})]}),(0,d.jsx)(`div`,{className:`ml-2 shrink-0`,children:n?(0,d.jsx)(l.Check,{className:`h-3.5 w-3.5 text-primary`}):(0,d.jsx)(l.Braces,{className:`h-3 w-3 text-muted-foreground/50`})})]},e.key)})})]})]})},zl=({config:e,onUpdate:t})=>(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Label`}),(0,d.jsx)(Rl,{})]}),(0,d.jsx)(G,{value:e.label,onChange:e=>t({label:e.target.value}),className:`h-8 text-sm`})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Descrição`}),(0,d.jsx)(Rl,{})]}),(0,d.jsx)(G,{value:e.description||``,onChange:e=>t({description:e.target.value}),className:`h-8 text-sm`,placeholder:`Descrição do step`})]}),(0,d.jsx)(xo,{value:e.icone,onChange:e=>t({icone:e})}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(X,{id:`step-show-label`,checked:e.showLabel!==!1,onCheckedChange:e=>t({showLabel:e===!0})}),(0,d.jsx)(K,{htmlFor:`step-show-label`,className:`text-xs cursor-pointer`,children:`Exibir título no formulário`})]})]});function Bl(e){let t=e+`CollectionProvider`,[n,r]=Kt(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=c.default.useRef(null),a=c.default.useRef(new Map).current;return(0,d.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,l=on(s),u=c.default.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,d.jsx)(l,{ref:P(t,a(s,n).collectionRef),children:r})});u.displayName=s;let f=e+`CollectionItemSlot`,p=`data-radix-collection-item`,m=on(f),h=c.default.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=c.default.useRef(null),s=P(t,o),l=a(f,n);return c.default.useEffect(()=>(l.itemMap.set(o,{ref:o,...i}),()=>void l.itemMap.delete(o))),(0,d.jsx)(m,{[p]:``,ref:s,children:r})});h.displayName=f;function g(t){let n=a(e+`CollectionConsumer`,t);return c.default.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:u,ItemSlot:h},g,r]}var Vl=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`}),Hl=`VisuallyHidden`,Ul=c.forwardRef((e,t)=>(0,d.jsx)(Y.span,{...e,ref:t,style:{...Vl,...e.style}}));Ul.displayName=Hl;var Wl=Ul,Gl=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Kl=[` `,`Enter`],ql=`Select`,[Jl,Yl,Xl]=Bl(ql),[Zl,Ql]=Kt(ql,[Xl,zc]),$l=zc(),[eu,tu]=Zl(ql),[nu,ru]=Zl(ql),iu=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:l,dir:u,name:f,autoComplete:p,disabled:m,required:h,form:g}=e,_=$l(t),[v,y]=c.useState(null),[b,x]=c.useState(null),[S,C]=c.useState(!1),w=Mn(u),[T,E]=Yt({prop:r,defaultProp:i??!1,onChange:a,caller:ql}),[D,O]=Yt({prop:o,defaultProp:s,onChange:l,caller:ql}),k=c.useRef(null),A=v?g||!!v.closest(`form`):!0,[j,M]=c.useState(new Set),N=Array.from(j).map(e=>e.props.value).join(`;`);return(0,d.jsx)(tl,{..._,children:(0,d.jsxs)(eu,{required:h,scope:t,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Cr(),value:D,onValueChange:O,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:k,disabled:m,children:[(0,d.jsx)(Jl.Provider,{scope:t,children:(0,d.jsx)(nu,{scope:e.__scopeSelect,onNativeOptionAdd:c.useCallback(e=>{M(t=>new Set(t).add(e))},[]),onNativeOptionRemove:c.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),A?(0,d.jsxs)($u,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:D,onChange:e=>O(e.target.value),disabled:m,form:g,children:[D===void 0?(0,d.jsx)(`option`,{value:``}):null,Array.from(j)]},N):null]})})};iu.displayName=ql;var au=`SelectTrigger`,ou=c.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=$l(n),o=tu(au,n),s=o.disabled||r,l=P(t,o.onTriggerChange),u=Yl(n),f=c.useRef(`touch`),[p,m,h]=td(e=>{let t=u().filter(e=>!e.disabled),n=nd(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),g=e=>{s||(o.onOpenChange(!0),h()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,d.jsx)(nl,{asChild:!0,...a,children:(0,d.jsx)(Y.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":ed(o.value)?``:void 0,...i,ref:l,onClick:q(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:q(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:q(i.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&Gl.includes(e.key)&&(g(),e.preventDefault())})})})});ou.displayName=au;var su=`SelectValue`,cu=c.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=tu(su,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,f=P(t,c.onValueNodeChange);return J(()=>{l(u)},[l,u]),(0,d.jsx)(Y.span,{...s,ref:f,style:{pointerEvents:`none`},children:ed(c.value)?(0,d.jsx)(d.Fragment,{children:o}):a})});cu.displayName=su;var lu=`SelectIcon`,uu=c.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,d.jsx)(Y.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});uu.displayName=lu;var du=`SelectPortal`,fu=e=>(0,d.jsx)(ti,{asChild:!0,...e});fu.displayName=du;var pu=`SelectContent`,mu=c.forwardRef((e,t)=>{let n=tu(pu,e.__scopeSelect),[r,i]=c.useState();if(J(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?f.createPortal((0,d.jsx)(gu,{scope:e.__scopeSelect,children:(0,d.jsx)(Jl.Slot,{scope:e.__scopeSelect,children:(0,d.jsx)(`div`,{children:e.children})})}),t):null}return(0,d.jsx)(bu,{...e,ref:t})});mu.displayName=pu;var hu=10,[gu,_u]=Zl(pu),vu=`SelectContentImpl`,yu=on(`SelectContent.RemoveScroll`),bu=c.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:v,...y}=e,b=tu(pu,n),[x,S]=c.useState(null),[C,w]=c.useState(null),T=P(t,e=>S(e)),[E,D]=c.useState(null),[O,k]=c.useState(null),A=Yl(n),[j,M]=c.useState(!1),N=c.useRef(!1);c.useEffect(()=>{if(x)return Sa(x)},[x]),ri();let ee=c.useCallback(e=>{let[t,...n]=A().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&C&&(C.scrollTop=0),n===r&&C&&(C.scrollTop=C.scrollHeight),n?.focus(),document.activeElement!==i))return},[A,C]),F=c.useCallback(()=>ee([E,x]),[ee,E,x]);c.useEffect(()=>{j&&F()},[j,F]);let{onOpenChange:I,triggerPointerDownPosRef:te}=b;c.useEffect(()=>{if(x){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(te.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(te.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():x.contains(n.target)||I(!1),document.removeEventListener(`pointermove`,t),te.current=null};return te.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[x,I,te]),c.useEffect(()=>{let e=()=>I(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[I]);let[ne,re]=td(e=>{let t=A().filter(e=>!e.disabled),n=nd(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),L=c.useCallback((e,t,n)=>{let r=!N.current&&!n;(b.value!==void 0&&b.value===t||r)&&(D(e),r&&(N.current=!0))},[b.value]),R=c.useCallback(()=>x?.focus(),[x]),ie=c.useCallback((e,t,n)=>{let r=!N.current&&!n;(b.value!==void 0&&b.value===t||r)&&k(e)},[b.value]),ae=r===`popper`?wu:Su,z=ae===wu?{side:s,sideOffset:l,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:v}:{};return(0,d.jsx)(gu,{scope:n,content:x,viewport:C,onViewportChange:w,itemRefCallback:L,selectedItem:E,onItemLeave:R,itemTextRefCallback:ie,focusSelectedItem:F,selectedItemText:O,position:r,isPositioned:j,searchRef:ne,children:(0,d.jsx)(pa,{as:yu,allowPinchZoom:!0,children:(0,d.jsx)(Hr,{asChild:!0,trapped:b.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:q(i,e=>{b.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,d.jsx)(jr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:(0,d.jsx)(ae,{role:`listbox`,id:b.contentId,"data-state":b.open?`open`:`closed`,dir:b.dir,onContextMenu:e=>e.preventDefault(),...y,...z,onPlaced:()=>M(!0),ref:T,style:{display:`flex`,flexDirection:`column`,outline:`none`,...y.style},onKeyDown:q(y.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=A().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>ee(t)),e.preventDefault()}})})})})})})});bu.displayName=vu;var xu=`SelectItemAlignedPosition`,Su=c.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=tu(pu,n),o=_u(pu,n),[s,l]=c.useState(null),[u,f]=c.useState(null),p=P(t,e=>f(e)),m=Yl(n),h=c.useRef(!1),g=c.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=o,x=c.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&u&&_&&v&&y){let e=a.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-hu,d=Nn(a,[hu,Math.max(hu,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-hu,d=Nn(a,[hu,Math.max(hu,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=m(),c=window.innerHeight-hu*2,l=_.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+p+l+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-hu,D=c-E,O=v.offsetHeight/2,k=v.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=o.length>0&&v===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=u.clientHeight-_.offsetTop-_.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+g);s.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,_.scrollTop=A-E+_.offsetTop}s.style.margin=`${hu}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>h.current=!0)}},[m,a.trigger,a.valueNode,s,u,_,v,y,a.dir,r]);J(()=>x(),[x]);let[S,C]=c.useState();return J(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]),(0,d.jsx)(Tu,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:h,onScrollButtonChange:c.useCallback(e=>{e&&g.current===!0&&(x(),b?.(),g.current=!1)},[x,b]),children:(0,d.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,d.jsx)(Y.div,{...i,ref:p,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Su.displayName=xu;var Cu=`SelectPopperPosition`,wu=c.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=hu,...a}=e,o=$l(n);return(0,d.jsx)(rl,{...o,...a,ref:t,align:r,collisionPadding:i,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)`}})});wu.displayName=Cu;var[Tu,Eu]=Zl(pu,{}),Du=`SelectViewport`,Ou=c.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=_u(Du,n),o=Eu(Du,n),s=P(t,a.onViewportChange),l=c.useRef(0);return(0,d.jsxs)(d.Fragment,{children:[(0,d.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:r}),(0,d.jsx)(Jl.Slot,{scope:n,children:(0,d.jsx)(Y.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:q(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-hu*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Ou.displayName=Du;var ku=`SelectGroup`,[Au,ju]=Zl(ku),Mu=c.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Cr();return(0,d.jsx)(Au,{scope:n,id:i,children:(0,d.jsx)(Y.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Mu.displayName=ku;var Nu=`SelectLabel`,Pu=c.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=ju(Nu,n);return(0,d.jsx)(Y.div,{id:i.id,...r,ref:t})});Pu.displayName=Nu;var Fu=`SelectItem`,[Iu,Lu]=Zl(Fu),Ru=c.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=tu(Fu,n),l=_u(Fu,n),u=s.value===r,[f,p]=c.useState(a??``),[m,h]=c.useState(!1),g=P(t,e=>l.itemRefCallback?.(e,r,i)),_=Cr(),v=c.useRef(`touch`),y=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw 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(0,d.jsx)(Iu,{scope:n,value:r,disabled:i,textId:_,isSelected:u,onItemTextChange:c.useCallback(e=>{p(t=>t||(e?.textContent??``).trim())},[]),children:(0,d.jsx)(Jl.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:(0,d.jsx)(Y.div,{role:`option`,"aria-labelledby":_,"data-highlighted":m?``:void 0,"aria-selected":u&&m,"data-state":u?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:g,onFocus:q(o.onFocus,()=>h(!0)),onBlur:q(o.onBlur,()=>h(!1)),onClick:q(o.onClick,()=>{v.current!==`mouse`&&y()}),onPointerUp:q(o.onPointerUp,()=>{v.current===`mouse`&&y()}),onPointerDown:q(o.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:q(o.onPointerMove,e=>{v.current=e.pointerType,i?l.onItemLeave?.():v.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:q(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:q(o.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(Kl.includes(e.key)&&y(),e.key===` `&&e.preventDefault())})})})})});Ru.displayName=Fu;var zu=`SelectItemText`,Bu=c.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=tu(zu,n),s=_u(zu,n),l=Lu(zu,n),u=ru(zu,n),[p,m]=c.useState(null),h=P(t,e=>m(e),l.onItemTextChange,e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),g=p?.textContent,_=c.useMemo(()=>(0,d.jsx)(`option`,{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=u;return J(()=>(v(_),()=>y(_)),[v,y,_]),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Y.span,{id:l.textId,...a,ref:h}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?f.createPortal(a.children,o.valueNode):null]})});Bu.displayName=zu;var Vu=`SelectItemIndicator`,Hu=c.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Lu(Vu,n).isSelected?(0,d.jsx)(Y.span,{"aria-hidden":!0,...r,ref:t}):null});Hu.displayName=Vu;var Uu=`SelectScrollUpButton`,Wu=c.forwardRef((e,t)=>{let n=_u(Uu,e.__scopeSelect),r=Eu(Uu,e.__scopeSelect),[i,a]=c.useState(!1),o=P(t,r.onScrollButtonChange);return J(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,d.jsx)(qu,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Wu.displayName=Uu;var Gu=`SelectScrollDownButton`,Ku=c.forwardRef((e,t)=>{let n=_u(Gu,e.__scopeSelect),r=Eu(Gu,e.__scopeSelect),[i,a]=c.useState(!1),o=P(t,r.onScrollButtonChange);return J(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,d.jsx)(qu,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Ku.displayName=Gu;var qu=c.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=_u(`SelectScrollButton`,n),o=c.useRef(null),s=Yl(n),l=c.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return c.useEffect(()=>()=>l(),[l]),J(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,d.jsx)(Y.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:q(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:q(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:q(i.onPointerLeave,()=>{l()})})}),Ju=`SelectSeparator`,Yu=c.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,d.jsx)(Y.div,{"aria-hidden":!0,...r,ref:t})});Yu.displayName=Ju;var Xu=`SelectArrow`,Zu=c.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=$l(n),a=tu(Xu,n),o=_u(Xu,n);return a.open&&o.position===`popper`?(0,d.jsx)(il,{...i,...r,ref:t}):null});Zu.displayName=Xu;var Qu=`SelectBubbleInput`,$u=c.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=c.useRef(null),a=P(r,i),o=Qt(t);return c.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,d.jsx)(Y.select,{...n,style:{...Vl,...n.style},ref:a,defaultValue:t})});$u.displayName=Qu;function ed(e){return e===``||e===void 0}function td(e){let t=Q(e),n=c.useRef(``),r=c.useRef(0),i=c.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=c.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return c.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function nd(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=rd(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function rd(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var id=iu,ad=ou,od=cu,sd=uu,cd=fu,ld=mu,ud=Ou,dd=Pu,fd=Ru,pd=Bu,md=Hu,hd=Wu,gd=Ku,_d=Yu,vd=id,yd=od,bd=c.forwardRef(({className:e,children:t,...n},r)=>(0,d.jsxs)(ad,{ref:r,className:W(`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),...n,children:[t,(0,d.jsx)(sd,{asChild:!0,children:(0,d.jsx)(l.ChevronDown,{className:`h-4 w-4 opacity-50`})})]}));bd.displayName=ad.displayName;var xd=c.forwardRef(({className:e,...t},n)=>(0,d.jsx)(hd,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,d.jsx)(l.ChevronUp,{className:`h-4 w-4`})}));xd.displayName=hd.displayName;var Sd=c.forwardRef(({className:e,...t},n)=>(0,d.jsx)(gd,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,d.jsx)(l.ChevronDown,{className:`h-4 w-4`})}));Sd.displayName=gd.displayName;var Cd=c.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,d.jsx)(cd,{children:(0,d.jsxs)(ld,{ref:i,className:W(`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`,n===`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:n,...r,children:[(0,d.jsx)(xd,{}),(0,d.jsx)(ud,{className:W(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,d.jsx)(Sd,{})]})}));Cd.displayName=ld.displayName;var wd=c.forwardRef(({className:e,...t},n)=>(0,d.jsx)(dd,{ref:n,className:W(`py-1.5 pl-8 pr-2 text-sm font-semibold`,e),...t}));wd.displayName=dd.displayName;var $=c.forwardRef(({className:e,children:t,...n},r)=>(0,d.jsxs)(fd,{ref:r,className:W(`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),...n,children:[(0,d.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,d.jsx)(md,{children:(0,d.jsx)(l.Check,{className:`h-4 w-4`})})}),(0,d.jsx)(pd,{children:t})]}));$.displayName=fd.displayName;var Td=c.forwardRef(({className:e,...t},n)=>(0,d.jsx)(_d,{ref:n,className:W(`-mx-1 my-1 h-px bg-muted`,e),...t}));Td.displayName=_d.displayName;var Ed=[`PageUp`,`PageDown`],Dd=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Od={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageDown`,`ArrowUp`,`ArrowLeft`]},kd=`Slider`,[Ad,jd,Md]=Bl(kd),[Nd,Pd]=Kt(kd,[Md]),[Fd,Id]=Nd(kd),Ld=c.forwardRef((e,t)=>{let{name:n,min:r=0,max:i=100,step:a=1,orientation:o=`horizontal`,disabled:s=!1,minStepsBetweenThumbs:l=0,defaultValue:u=[r],value:f,onValueChange:p=()=>{},onValueCommit:m=()=>{},inverted:h=!1,form:g,..._}=e,v=c.useRef(new Set),y=c.useRef(0),b=o===`horizontal`?Bd:Vd,[x=[],S]=Yt({prop:f,defaultProp:u,onChange:e=>{[...v.current][y.current]?.focus(),p(e)}}),C=c.useRef(x);function w(e){D(e,tf(x,e))}function T(e){D(e,y.current)}function E(){let e=C.current[y.current];x[y.current]!==e&&m(x)}function D(e,t,{commit:n}={commit:!1}){let o=sf(a),s=Nn(cf(Math.round((e-r)/a)*a+r,o),[r,i]);S((e=[])=>{let r=Qd(e,s,t);if(af(r,l*a)){y.current=r.indexOf(s);let t=String(r)!==String(e);return t&&n&&m(r),t?r:e}else return e})}return(0,d.jsx)(Fd,{scope:e.__scopeSlider,name:n,disabled:s,min:r,max:i,valueIndexToChangeRef:y,thumbs:v.current,values:x,orientation:o,form:g,children:(0,d.jsx)(Ad.Provider,{scope:e.__scopeSlider,children:(0,d.jsx)(Ad.Slot,{scope:e.__scopeSlider,children:(0,d.jsx)(b,{"aria-disabled":s,"data-disabled":s?``:void 0,..._,ref:t,onPointerDown:q(_.onPointerDown,()=>{s||(C.current=x)}),min:r,max:i,inverted:h,onSlideStart:s?void 0:w,onSlideMove:s?void 0:T,onSlideEnd:s?void 0:E,onHomeKeyDown:()=>!s&&D(r,0,{commit:!0}),onEndKeyDown:()=>!s&&D(i,x.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!s){let n=Ed.includes(e.key)||e.shiftKey&&Dd.includes(e.key)?10:1,r=y.current,i=x[r];D(i+a*n*t,r,{commit:!0})}}})})})})});Ld.displayName=kd;var[Rd,zd]=Nd(kd,{startEdge:`left`,endEdge:`right`,size:`width`,direction:1}),Bd=c.forwardRef((e,t)=>{let{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:s,onSlideEnd:l,onStepKeyDown:u,...f}=e,[p,m]=c.useState(null),h=P(t,e=>m(e)),g=c.useRef(void 0),_=Mn(i),v=_===`ltr`,y=v&&!a||!v&&a;function b(e){let t=g.current||p.getBoundingClientRect(),i=of([0,t.width],y?[n,r]:[r,n]);return g.current=t,i(e-t.left)}return(0,d.jsx)(Rd,{scope:e.__scopeSlider,startEdge:y?`left`:`right`,endEdge:y?`right`:`left`,direction:y?1:-1,size:`width`,children:(0,d.jsx)(Hd,{dir:_,"data-orientation":`horizontal`,...f,ref:h,style:{...f.style,"--radix-slider-thumb-transform":`translateX(-50%)`},onSlideStart:e=>{let t=b(e.clientX);o?.(t)},onSlideMove:e=>{let t=b(e.clientX);s?.(t)},onSlideEnd:()=>{g.current=void 0,l?.()},onStepKeyDown:e=>{let t=Od[y?`from-left`:`from-right`].includes(e.key);u?.({event:e,direction:t?-1:1})}})})}),Vd=c.forwardRef((e,t)=>{let{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:s,onStepKeyDown:l,...u}=e,f=c.useRef(null),p=P(t,f),m=c.useRef(void 0),h=!i;function g(e){let t=m.current||f.current.getBoundingClientRect(),i=of([0,t.height],h?[r,n]:[n,r]);return m.current=t,i(e-t.top)}return(0,d.jsx)(Rd,{scope:e.__scopeSlider,startEdge:h?`bottom`:`top`,endEdge:h?`top`:`bottom`,size:`height`,direction:h?1:-1,children:(0,d.jsx)(Hd,{"data-orientation":`vertical`,...u,ref:p,style:{...u.style,"--radix-slider-thumb-transform":`translateY(50%)`},onSlideStart:e=>{let t=g(e.clientY);a?.(t)},onSlideMove:e=>{let t=g(e.clientY);o?.(t)},onSlideEnd:()=>{m.current=void 0,s?.()},onStepKeyDown:e=>{let t=Od[h?`from-bottom`:`from-top`].includes(e.key);l?.({event:e,direction:t?-1:1})}})})}),Hd=c.forwardRef((e,t)=>{let{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:s,onStepKeyDown:c,...l}=e,u=Id(kd,n);return(0,d.jsx)(Y.span,{...l,ref:t,onKeyDown:q(e.onKeyDown,e=>{e.key===`Home`?(o(e),e.preventDefault()):e.key===`End`?(s(e),e.preventDefault()):Ed.concat(Dd).includes(e.key)&&(c(e),e.preventDefault())}),onPointerDown:q(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),u.thumbs.has(t)?t.focus():r(e)}),onPointerMove:q(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&i(e)}),onPointerUp:q(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))})})}),Ud=`SliderTrack`,Wd=c.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=Id(Ud,n);return(0,d.jsx)(Y.span,{"data-disabled":i.disabled?``:void 0,"data-orientation":i.orientation,...r,ref:t})});Wd.displayName=Ud;var Gd=`SliderRange`,Kd=c.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=Id(Gd,n),a=zd(Gd,n),o=P(t,c.useRef(null)),s=i.values.length,l=i.values.map(e=>$d(e,i.min,i.max)),u=s>1?Math.min(...l):0,f=100-Math.max(...l);return(0,d.jsx)(Y.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?``:void 0,...r,ref:o,style:{...e.style,[a.startEdge]:u+`%`,[a.endEdge]:f+`%`}})});Kd.displayName=Gd;var qd=`SliderThumb`,Jd=c.forwardRef((e,t)=>{let n=jd(e.__scopeSlider),[r,i]=c.useState(null),a=P(t,e=>i(e)),o=c.useMemo(()=>r?n().findIndex(e=>e.ref.current===r):-1,[n,r]);return(0,d.jsx)(Yd,{...e,ref:a,index:o})}),Yd=c.forwardRef((e,t)=>{let{__scopeSlider:n,index:r,name:i,...a}=e,o=Id(qd,n),s=zd(qd,n),[l,u]=c.useState(null),f=P(t,e=>u(e)),p=l?o.form||!!l.closest(`form`):!0,m=$t(l),h=o.values[r],g=h===void 0?0:$d(h,o.min,o.max),_=ef(r,o.values.length),v=m?.[s.size],y=v?nf(v,g,s.direction):0;return c.useEffect(()=>{if(l)return o.thumbs.add(l),()=>{o.thumbs.delete(l)}},[l,o.thumbs]),(0,d.jsxs)(`span`,{style:{transform:`var(--radix-slider-thumb-transform)`,position:`absolute`,[s.startEdge]:`calc(${g}% + ${y}px)`},children:[(0,d.jsx)(Ad.ItemSlot,{scope:e.__scopeSlider,children:(0,d.jsx)(Y.span,{role:`slider`,"aria-label":e[`aria-label`]||_,"aria-valuemin":o.min,"aria-valuenow":h,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?``:void 0,tabIndex:o.disabled?void 0:0,...a,ref:f,style:h===void 0?{display:`none`}:e.style,onFocus:q(e.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),p&&(0,d.jsx)(Zd,{name:i??(o.name?o.name+(o.values.length>1?`[]`:``):void 0),form:o.form,value:h},r)]})});Jd.displayName=qd;var Xd=`RadioBubbleInput`,Zd=c.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{let i=c.useRef(null),a=P(i,r),o=Qt(t);return c.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`input`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,d.jsx)(Y.input,{style:{display:`none`},...n,ref:a,defaultValue:t})});Zd.displayName=Xd;function Qd(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}function $d(e,t,n){return Nn(100/(n-t)*(e-t),[0,100])}function ef(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}function tf(e,t){if(e.length===1)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}function nf(e,t,n){let r=e/2;return(r-of([0,50],[0,r])(t)*n)*n}function rf(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function af(e,t){if(t>0){let n=rf(e);return Math.min(...n)>=t}return!0}function of(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function sf(e){return(String(e).split(`.`)[1]||``).length}function cf(e,t){let n=10**t;return Math.round(e*n)/n}var lf=Ld,uf=Wd,df=Kd,ff=Jd,pf=c.forwardRef(({className:e,...t},n)=>(0,d.jsxs)(lf,{ref:n,className:W(`relative flex w-full touch-none select-none items-center`,e),...t,children:[(0,d.jsx)(uf,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,d.jsx)(df,{className:`absolute h-full bg-primary`})}),(0,d.jsx)(ff,{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`})]}));pf.displayName=lf.displayName;var mf=({inicioColuna:e,tamanho:t,onSelect:n})=>(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Posição no grid`}),(0,d.jsx)(`div`,{className:`flex gap-0.5`,children:Array.from({length:12},(r,i)=>{let a=i+1;return(0,d.jsx)(`button`,{onClick:()=>n(a),className:W(`flex-1 h-6 rounded-sm text-[8px] font-mono transition-all border`,a>=e&&a<e+t?`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)})}),(0,d.jsxs)(`p`,{className:`text-[9px] text-muted-foreground`,children:[`Início: col `,e,` · Span: `,t]})]}),hf=({tamanho:e,inicioColuna:t,defaultTamanho:n=6,onTamanhoChange:r,onPositionChange:i})=>{let a=13-t;return(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsxs)(K,{className:`text-xs`,children:[`Tamanho (`,e,`/12 colunas)`]}),(0,d.jsx)(pf,{value:[e],onValueChange:([e])=>{r(Math.min(e,a))},min:1,max:a,step:1,className:`py-1`}),(0,d.jsxs)(`div`,{className:`flex justify-between text-[9px] text-muted-foreground`,children:[(0,d.jsx)(`span`,{children:`1`}),(0,d.jsx)(`span`,{children:`3`}),(0,d.jsx)(`span`,{children:`6`}),(0,d.jsx)(`span`,{children:`9`}),(0,d.jsx)(`span`,{children:`12`})]})]}),(0,d.jsx)(mf,{inicioColuna:t,tamanho:e,onSelect:t=>{let n=13-t,a=Math.min(e,n);i(t),a!==e&&r(a)}})]})},gf=({config:e,onUpdate:t})=>(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Label`}),(0,d.jsx)(Rl,{})]}),(0,d.jsx)(G,{value:e.label,onChange:e=>t({label:e.target.value}),className:`h-8 text-sm`})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Descrição`}),(0,d.jsx)(Rl,{})]}),(0,d.jsx)(G,{value:e.description||``,onChange:e=>t({description:e.target.value}),className:`h-8 text-sm`,placeholder:`Descrição do container`})]}),(0,d.jsx)(xo,{value:e.icone,onChange:e=>t({icone:e})}),(0,d.jsx)(hf,{tamanho:e.tamanho||12,inicioColuna:e.inicioColuna||1,defaultTamanho:12,onTamanhoChange:e=>t({tamanho:e}),onPositionChange:e=>t({inicioColuna:e})}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Colunas internas`}),(0,d.jsxs)(vd,{value:String(e.columns||2),onValueChange:e=>t({columns:Number(e)}),children:[(0,d.jsx)(bd,{className:`h-8 text-sm`,children:(0,d.jsx)(yd,{})}),(0,d.jsxs)(Cd,{children:[(0,d.jsx)($,{value:`1`,children:`1 coluna`}),(0,d.jsx)($,{value:`2`,children:`2 colunas`}),(0,d.jsx)($,{value:`3`,children:`3 colunas`}),(0,d.jsx)($,{value:`4`,children:`4 colunas`})]})]}),(0,d.jsx)(`p`,{className:`text-[9px] text-muted-foreground`,children:`Grid interno simplificado para campos`})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(X,{id:`show-label`,checked:e.showLabel!==!1,onCheckedChange:e=>t({showLabel:e===!0})}),(0,d.jsx)(K,{htmlFor:`show-label`,className:`text-xs cursor-pointer`,children:`Exibir label no formulário`})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(X,{id:`show-as-card`,checked:e.showAsCard||!1,onCheckedChange:e=>t({showAsCard:e===!0})}),(0,d.jsx)(K,{htmlFor:`show-as-card`,className:`text-xs cursor-pointer`,children:`Exibir como card`})]})]}),_f=c.forwardRef(({className:e,...t},n)=>(0,d.jsx)(`textarea`,{className:W(`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:n,...t}));_f.displayName=`Textarea`;function vf(e,t=[]){let n=[];function r(t,r){let i=c.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,l=c.useMemo(()=>o,Object.values(o));return(0,d.jsx)(s.Provider,{value:l,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,l=c.useContext(s);if(l)return l;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>c.createContext(e));return function(n){let r=n?.[e]||t;return c.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,yf(i,...t)]}function yf(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return c.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var bf=`Progress`,xf=100,[Sf,Cf]=vf(bf),[wf,Tf]=Sf(bf),Ef=c.forwardRef((e,t)=>{let{__scopeProgress:n,value:r=null,max:i,getValueLabel:a=kf,...o}=e;(i||i===0)&&!Mf(i)&&console.error(Pf(`${i}`,`Progress`));let s=Mf(i)?i:xf;r!==null&&!Nf(r,s)&&console.error(Ff(`${r}`,`Progress`));let c=Nf(r,s)?r:null,l=jf(c)?a(c,s):void 0;return(0,d.jsx)(wf,{scope:n,value:c,max:s,children:(0,d.jsx)(oe.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":jf(c)?c:void 0,"aria-valuetext":l,role:`progressbar`,"data-state":Af(c,s),"data-value":c??void 0,"data-max":s,...o,ref:t})})});Ef.displayName=bf;var Df=`ProgressIndicator`,Of=c.forwardRef((e,t)=>{let{__scopeProgress:n,...r}=e,i=Tf(Df,n);return(0,d.jsx)(oe.div,{"data-state":Af(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:t})});Of.displayName=Df;function kf(e,t){return`${Math.round(e/t*100)}%`}function Af(e,t){return e==null?`indeterminate`:e===t?`complete`:`loading`}function jf(e){return typeof e==`number`}function Mf(e){return jf(e)&&!isNaN(e)&&e>0}function Nf(e,t){return jf(e)&&!isNaN(e)&&e<=t&&e>=0}function Pf(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${xf}\`.`}function Ff(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:W("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:W("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(T.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:W("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:W("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:W("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 T.icons[t]??null}return T.icons[e]??null}const Dn=Object.entries(T.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(T.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(X,{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,A=P/2-h[g]/2-1,I=Je(p[b],A),O=Je(p[w],A),D=I,F=P-h[g]-O,z=P/2-h[g]/2+y,V=io(D,z,F),k=!c.arrow&&St(s)!=null&&z!==V&&a.reference[g]/2-(z<D?I:O)-h[g]/2<0,E=k?z<D?z-D:z-F:0;return{[x]:f[x]+E,data:{[x]:V,centerOffset:z-V-E,...k&&{alignmentOffset:E}},reset:k}}}),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),A=[];let I=((n=a.flip)==null?void 0:n.overflows)||[];if(m&&A.push(y[b]),p){const z=qu(s,i,C);A.push(y[z[0]],y[z[1]])}if(I=[...I,{placement:s,overflows:A}],!A.every(z=>z<=0)){var O,D;const z=(((O=a.flip)==null?void 0:O.index)||0)+1,V=P[z];if(V&&(!(p==="alignment"?w!==Le(V):!1)||I.every(R=>Le(R.placement)===w?R.overflows[0]>0:!0)))return{data:{index:z,overflows:I},reset:{placement:V}};let k=(D=I.filter(E=>E.overflows[0]<=0).sort((E,R)=>E.overflows[1]-R.overflows[1])[0])==null?void 0:D.placement;if(!k)switch(x){case"bestFit":{var F;const E=(F=I.filter(R=>{if(S){const $=Le(R.placement);return $===w||$==="y"}return!0}).map(R=>[R.placement,R.overflows.filter($=>$>0).reduce(($,L)=>$+L,0)]).sort((R,$)=>R[1]-$[1])[0])==null?void 0:F[0];E&&(k=E);break}case"initialPlacement":k=l;break}if(s!==k)return{reset:{placement:k}}}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),O=ve(m.right,0),D=ve(m.top,0),F=ve(m.bottom,0);x?y=g-2*(I!==0||O!==0?I+O: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),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),A=c!=null,I=to(c),O=to(s),D=to(d),F=u.useCallback(()=>{if(!S.current||!P.current)return;const R={placement:t,strategy:r,middleware:f};O.current&&(R.platform=O.current),Mm(S.current,P.current,R).then($=>{const L={...$,isPositioned:D.current!==!1};z.current&&!cr(y.current,L)&&(y.current=L,fr.flushSync(()=>{p(L)}))})},[f,t,r,O,D]);er(()=>{d===!1&&y.current.isPositioned&&(y.current.isPositioned=!1,p(R=>({...R,isPositioned:!1})))},[d]);const z=u.useRef(!1);er(()=>(z.current=!0,()=>{z.current=!1}),[]),er(()=>{if(C&&(S.current=C),j&&(P.current=j),C&&j){if(I.current)return I.current(C,j,F);F()}},[C,j,F,I,A]);const V=u.useMemo(()=>({reference:S,floating:P,setReference:w,setFloating:N}),[w,N]),k=u.useMemo(()=>({reference:C,floating:j}),[C,j]),E=u.useMemo(()=>{const R={position:r,left:0,top:0};if(!k.floating)return R;const $=qn(k.floating,m.x),L=qn(k.floating,m.y);return l?{...R,transform:"translate("+$+"px, "+L+"px)",...Ga(k.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:$,top:L}},[r,l,k.floating,m.x,m.y]);return u.useMemo(()=>({...m,update:F,refs:V,elements:k,floatingStyles:E}),[m,F,V,k,E])}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(J.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=te(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(J.div,{...s,ref:l})});Ja.displayName=Ka;var Qo="PopperContent",[Jm,Qm]=Xa(Qo),Qa=u.forwardRef((e,t)=>{var M,re,Z,K,G,Q;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=te(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,A=n+(a!=="center"?"-"+a:""),I=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},O=Array.isArray(d)?d:[d],D=O.length>0,F={padding:I,boundary:O.filter(tp),altBoundary:D},{refs:z,floatingStyles:V,placement:k,isPositioned:E,middlewareData:R}=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`)}}),C&&Xm({element:C,padding:l}),rp({arrowWidth:P,arrowHeight:y}),f&&qm({strategy:"referenceHidden",...F})]}),[$,L]=ri(k),q=ge(g);he(()=>{E&&(q==null||q())},[E,q]);const ne=(M=R.arrow)==null?void 0:M.x,ae=(re=R.arrow)==null?void 0:re.y,ie=((Z=R.arrow)==null?void 0:Z.centerOffset)!==0,[oe,se]=u.useState();return he(()=>{b&&se(window.getComputedStyle(b).zIndex)},[b]),o.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:E?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[(K=R.transformOrigin)==null?void 0:K.x,(G=R.transformOrigin)==null?void 0:G.y].join(" "),...((Q=R.hide)==null?void 0:Q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(Jm,{scope:r,placedSide:$,onArrowChange:j,arrowX:ne,arrowY:ae,shouldHideArrow:ie,children:o.jsx(J.div,{"data-side":$,"data-align":L,...h,ref:N,style:{...h.style,animation:E?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=te(t,s.triggerRef),l=o.jsx(J.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":mi(s.open),...n,ref:i,onClick:Y(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=te(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:Y(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),a.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Y(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:Y(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(J.button,{type:"button",...n,ref:t,onClick:Y(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:W("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(T.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:W("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(T.Check,{className:"h-3.5 w-3.5 text-primary"}):o.jsx(T.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(X,{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(X,{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=te(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=te(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(J.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}),[A,I]=it({prop:i,defaultProp:l,onChange:c,caller:dt}),O=u.useRef(null),D=v?g||!!v.closest("form"):!0,[F,z]=u.useState(new Set),V=Array.from(F).map(k=>k.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:A,onValueChange:I,open:P,onOpenChange:y,dir:S,triggerPointerDownPosRef:O,disabled:f,children:[o.jsx(Lr.Provider,{scope:t,children:o.jsx(Cp,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(k=>{z(E=>new Set(E).add(k))},[]),onNativeOptionRemove:u.useCallback(k=>{z(E=>{const R=new Set(E);return R.delete(k),R})},[]),children:r})}),D?o.jsxs(Vi,{"aria-hidden":!0,required:x,tabIndex:-1,name:m,autoComplete:p,value:A,onChange:k=>I(k.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=te(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(J.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:Y(s.onClick,h=>{h.currentTarget.focus(),m.current!=="mouse"&&g(h)}),onPointerDown:Y(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:Y(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=te(t,c.onValueNodeChange);return he(()=>{d(m)},[d,m]),o.jsx(J.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(J.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=te(t,M=>C(M)),[y,A]=u.useState(null),[I,O]=u.useState(null),D=Or(r),[F,z]=u.useState(!1),V=u.useRef(!1);u.useEffect(()=>{if(N)return Bo(N)},[N]),Vo();const k=u.useCallback(M=>{const[re,...Z]=D().map(Q=>Q.ref.current),[K]=Z.slice(-1),G=document.activeElement;for(const Q of M)if(Q===G||(Q==null||Q.scrollIntoView({block:"nearest"}),Q===re&&j&&(j.scrollTop=0),Q===K&&j&&(j.scrollTop=j.scrollHeight),Q==null||Q.focus(),document.activeElement!==G))return},[D,j]),E=u.useCallback(()=>k([y,N]),[k,y,N]);u.useEffect(()=>{F&&E()},[F,E]);const{onOpenChange:R,triggerPointerDownPosRef:$}=w;u.useEffect(()=>{if(N){let M={x:0,y:0};const re=K=>{var G,Q;M={x:Math.abs(Math.round(K.pageX)-(((G=$.current)==null?void 0:G.x)??0)),y:Math.abs(Math.round(K.pageY)-(((Q=$.current)==null?void 0:Q.y)??0))}},Z=K=>{M.x<=10&&M.y<=10?K.preventDefault():N.contains(K.target)||R(!1),document.removeEventListener("pointermove",re),$.current=null};return $.current!==null&&(document.addEventListener("pointermove",re),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",re),document.removeEventListener("pointerup",Z,{capture:!0})}}},[N,R,$]),u.useEffect(()=>{const M=()=>R(!1);return window.addEventListener("blur",M),window.addEventListener("resize",M),()=>{window.removeEventListener("blur",M),window.removeEventListener("resize",M)}},[R]);const[L,q]=Wi(M=>{const re=D().filter(G=>!G.disabled),Z=re.find(G=>G.ref.current===document.activeElement),K=Hi(re,M,Z);K&&setTimeout(()=>K.ref.current.focus())}),ne=u.useCallback((M,re,Z)=>{const K=!V.current&&!Z;(w.value!==void 0&&w.value===re||K)&&(A(M),K&&(V.current=!0))},[w.value]),ae=u.useCallback(()=>N==null?void 0:N.focus(),[N]),ie=u.useCallback((M,re,Z)=>{const K=!V.current&&!Z;(w.value!==void 0&&w.value===re||K)&&O(M)},[w.value]),oe=n==="popper"?uo:Ri,se=oe===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:ne,selectedItem:y,onItemLeave:ae,itemTextRefCallback:ie,focusSelectedItem:E,selectedItemText:I,position:n,isPositioned:F,searchRef:L,children:o.jsx(Cr,{as:Ep,allowPinchZoom:!0,children:o.jsx(yr,{asChild:!0,trapped:w.open,onMountAutoFocus:M=>{M.preventDefault()},onUnmountAutoFocus:Y(s,M=>{var re;(re=w.trigger)==null||re.focus({preventScroll:!0}),M.preventDefault()}),children:o.jsx($t,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:M=>M.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:o.jsx(oe,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:M=>M.preventDefault(),...b,...se,onPlaced:()=>z(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Y(b.onKeyDown,M=>{const re=M.ctrlKey||M.altKey||M.metaKey;if(M.key==="Tab"&&M.preventDefault(),!re&&M.key.length===1&&q(M.key),["ArrowUp","ArrowDown","Home","End"].includes(M.key)){let K=D().filter(G=>!G.disabled).map(G=>G.ref.current);if(["ArrowUp","End"].includes(M.key)&&(K=K.slice().reverse()),["ArrowUp","ArrowDown"].includes(M.key)){const G=M.target,Q=K.indexOf(G);K=K.slice(Q+1)}setTimeout(()=>k(K)),M.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=te(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(),A=a.valueNode.getBoundingClientRect(),I=b.getBoundingClientRect();if(a.dir!=="rtl"){const G=I.left-y.left,Q=A.left-G,ue=P.left-Q,ce=P.width+ue,He=Math.max(ce,y.width),Ue=window.innerWidth-Re,kt=Ot(Q,[Re,Math.max(Re,Ue-He)]);l.style.minWidth=ce+"px",l.style.left=kt+"px"}else{const G=y.right-I.right,Q=window.innerWidth-A.right-G,ue=window.innerWidth-P.right-Q,ce=P.width+ue,He=Math.max(ce,y.width),Ue=window.innerWidth-Re,kt=Ot(Q,[Re,Math.max(Re,Ue-He)]);l.style.minWidth=ce+"px",l.style.right=kt+"px"}const O=f(),D=window.innerHeight-Re*2,F=h.scrollHeight,z=window.getComputedStyle(d),V=parseInt(z.borderTopWidth,10),k=parseInt(z.paddingTop,10),E=parseInt(z.borderBottomWidth,10),R=parseInt(z.paddingBottom,10),$=V+k+F+R+E,L=Math.min(v.offsetHeight*5,$),q=window.getComputedStyle(h),ne=parseInt(q.paddingTop,10),ae=parseInt(q.paddingBottom,10),ie=P.top+P.height/2-Re,oe=D-ie,se=v.offsetHeight/2,M=v.offsetTop+se,re=V+k+M,Z=$-re;if(re<=ie){const G=O.length>0&&v===O[O.length-1].ref.current;l.style.bottom="0px";const Q=d.clientHeight-h.offsetTop-h.offsetHeight,ue=Math.max(oe,se+(G?ae:0)+Q+E),ce=re+ue;l.style.height=ce+"px"}else{const G=O.length>0&&v===O[0].ref.current;l.style.top="0px";const ue=Math.max(ie,V+h.offsetTop+(G?ne:0)+se)+Z;l.style.height=ue+"px",h.scrollTop=re-ie+h.offsetTop}l.style.margin=`${Re}px 0`,l.style.minHeight=L+"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(J.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=te(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(J.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Y(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(J.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(J.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=te(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(J.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:Y(i.onFocus,()=>x(!0)),onBlur:Y(i.onBlur,()=>x(!1)),onClick:Y(i.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:Y(i.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:Y(i.onPointerDown,w=>{v.current=w.pointerType}),onPointerMove:Y(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:Y(i.onPointerLeave,w=>{var N;w.currentTarget===document.activeElement&&((N=c.onItemLeave)==null||N.call(c))}),onKeyDown:Y(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=te(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(J.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(J.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=te(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=te(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(J.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Y(s.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:Y(s.onPointerMove,()=>{var d;(d=a.onItemLeave)==null||d.call(a),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:Y(s.onPointerLeave,()=>{c()})})}),Dp="SelectSeparator",zi=u.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return o.jsx(J.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=te(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(J.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:W("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(T.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:W("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(T.ChevronUp,{className:"h-4 w-4"})}));Ji.displayName=Yi.displayName;const Qi=u.forwardRef(({className:e,...t},r)=>o.jsx(Zi,{ref:r,className:W("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(T.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:W("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:W("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:W("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:W("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(T.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:W("-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:O=>{var F;(F=[...v.current][b.current])==null||F.focus(),p(O)}}),S=u.useRef(C);function P(O){const D=nf(C,O);I(O,D)}function y(O){I(O,b.current)}function A(){const O=S.current[b.current];C[b.current]!==O&&f(C)}function I(O,D,{commit:F}={commit:!1}){const z=cf(a),V=df(Math.round((O-n)/a)*a+n,z),k=Ot(V,[n,s]);j((E=[])=>{const R=rf(E,k,D);if(lf(R,c*a)){b.current=R.indexOf(k);const $=String(R)!==String(E);return $&&F&&f(R),$?R:E}else return E})}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:Y(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:A,onHomeKeyDown:()=>!l&&I(n,0,{commit:!0}),onEndKeyDown:()=>!l&&I(s,C.length-1,{commit:!0}),onStepKeyDown:({event:O,direction:D})=>{if(!l){const V=el.includes(O.key)||O.shiftKey&&tl.includes(O.key)?10:1,k=b.current,E=C[k],R=a*V*D;I(E+R,k,{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=te(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=te(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(J.span,{...d,ref:t,onKeyDown:Y(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:Y(e.onPointerDown,p=>{const f=p.target;f.setPointerCapture(p.pointerId),p.preventDefault(),m.thumbs.has(f)?f.focus():n(p)}),onPointerMove:Y(e.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&s(p)}),onPointerUp:Y(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(J.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=te(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(J.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=te(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=te(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(J.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:Y(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=te(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(J.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:W("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:W("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(X,{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(X,{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:W("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
- - less than the value passed to \`max\` (or ${xf} if no \`max\` prop is set)
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 If=Ef,Lf=Of,Rf=c.forwardRef(({className:e,value:t,...n},r)=>(0,d.jsx)(If,{ref:r,className:W(`relative h-4 w-full overflow-hidden rounded-full bg-secondary`,e),...n,children:(0,d.jsx)(Lf,{className:`h-full w-full flex-1 bg-primary transition-all`,style:{transform:`translateX(-${100-(t||0)}%)`}})}));Rf.displayName=If.displayName;var[zf,Bf]=Kt(`Tooltip`,[zc]),Vf=zc(),Hf=`TooltipProvider`,Uf=700,Wf=`tooltip.open`,[Gf,Kf]=zf(Hf),qf=e=>{let{__scopeTooltip:t,delayDuration:n=Uf,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=c.useRef(!0),s=c.useRef(!1),l=c.useRef(0);return c.useEffect(()=>{let e=l.current;return()=>window.clearTimeout(e)},[]),(0,d.jsx)(Gf,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:c.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:c.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:c.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};qf.displayName=Hf;var Jf=`Tooltip`,[Yf,Xf]=zf(Jf),Zf=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,l=Kf(Jf,e.__scopeTooltip),u=Vf(t),[f,p]=c.useState(null),m=Cr(),h=c.useRef(0),g=o??l.disableHoverableContent,_=s??l.delayDuration,v=c.useRef(!1),[y,b]=Yt({prop:r,defaultProp:i??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(Wf))):l.onClose(),a?.(e)},caller:Jf}),x=c.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=c.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=c.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=c.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);return c.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,d.jsx)(tl,{...u,children:(0,d.jsx)(Yf,{scope:t,contentId:m,open:y,stateAttribute:x,trigger:f,onTriggerChange:p,onTriggerEnter:c.useCallback(()=>{l.isOpenDelayedRef.current?w():S()},[l.isOpenDelayedRef,w,S]),onTriggerLeave:c.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})};Zf.displayName=Jf;var Qf=`TooltipTrigger`,$f=c.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Xf(Qf,n),a=Kf(Qf,n),o=Vf(n),s=P(t,c.useRef(null),i.onTriggerChange),l=c.useRef(!1),u=c.useRef(!1),f=c.useCallback(()=>l.current=!1,[]);return c.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,d.jsx)(nl,{asChild:!0,...o,children:(0,d.jsx)(Y.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:q(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:q(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:q(e.onPointerDown,()=>{i.open&&i.onClose(),l.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:q(e.onFocus,()=>{l.current||i.onOpen()}),onBlur:q(e.onBlur,i.onClose),onClick:q(e.onClick,i.onClose)})})});$f.displayName=Qf;var ep=`TooltipPortal`,[tp,np]=zf(ep,{forceMount:void 0}),rp=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Xf(ep,t);return(0,d.jsx)(tp,{scope:t,forceMount:n,children:(0,d.jsx)(tn,{present:n||a.open,children:(0,d.jsx)(ti,{asChild:!0,container:i,children:r})})})};rp.displayName=ep;var ip=`TooltipContent`,ap=c.forwardRef((e,t)=>{let n=np(ip,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Xf(ip,e.__scopeTooltip);return(0,d.jsx)(tn,{present:r||o.open,children:o.disableHoverableContent?(0,d.jsx)(up,{side:i,...a,ref:t}):(0,d.jsx)(op,{side:i,...a,ref:t})})}),op=c.forwardRef((e,t)=>{let n=Xf(ip,e.__scopeTooltip),r=Kf(ip,e.__scopeTooltip),i=c.useRef(null),a=P(t,i),[o,s]=c.useState(null),{trigger:l,onClose:u}=n,f=i.current,{onPointerInTransitChange:p}=r,m=c.useCallback(()=>{s(null),p(!1)},[p]),h=c.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=mp(r,pp(r,n.getBoundingClientRect())),a=hp(t.getBoundingClientRect());s(_p([...i,...a])),p(!0)},[p]);return c.useEffect(()=>()=>m(),[m]),c.useEffect(()=>{if(l&&f){let e=e=>h(e,f),t=e=>h(e,l);return l.addEventListener(`pointerleave`,e),f.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),f.removeEventListener(`pointerleave`,t)}}},[l,f,h,m]),c.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||f?.contains(t),i=!gp(n,o);r?m():i&&(m(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,f,o,u,m]),(0,d.jsx)(up,{...e,ref:a})}),[sp,cp]=zf(Jf,{isInside:!1}),lp=ln(`TooltipContent`),up=c.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,l=Xf(ip,n),u=Vf(n),{onClose:f}=l;return c.useEffect(()=>(document.addEventListener(Wf,f),()=>document.removeEventListener(Wf,f)),[f]),c.useEffect(()=>{if(l.trigger){let e=e=>{e.target?.contains(l.trigger)&&f()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,f]),(0,d.jsx)(jr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:f,children:(0,d.jsxs)(rl,{"data-state":l.stateAttribute,...u,...s,ref:t,style:{...s.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:[(0,d.jsx)(lp,{children:r}),(0,d.jsx)(sp,{scope:n,isInside:!0,children:(0,d.jsx)(Wl,{id:l.contentId,role:`tooltip`,children:i||r})})]})})});ap.displayName=ip;var dp=`TooltipArrow`,fp=c.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Vf(n);return cp(dp,n).isInside?null:(0,d.jsx)(il,{...i,...r,ref:t})});fp.displayName=dp;function pp(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function mp(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function hp(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function gp(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function _p(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),vp(t)}function vp(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var yp=Zf,bp=$f,xp=ap,Sp=yp,Cp=bp,wp=c.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,d.jsx)(xp,{ref:r,sideOffset:t,className:W(`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),...n}));wp.displayName=xp.displayName;var Tp=Ut(`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 Ep({className:e,variant:t,...n}){return(0,d.jsx)(`div`,{className:W(Tp({variant:t}),e),...n})}var Dp=[{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.`}]}],Op=Dp.flatMap(e=>e.presets),kp=({value:e,message:t,onChange:n})=>{let[r,i]=(0,c.useState)(!1),[a,o]=(0,c.useState)(``),s=(0,c.useMemo)(()=>{if(!a.trim())return Dp;let e=a.toLowerCase();return Dp.map(t=>({...t,presets:t.presets.filter(t=>t.label.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.pattern.toLowerCase().includes(e))})).filter(e=>e.presets.length>0)},[a]),u=(0,c.useMemo)(()=>e?Op.find(t=>t.pattern===e):void 0,[e]),f=e=>{n(e.pattern,`${e.label}: formato inválido`),i(!1),o(``)};return(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Regex`}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,d.jsx)(G,{value:e??``,onChange:e=>n(e.target.value||void 0,t),className:`h-7 text-xs font-mono flex-1`,placeholder:`Clique no botão ou digite...`}),e&&(0,d.jsx)(Z,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>{n(void 0,void 0)},children:(0,d.jsx)(l.X,{className:`h-3 w-3`})}),(0,d.jsxs)(Fl,{open:r,onOpenChange:i,children:[(0,d.jsx)(Il,{asChild:!0,children:(0,d.jsx)(Z,{variant:`outline`,size:`icon`,className:`h-7 w-7 shrink-0`,children:(0,d.jsx)(l.Regex,{className:`h-3.5 w-3.5`})})}),(0,d.jsxs)(Ll,{className:`w-[360px] p-0`,side:`left`,align:`start`,sideOffset:8,children:[(0,d.jsx)(`div`,{className:`p-2 border-b`,children:(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(l.Search,{className:`absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,d.jsx)(G,{value:a,onChange:e=>o(e.target.value),className:`h-8 text-xs pl-7`,placeholder:`Buscar regex (ex: CPF, e-mail, senha)...`,autoFocus:!0})]})}),(0,d.jsx)(yr,{className:`h-[360px]`,children:(0,d.jsxs)(`div`,{className:`p-1`,children:[s.length===0&&(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground text-center py-8`,children:`Nenhum regex encontrado`}),s.map(e=>(0,d.jsxs)(`div`,{className:`mb-1`,children:[(0,d.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:e.category}),e.presets.map(e=>(0,d.jsxs)(Sp,{children:[(0,d.jsx)(Cp,{asChild:!0,children:(0,d.jsxs)(`button`,{onClick:()=>f(e),className:`w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors group`,children:[(0,d.jsx)(l.ChevronRight,{className:`h-3 w-3 text-muted-foreground/50 group-hover:text-primary shrink-0`}),(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsx)(`span`,{className:`text-xs font-medium block truncate`,children:e.label}),(0,d.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-mono block truncate`,children:e.pattern})]})]})}),(0,d.jsxs)(wp,{side:`left`,className:`max-w-[250px] text-xs`,children:[(0,d.jsx)(`p`,{className:`font-semibold mb-1`,children:e.label}),(0,d.jsx)(`p`,{children:e.description})]})]},e.pattern+e.label))]},e.category))]})})]})]})]}),u&&(0,d.jsxs)(Ep,{variant:`secondary`,className:`text-[10px] font-normal gap-1`,children:[(0,d.jsx)(l.Regex,{className:`h-2.5 w-2.5`}),u.label]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Mensagem do regex`}),(0,d.jsx)(G,{value:t??``,onChange:t=>n(e,t.target.value||void 0),className:`h-7 text-xs`,placeholder:`Formato inválido`})]})]})},Ap=[{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`]}]}],jp=Ap.flatMap(e=>e.presets),Mp=({value:e,onChange:t})=>{let[n,r]=(0,c.useState)(!1),[i,a]=(0,c.useState)(``),[o,s]=(0,c.useState)(``),u=(0,c.useMemo)(()=>new Set(e??[]),[e]),f=(0,c.useMemo)(()=>{if(!i.trim())return Ap;let e=i.toLowerCase();return Ap.map(t=>({...t,presets:t.presets.filter(t=>t.label.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.value.toLowerCase().includes(e))})).filter(e=>e.presets.length>0)},[i]),p=n=>{let r=new Set(e??[]);n.group?n.group.every(e=>r.has(e))?n.group.forEach(e=>r.delete(e)):n.group.forEach(e=>r.add(e)):r.has(n.value)?r.delete(n.value):r.add(n.value),t(r.size>0?Array.from(r):void 0)},m=()=>{let n=o.trim();if(!n)return;let r=new Set(e??[]);r.add(n),t(Array.from(r)),s(``)},h=n=>{let r=new Set(e??[]);r.delete(n),t(r.size>0?Array.from(r):void 0)},g=e=>jp.find(t=>t.value===e)?.label??e;return(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Tipos de arquivo aceitos`}),(e?.length??0)>0&&(0,d.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.map(e=>(0,d.jsxs)(Ep,{variant:`secondary`,className:`text-[10px] gap-1 pr-1`,children:[g(e),(0,d.jsx)(`button`,{onClick:()=>h(e),className:`hover:text-destructive`,children:(0,d.jsx)(l.X,{className:`h-2.5 w-2.5`})})]},e))}),(0,d.jsxs)(Fl,{open:n,onOpenChange:r,children:[(0,d.jsx)(Il,{asChild:!0,children:(0,d.jsxs)(Z,{variant:`outline`,className:`w-full h-8 text-xs justify-start gap-2`,children:[(0,d.jsx)(l.FileType2,{className:`h-3.5 w-3.5`}),(e?.length??0)>0?`${e.length} tipo(s) selecionado(s)`:`Selecionar tipos de arquivo...`]})}),(0,d.jsxs)(Ll,{className:`w-[360px] p-0`,side:`left`,align:`start`,sideOffset:8,children:[(0,d.jsx)(`div`,{className:`p-2 border-b`,children:(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(l.Search,{className:`absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,d.jsx)(G,{value:i,onChange:e=>a(e.target.value),className:`h-8 text-xs pl-7`,placeholder:`Buscar tipos (ex: PDF, imagem, vídeo)...`,autoFocus:!0})]})}),(0,d.jsxs)(`div`,{className:`px-2 py-1.5 border-b flex gap-1`,children:[(0,d.jsx)(G,{value:o,onChange:e=>s(e.target.value),className:`h-7 text-xs font-mono flex-1`,placeholder:`Tipo customizado (ex: .dwg)`,onKeyDown:e=>e.key===`Enter`&&m()}),(0,d.jsx)(Z,{variant:`secondary`,size:`sm`,className:`h-7 text-xs shrink-0`,onClick:m,disabled:!o.trim(),children:`Adicionar`})]}),(0,d.jsx)(yr,{className:`h-[320px]`,children:(0,d.jsxs)(`div`,{className:`p-1`,children:[f.length===0&&(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground text-center py-8`,children:`Nenhum tipo encontrado`}),f.map(e=>(0,d.jsxs)(`div`,{className:`mb-1`,children:[(0,d.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:e.category}),e.presets.map(e=>{let t=e.group?e.group.every(e=>u.has(e)):u.has(e.value);return(0,d.jsxs)(Sp,{children:[(0,d.jsx)(Cp,{asChild:!0,children:(0,d.jsxs)(`button`,{onClick:()=>p(e),className:`w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors`,children:[(0,d.jsx)(X,{checked:e.group&&e.group.some(e=>u.has(e))&&!t?`indeterminate`:t,className:`h-3.5 w-3.5`,tabIndex:-1}),(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsx)(`span`,{className:`text-xs font-medium`,children:e.label}),!e.group&&(0,d.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-mono ml-2`,children:e.value}),e.group&&(0,d.jsxs)(`span`,{className:`text-[10px] text-muted-foreground ml-2`,children:[e.group.length,` tipos`]})]}),(0,d.jsx)(l.Info,{className:`h-3 w-3 text-muted-foreground/40 shrink-0`})]})}),(0,d.jsxs)(wp,{side:`left`,className:`max-w-[250px] text-xs`,children:[(0,d.jsx)(`p`,{className:`font-semibold mb-1`,children:e.label}),(0,d.jsx)(`p`,{children:e.description}),e.group&&(0,d.jsx)(`ul`,{className:`mt-1 space-y-0.5`,children:e.group.map(e=>(0,d.jsx)(`li`,{className:`font-mono text-[10px] opacity-80`,children:e},e))})]})]},e.value)})]},e.category))]})})]})]})]})},Np=1048576,Pp=1073741824;function Fp(e){return e>=Pp&&e%Pp===0?`GB`:`MB`}function Ip(e,t){return t===`GB`?e/Pp:e/Np}function Lp(e,t){return Math.round(e*(t===`GB`?Pp:Np))}var Rp=({value:e,onChange:t})=>{let n=(0,c.useMemo)(()=>e?Fp(e):`MB`,[]),[r,i]=(0,c.useState)(n),[a,o]=(0,c.useState)(e?String(Ip(e,n)):``);(0,c.useEffect)(()=>{if(e===void 0){o(``);return}let t=Fp(e);i(t),o(String(Ip(e,t)))},[e]);let s=e=>{o(e);let n=parseFloat(e);e.trim()===``||isNaN(n)||n<=0?t(void 0):t(Lp(n,r))},l=e=>{i(e);let n=parseFloat(a);!isNaN(n)&&n>0&&t(Lp(n,e))};return(0,d.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Tamanho máximo do arquivo`}),(0,d.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,d.jsx)(G,{type:`number`,min:0,step:`any`,value:a,onChange:e=>s(e.target.value),placeholder:`Ex: 10`,className:`h-8 text-xs flex-1`}),(0,d.jsxs)(vd,{value:r,onValueChange:e=>l(e),children:[(0,d.jsx)(bd,{className:`w-[72px] h-8 text-xs`,children:(0,d.jsx)(yd,{})}),(0,d.jsxs)(Cd,{children:[(0,d.jsx)($,{value:`MB`,children:`MB`}),(0,d.jsx)($,{value:`GB`,children:`GB`})]})]})]}),e!==void 0&&(0,d.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[`= `,e.toLocaleString(`pt-BR`),` bytes`]})]})},zp=new Set([`texto`,`textarea`,`email`,`password`,`url`,`phone`,`tel`,`cpf`,`cnpj`,`cep`,`rg`]),Bp=({fieldType:e,validation:t,onChange:n})=>{let r=(e,r)=>{let i=[`minLength`,`maxLength`,`min`,`max`,`maxFileSize`,`minAge`,`maxAge`].includes(e)?r?Number(r):void 0:r||void 0;n({...t,[e]:i})},i=e===`file`,a=zp.has(e);return(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground uppercase`,children:`Validação`}),a&&(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Min caracteres`}),(0,d.jsx)(G,{type:`number`,min:0,value:t?.minLength??``,onChange:e=>r(`minLength`,e.target.value),className:`h-7 text-xs`})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Max caracteres`}),(0,d.jsx)(G,{type:`number`,min:0,value:t?.maxLength??``,onChange:e=>r(`maxLength`,e.target.value),className:`h-7 text-xs`})]})]}),e===`number`&&(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Valor mínimo`}),(0,d.jsx)(G,{type:`number`,value:t?.min??``,onChange:e=>r(`min`,e.target.value),className:`h-7 text-xs`})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Valor máximo`}),(0,d.jsx)(G,{type:`number`,value:t?.max??``,onChange:e=>r(`max`,e.target.value),className:`h-7 text-xs`})]})]}),(e===`date`||e===`datetime`)&&(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Data mínima`}),(0,d.jsx)(G,{type:`date`,value:t?.minDate??``,onChange:e=>r(`minDate`,e.target.value),className:`h-7 text-xs`})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Data máxima`}),(0,d.jsx)(G,{type:`date`,value:t?.maxDate??``,onChange:e=>r(`maxDate`,e.target.value),className:`h-7 text-xs`})]})]}),(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Idade mínima (anos)`}),(0,d.jsx)(G,{type:`number`,min:0,value:t?.minAge??``,onChange:e=>r(`minAge`,e.target.value),className:`h-7 text-xs`,placeholder:`ex: 18`})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Idade máxima (anos)`}),(0,d.jsx)(G,{type:`number`,min:0,value:t?.maxAge??``,onChange:e=>r(`maxAge`,e.target.value),className:`h-7 text-xs`,placeholder:`ex: 60`})]})]})]}),i&&(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(Mp,{value:t?.fileTypes,onChange:e=>n({...t,fileTypes:e})}),(0,d.jsx)(Rp,{value:t?.maxFileSize,onChange:e=>n({...t,maxFileSize:e})})]}),!i&&(0,d.jsx)(kp,{value:t?.regex??``,message:t?.regexMessage??``,onChange:(e,r)=>n({...t,regex:e,regexMessage:r})})]})},Vp=({options:e,onChange:t})=>{let n=(0,c.useRef)([]);if(n.current.length<e.length)for(let t=n.current.length;t<e.length;t++)n.current.push(`opt-${Math.random().toString(36).slice(2)}`);let r=(0,c.useCallback)((n,r,i)=>{let a=[...e];a[n]={...a[n],[r]:i},t(a)},[e,t]),i=(0,c.useCallback)(r=>{n.current.splice(r,1),t(e.filter((e,t)=>t!==r))},[e,t]),a=(0,c.useCallback)(()=>{t([...e,{value:``,label:``}])},[e,t]);return(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground uppercase`,children:`Opções`}),e.map((e,t)=>(0,d.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,d.jsx)(l.GripVertical,{className:`h-3 w-3 text-muted-foreground/40 shrink-0`}),(0,d.jsx)(G,{value:e.value,onChange:e=>r(t,`value`,e.target.value),className:`h-7 text-xs flex-1`,placeholder:`Valor`}),(0,d.jsxs)(`div`,{className:`flex items-center gap-0.5 flex-1`,children:[(0,d.jsx)(G,{value:e.label,onChange:e=>r(t,`label`,e.target.value),className:`h-7 text-xs flex-1`,placeholder:`Label`}),(0,d.jsx)(Rl,{})]}),(0,d.jsx)(Z,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>i(t),children:(0,d.jsx)(l.Trash2,{className:`h-3 w-3`})})]},n.current[t])),(0,d.jsxs)(Z,{variant:`outline`,size:`sm`,className:`w-full h-7 text-xs`,onClick:a,children:[(0,d.jsx)(l.Plus,{className:`h-3 w-3 mr-1`}),` Adicionar opção`]})]})},Hp=[{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`}],Up=[`vazio`,`naoVazio`],Wp=({cond:e,selectedId:t,allFieldIds:n,getFieldLabel:r,onUpdate:i})=>(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Fonte`}),(0,d.jsxs)(vd,{value:e.source||`campo`,onValueChange:e=>i({source:e,when:``}),children:[(0,d.jsx)(bd,{className:`h-7 text-xs`,children:(0,d.jsx)(yd,{})}),(0,d.jsxs)(Cd,{children:[(0,d.jsx)($,{value:`campo`,children:`Campo do formulário`}),(0,d.jsx)($,{value:`evento`,children:`Variável do evento`})]})]})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:e.source===`evento`?`Variável do evento`:`Quando o campo`}),(0,d.jsxs)(vd,{value:e.when||``,onValueChange:e=>i({when:e}),children:[(0,d.jsx)(bd,{className:`h-7 text-xs`,children:(0,d.jsx)(yd,{placeholder:e.source===`evento`?`Selecione uma variável...`:`Selecione um campo...`})}),(0,d.jsx)(Cd,{children:e.source===`evento`?y.map(e=>(0,d.jsx)($,{value:e.key,children:e.label},e.key)):n.filter(e=>e!==t).map(e=>(0,d.jsxs)($,{value:e,children:[r(e),(0,d.jsxs)(`span`,{className:`text-muted-foreground/50 ml-1 text-[9px] font-mono`,children:[`(`,e,`)`]})]},e))})]})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Operador`}),(0,d.jsxs)(vd,{value:e.operator,onValueChange:e=>i({operator:e}),children:[(0,d.jsx)(bd,{className:`h-7 text-xs`,children:(0,d.jsx)(yd,{})}),(0,d.jsx)(Cd,{children:Hp.map(e=>(0,d.jsx)($,{value:e.value,children:e.label},e.value))})]})]}),!Up.includes(e.operator)&&(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Valor`}),(0,d.jsx)(G,{value:e.value||``,onChange:e=>i({value:e.target.value}),className:`h-7 text-xs`,placeholder:`Valor esperado`})]})]}),Gp=({condition:e,selectedId:t,allFieldIds:n,getFieldLabel:r,onChange:i})=>{let a=t=>{e&&i({...e,...t})},o=()=>{if(!e)return;let t=e.extraConditions??[];i({...e,logicOperator:e.logicOperator??`and`,extraConditions:[...t,{when:``,operator:`igual`,value:``,source:`campo`}]})},s=t=>{if(!e)return;let n=(e.extraConditions??[]).filter((e,n)=>n!==t);i({...e,extraConditions:n,logicOperator:n.length?e.logicOperator:void 0})},c=(t,n)=>{if(!e)return;let r=(e.extraConditions??[]).map((e,r)=>r===t?{...e,...n}:e);i({...e,extraConditions:r})},l=(e?.extraConditions?.length??0)>0;return(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground uppercase`,children:`Condicional`}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(X,{id:`has-condition`,checked:!!e,onCheckedChange:e=>{i(e?{when:``,operator:`igual`,value:``,source:`campo`}:void 0)}}),(0,d.jsx)(K,{htmlFor:`has-condition`,className:`text-xs cursor-pointer`,children:`Exibir condicionalmente`})]}),e&&(0,d.jsxs)(`div`,{className:`space-y-2 pl-2 border-l-2 border-amber-500/30`,children:[(0,d.jsx)(Wp,{cond:e,selectedId:t,allFieldIds:n,getFieldLabel:r,onUpdate:a}),l&&(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Lógica`}),(0,d.jsxs)(vd,{value:e.logicOperator??`and`,onValueChange:e=>a({logicOperator:e}),children:[(0,d.jsx)(bd,{className:`h-7 text-xs`,children:(0,d.jsx)(yd,{})}),(0,d.jsxs)(Cd,{children:[(0,d.jsx)($,{value:`and`,children:`E (AND) — todas devem ser verdadeiras`}),(0,d.jsx)($,{value:`or`,children:`OU (OR) — pelo menos uma deve ser verdadeira`})]})]})]}),(e.extraConditions??[]).map((i,a)=>(0,d.jsxs)(`div`,{className:`space-y-2 pt-2 border-t border-border/40`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-medium uppercase`,children:[e.logicOperator===`or`?`OU`:`E`,` — condição`,` `,a+2]}),(0,d.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-5 px-1 text-[10px] text-destructive hover:text-destructive`,onClick:()=>s(a),children:`Remover`})]}),(0,d.jsx)(Wp,{cond:i,selectedId:t,allFieldIds:n,getFieldLabel:r,onUpdate:e=>c(a,e)})]},a)),(0,d.jsx)(Z,{variant:`outline`,size:`sm`,className:`h-6 text-[10px] w-full mt-1`,onClick:o,children:`+ Adicionar condição`})]})]})},Kp=[{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`}],qp=({subFields:e,onChange:t})=>{let[n,r]=(0,c.useState)(null),i=(n,r)=>{t(e.map((e,t)=>t===n?{...e,...r}:e))},a=n=>{t(e.filter((e,t)=>t!==n)),r(null)};return(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(K,{className:`text-xs font-semibold`,children:`Sub-campos`}),(0,d.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs gap-1`,onClick:()=>{let n={label:`Novo campo`,name:`campo_${e.length+1}`,fieldType:`texto`,required:!1};t([...e,n]),r(e.length)},children:[(0,d.jsx)(l.Plus,{className:`w-3 h-3`}),`Adicionar`]})]}),e.length===0&&(0,d.jsx)(`p`,{className:`text-[11px] text-muted-foreground italic py-1`,children:`Nenhum sub-campo adicionado.`}),e.map((e,t)=>(0,d.jsxs)(`div`,{className:`border rounded-md text-xs overflow-hidden`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 cursor-pointer hover:bg-muted/40 select-none`,onClick:()=>r(n===t?null:t),children:[(0,d.jsx)(Ep,{variant:`secondary`,className:`h-4 text-[9px] px-1 shrink-0`,children:t+1}),(0,d.jsx)(`span`,{className:`flex-1 truncate font-medium`,children:e.label||e.name||`Campo sem nome`}),(0,d.jsx)(`span`,{className:`text-muted-foreground text-[10px] shrink-0`,children:Kp.find(t=>t.value===e.fieldType)?.label??e.fieldType}),(0,d.jsx)(Z,{type:`button`,variant:`ghost`,size:`icon`,className:`h-5 w-5 text-destructive hover:text-destructive shrink-0`,onClick:e=>{e.stopPropagation(),a(t)},children:(0,d.jsx)(l.Trash2,{className:`w-3 h-3`})}),n===t?(0,d.jsx)(l.ChevronUp,{className:`w-3 h-3 text-muted-foreground shrink-0`}):(0,d.jsx)(l.ChevronDown,{className:`w-3 h-3 text-muted-foreground shrink-0`})]}),n===t&&(0,d.jsxs)(`div`,{className:`px-2 pb-2 space-y-2 border-t bg-muted/20`,children:[(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pt-2`,children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Label`}),(0,d.jsx)(G,{value:e.label,onChange:e=>i(t,{label:e.target.value}),className:`h-7 text-xs`,placeholder:`Ex: Nome`})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Nome (campo)`}),(0,d.jsx)(G,{value:e.name||``,onChange:e=>i(t,{name:e.target.value}),className:`h-7 text-xs`,placeholder:`Ex: nome`})]})]}),(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Tipo de campo`}),(0,d.jsxs)(vd,{value:e.fieldType,onValueChange:e=>i(t,{fieldType:e}),children:[(0,d.jsx)(bd,{className:`h-7 text-xs`,children:(0,d.jsx)(yd,{})}),(0,d.jsx)(Cd,{children:Kp.map(e=>(0,d.jsx)($,{value:e.value,className:`text-xs`,children:e.label},e.value))})]})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Colunas (1-12)`}),(0,d.jsx)(G,{type:`number`,min:1,max:12,value:e.tamanho??``,onChange:e=>i(t,{tamanho:e.target.value?Number(e.target.value):void 0}),className:`h-7 text-xs`,placeholder:`12`})]})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-[10px]`,children:`Placeholder`}),(0,d.jsx)(G,{value:e.placeholder||``,onChange:e=>i(t,{placeholder:e.target.value}),className:`h-7 text-xs`,placeholder:`Texto de exemplo...`})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(X,{id:`sf-req-${t}`,checked:e.required||!1,onCheckedChange:e=>i(t,{required:e===!0})}),(0,d.jsx)(K,{htmlFor:`sf-req-${t}`,className:`text-[10px] cursor-pointer`,children:`Obrigatório`})]}),[`select`,`radio`,`checkbox_group`].includes(e.fieldType)&&(0,d.jsx)(`div`,{className:`pt-1`,children:(0,d.jsx)(Vp,{options:e.options||[],onChange:e=>i(t,{options:e})})})]})]},t)),e.length>0&&(0,d.jsx)(Lt,{className:`mt-1`})]})},Jp=({config:e,selectedId:t,allFieldIds:n,getFieldLabel:r,onUpdate:i})=>{let a=e.fieldType||`texto`,o=[`select`,`radio`,`checkbox_group`,`autocomplete`].includes(a),s=a===`field_array`,u=e.locked===!0,f=a===`participation_type`,p=a===`payment_method`,m=a===`terms`,h=a===`slider`,g=a===`rating`,v=a===`date_range`,y=a===`sub_form`,{schemaId:b,uploadTermsPdf:x}=j(),[S,C]=(0,c.useState)(e.termoPdfUploadId?`upload`:`link`),[w,T]=(0,c.useState)({status:`idle`}),E=(0,c.useRef)(null),D=(0,c.useCallback)(async e=>{if(!b){T({status:`error`,message:`Salve o schema primeiro para habilitar o upload de PDF.`});return}if(!x){T({status:`error`,message:`Upload de PDF não configurado. Forneça a prop uploadTermsPdf ao BuilderProvider.`});return}T({status:`uploading`,fileName:e.name,progress:0});try{i({termoPdfUploadId:await x(e,b),termoPdfUrl:void 0}),T({status:`idle`})}catch(e){T({status:`error`,message:e instanceof Error?e.message:`Falha no upload do PDF.`})}},[b,x,i]);return(0,d.jsxs)(`div`,{className:`space-y-4`,children:[u&&(0,d.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-amber-500/10 border border-amber-500/30 px-3 py-2`,children:[(0,d.jsx)(l.Lock,{className:`h-4 w-4 text-amber-500 shrink-0`}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`p`,{className:`text-xs font-medium text-amber-600 dark:text-amber-400`,children:`Campo bloqueado`}),(0,d.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Tipo, nome e ID são fixos (integração automática)`})]})]}),f&&(0,d.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2`,children:[(0,d.jsx)(l.Lock,{className:`h-4 w-4 text-primary shrink-0`}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`p`,{className:`text-xs font-medium text-primary`,children:`Tipo de Participação`}),(0,d.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Datas, preços e vagas são carregados automaticamente do evento`})]})]}),m&&(0,d.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2`,children:[(0,d.jsx)(l.ScrollText,{className:`h-4 w-4 text-primary shrink-0`}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`p`,{className:`text-xs font-medium text-primary`,children:`Termos e Condições`}),(0,d.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Configure o texto ou URL do PDF abaixo`})]})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Label`}),(0,d.jsx)(Rl,{})]}),(0,d.jsx)(G,{value:e.label,onChange:e=>i({label:e.target.value}),className:`h-8 text-sm`})]}),f||p?(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Dica (hint)`}),(0,d.jsx)(G,{value:e.hint||``,onChange:e=>i({hint:e.target.value}),className:`h-8 text-sm`,placeholder:`Texto de ajuda abaixo do campo`})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(X,{id:`req`,checked:e.required||!1,onCheckedChange:e=>i({required:e===!0})}),(0,d.jsx)(K,{htmlFor:`req`,className:`text-xs cursor-pointer`,children:`Campo obrigatório`})]})]}):m?(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Dica (hint)`}),(0,d.jsx)(G,{value:e.hint||``,onChange:e=>i({hint:e.target.value}),className:`h-8 text-sm`,placeholder:`Ex: Leia os termos antes de continuar`})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(X,{id:`req`,checked:e.required||!1,onCheckedChange:e=>i({required:e===!0})}),(0,d.jsx)(K,{htmlFor:`req`,className:`text-xs cursor-pointer`,children:`Campo obrigatório`})]}),(0,d.jsx)(Lt,{}),(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Conteúdo dos termos`}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Texto dos termos`}),(0,d.jsx)(_f,{value:e.termoTexto||``,onChange:e=>i({termoTexto:e.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...`})]}),(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`PDF dos termos (opcional)`}),(0,d.jsxs)(`div`,{className:`flex gap-1 p-0.5 bg-muted rounded-md`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>C(`link`),className:`flex-1 text-[11px] py-1 rounded transition-colors ${S===`link`?`bg-background shadow-sm font-medium`:`text-muted-foreground hover:text-foreground`}`,children:`Link externo`}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>C(`upload`),className:`flex-1 text-[11px] py-1 rounded transition-colors ${S===`upload`?`bg-background shadow-sm font-medium`:`text-muted-foreground hover:text-foreground`}`,children:`Upload de PDF`})]}),S===`link`?(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(G,{value:e.termoPdfUrl||``,onChange:e=>i({termoPdfUrl:e.target.value||void 0}),className:`h-8 text-sm`,placeholder:`https://exemplo.com/termos.pdf`}),(0,d.jsx)(`p`,{className:`text-[9px] text-muted-foreground`,children:`URL pública de um PDF. Tem prioridade sobre o texto acima.`})]}):(0,d.jsxs)(`div`,{className:`space-y-2`,children:[e.termoPdfUploadId&&w.status===`idle`?(0,d.jsxs)(`div`,{className:`flex items-center gap-2 rounded border border-green-500/40 bg-green-500/10 px-2 py-1.5`,children:[(0,d.jsx)(l.CheckCircle2,{className:`h-3.5 w-3.5 text-green-600 shrink-0`}),(0,d.jsx)(`span`,{className:`text-[11px] text-green-700 dark:text-green-400 flex-1`,children:`PDF enviado ✓`}),(0,d.jsx)(Z,{type:`button`,variant:`ghost`,size:`icon`,className:`h-5 w-5`,onClick:()=>{i({termoPdfUploadId:void 0})},children:(0,d.jsx)(l.X,{className:`h-3 w-3`})})]}):null,w.status===`uploading`?(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,d.jsx)(l.Loader2,{className:`h-3.5 w-3.5 animate-spin`}),(0,d.jsx)(`span`,{className:`truncate`,children:w.fileName}),(0,d.jsxs)(`span`,{className:`ml-auto`,children:[w.progress,`%`]})]}),(0,d.jsx)(Rf,{value:w.progress,className:`h-1`})]}):null,w.status===`error`?(0,d.jsxs)(`div`,{className:`flex items-center gap-2 rounded border border-destructive/40 bg-destructive/10 px-2 py-1.5`,children:[(0,d.jsx)(l.AlertCircle,{className:`h-3.5 w-3.5 text-destructive shrink-0`}),(0,d.jsx)(`span`,{className:`text-[11px] text-destructive`,children:w.message}),(0,d.jsx)(Z,{type:`button`,variant:`ghost`,size:`icon`,className:`h-5 w-5 ml-auto`,onClick:()=>T({status:`idle`}),children:(0,d.jsx)(l.X,{className:`h-3 w-3`})})]}):null,w.status===`uploading`?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`input`,{ref:E,type:`file`,accept:`application/pdf`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&D(t),e.target.value=``}}),(0,d.jsxs)(Z,{type:`button`,variant:`outline`,size:`sm`,className:`w-full h-8 text-xs gap-1.5`,disabled:!b,onClick:()=>E.current?.click(),children:[(0,d.jsx)(l.Upload,{className:`h-3.5 w-3.5`}),e.termoPdfUploadId?`Substituir PDF`:`Selecionar PDF`]}),!b&&(0,d.jsx)(`p`,{className:`text-[9px] text-muted-foreground`,children:`Salve o schema uma vez para habilitar o upload.`})]})]})]})]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Nome (chave)`}),(0,d.jsx)(G,{value:e.name||t.replace(/^field_/,``),onChange:e=>!u&&i({name:e.target.value}),className:`h-8 text-xs font-mono`,placeholder:`nome_do_campo`,disabled:u}),u?(0,d.jsx)(`p`,{className:`text-[9px] text-amber-500`,children:`ID fixo — necessário para auto-preenchimento`}):(0,d.jsx)(`p`,{className:`text-[9px] text-muted-foreground`,children:`Usado como chave no JSON do formulário`})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Tipo do campo`}),(0,d.jsxs)(vd,{value:a,onValueChange:e=>!u&&i({fieldType:e}),disabled:u,children:[(0,d.jsx)(bd,{className:`h-8 text-sm`,children:(0,d.jsx)(yd,{})}),(0,d.jsx)(Cd,{children:_.map(e=>(0,d.jsx)($,{value:e.component,children:e.label},e.component))})]})]}),(0,d.jsx)(hf,{tamanho:e.tamanho||6,inicioColuna:e.inicioColuna||1,defaultTamanho:6,onTamanhoChange:e=>i({tamanho:e}),onPositionChange:e=>i({inicioColuna:e})}),a!==`file`&&!s&&(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Placeholder`}),(0,d.jsx)(Rl,{})]}),(0,d.jsx)(G,{value:e.placeholder||``,onChange:e=>i({placeholder:e.target.value}),className:`h-8 text-sm`,placeholder:`Texto de exemplo...`})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Dica (hint)`}),(0,d.jsx)(Rl,{})]}),(0,d.jsx)(G,{value:e.hint||``,onChange:e=>i({hint:e.target.value}),className:`h-8 text-sm`,placeholder:`Texto de ajuda abaixo do campo`})]}),a!==`file`&&!s&&!y&&(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Valor padrão`}),(0,d.jsx)(G,{value:e.defaultValue||``,onChange:e=>i({defaultValue:e.target.value}),className:`h-8 text-sm`,placeholder:`Valor inicial do campo`})]}),a!==`file`&&!s&&!y&&(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Valor inicial (runtime)`}),(0,d.jsx)(Rl,{})]}),(0,d.jsx)(G,{value:e.initialValue||``,onChange:e=>i({initialValue:e.target.value||void 0}),className:`h-8 text-sm`,placeholder:`{{evento.nome}} ou valor fixo`}),(0,d.jsxs)(`p`,{className:`text-[9px] text-muted-foreground`,children:[`Sobrepõe "Valor padrão" — suporta variáveis`,` `,(0,d.jsx)(`code`,{children:`{{evento.x}}`})]})]}),!s&&!y&&(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(X,{id:`req`,checked:e.required||!1,onCheckedChange:e=>i({required:e===!0})}),(0,d.jsx)(K,{htmlFor:`req`,className:`text-xs cursor-pointer`,children:`Campo obrigatório`})]}),!s&&!y&&!u&&(0,d.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(X,{id:`readonly`,checked:e.isReadOnly||!1,onCheckedChange:e=>i({isReadOnly:e===!0||void 0})}),(0,d.jsx)(K,{htmlFor:`readonly`,className:`text-xs cursor-pointer`,children:`Somente leitura`})]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(X,{id:`disabled`,checked:e.isDisabled||!1,onCheckedChange:e=>i({isDisabled:e===!0||void 0})}),(0,d.jsx)(K,{htmlFor:`disabled`,className:`text-xs cursor-pointer`,children:`Desabilitado`})]})]}),h&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Lt,{}),(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground uppercase`,children:`Slider`}),(0,d.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Mínimo`}),(0,d.jsx)(G,{type:`number`,value:e.minValue??0,onChange:e=>i({minValue:Number(e.target.value)}),className:`h-8 text-sm`})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Máximo`}),(0,d.jsx)(G,{type:`number`,value:e.maxValue??100,onChange:e=>i({maxValue:Number(e.target.value)}),className:`h-8 text-sm`})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Passo`}),(0,d.jsx)(G,{type:`number`,min:1,value:e.step??1,onChange:e=>i({step:Number(e.target.value)}),className:`h-8 text-sm`})]})]})]})]}),g&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Lt,{}),(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground uppercase`,children:`Avaliação`}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Número de estrelas`}),(0,d.jsxs)(vd,{value:String(e.maxRating??5),onValueChange:e=>i({maxRating:Number(e)}),children:[(0,d.jsx)(bd,{className:`h-8 text-sm`,children:(0,d.jsx)(yd,{})}),(0,d.jsx)(Cd,{children:[3,4,5,6,7,10].map(e=>(0,d.jsxs)($,{value:String(e),children:[e,` estrelas`]},e))})]})]})]})]}),v&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Lt,{}),(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground uppercase`,children:`Período`}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Label da data inicial`}),(0,d.jsx)(G,{value:e.dateRangeStartLabel??`Data inicial`,onChange:e=>i({dateRangeStartLabel:e.target.value}),className:`h-8 text-sm`})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Label da data final`}),(0,d.jsx)(G,{value:e.dateRangeEndLabel??`Data final`,onChange:e=>i({dateRangeEndLabel:e.target.value}),className:`h-8 text-sm`})]})]})]}),!s&&(0,d.jsx)(Lt,{}),!s&&(0,d.jsx)(Bp,{fieldType:a,validation:e.validation,onChange:e=>i({validation:e})}),o&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Lt,{}),a===`radio`&&(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Estilo visual`}),(0,d.jsxs)(vd,{value:e.visualStyle||`card`,onValueChange:e=>i({visualStyle:e}),children:[(0,d.jsx)(bd,{className:`h-8 text-sm`,children:(0,d.jsx)(yd,{})}),(0,d.jsxs)(Cd,{children:[(0,d.jsx)($,{value:`card`,children:`Card (padrão)`}),(0,d.jsx)($,{value:`default`,children:`Radio simples`})]})]})]}),(0,d.jsx)(Vp,{options:e.options||[],onChange:e=>i({options:e})})]}),s&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Lt,{}),(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground uppercase`,children:`Lista de itens`}),(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Mín. itens`}),(0,d.jsx)(G,{type:`number`,min:0,value:e.minItems??``,onChange:e=>i({minItems:e.target.value?Number(e.target.value):void 0}),className:`h-8 text-sm`,placeholder:`0`})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Máx. itens`}),(0,d.jsx)(G,{type:`number`,min:0,value:e.maxItems??``,onChange:e=>i({maxItems:e.target.value?Number(e.target.value):void 0}),className:`h-8 text-sm`,placeholder:`Sem limite`})]})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Label do item`}),(0,d.jsx)(G,{value:e.itemLabel||``,onChange:e=>i({itemLabel:e.target.value||void 0}),className:`h-8 text-sm`,placeholder:`Ex: Contato`}),(0,d.jsx)(`p`,{className:`text-[9px] text-muted-foreground`,children:`Prefixo exibido em cada item (ex: "Contato 1", "Contato 2")`})]}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Label do botão adicionar`}),(0,d.jsx)(G,{value:e.addLabel||``,onChange:e=>i({addLabel:e.target.value||void 0}),className:`h-8 text-sm`,placeholder:`Ex: Adicionar contato`})]}),(0,d.jsx)(`div`,{className:`rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2`,children:(0,d.jsx)(`p`,{className:`text-[11px] text-amber-700 dark:text-amber-400`,children:`Os sub-campos são configurados visualmente no canvas: arraste campos da paleta para dentro da caixa laranja.`})})]})]}),y&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Lt,{}),(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Sub-formulário`}),(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Título do grupo (opcional)`}),(0,d.jsx)(G,{value:e.subSchemaTitle||``,onChange:e=>i({subSchemaTitle:e.target.value||void 0}),className:`h-8 text-sm`,placeholder:`Ex: Endereço, Responsável...`})]}),(0,d.jsx)(qp,{subFields:e.subSchemaFields||[],onChange:e=>i({subSchemaFields:e})})]})]}),(0,d.jsx)(Lt,{}),(0,d.jsx)(Gp,{condition:e.condition,selectedId:t,allFieldIds:n,getFieldLabel:r,onChange:e=>i({condition:e})}),e.condition&&(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs`,children:`Valor ao ocultar (clearedValue)`}),(0,d.jsx)(G,{value:e.clearedValue??``,onChange:e=>i({clearedValue:e.target.value||void 0}),className:`h-8 text-sm`,placeholder:`Deixar vazio = não limpar`}),(0,d.jsx)(`p`,{className:`text-[9px] text-muted-foreground`,children:`Valor aplicado automaticamente quando o campo fica oculto.`})]}),!s&&!y&&(0,d.jsxs)(`div`,{className:`space-y-1`,children:[(0,d.jsx)(K,{className:`text-xs text-muted-foreground`,children:`Resolver de props (avançado)`}),(0,d.jsx)(G,{value:e.resolvePropsKey||``,onChange:e=>i({resolvePropsKey:e.target.value||void 0}),className:`h-8 text-xs font-mono`,placeholder:`chaveDoResolver`}),(0,d.jsxs)(`p`,{className:`text-[9px] text-muted-foreground`,children:[`Registre este key em`,` `,(0,d.jsx)(`code`,{children:`RendererContext.fieldResolvers`}),` para opções dinâmicas.`]})]})]})]})},Yp=()=>{let{selectedId:e,getConfig:t,updateConfig:n,getAllFieldIds:r}=j();if(!e)return(0,d.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`});let i=t(e),a=b(e),o=t=>n(e,t),s=r().filter(t=>t!==e);return(0,d.jsxs)(`div`,{className:`rounded-xl border bg-card p-4 space-y-4 max-h-[calc(100vh-160px)] overflow-y-auto`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(`h3`,{className:`text-sm font-bold text-foreground`,children:a===`step`?`Step`:a===`container`?`Container`:`Campo`}),(0,d.jsx)(`span`,{className:`text-[10px] font-mono text-muted-foreground`,children:e})]}),(0,d.jsx)(Lt,{}),a===`step`&&(0,d.jsx)(zl,{config:i,onUpdate:o}),a===`container`&&(0,d.jsx)(gf,{config:i,onUpdate:o}),a===`field`&&(0,d.jsx)(Jp,{config:i,selectedId:e,allFieldIds:s,getFieldLabel:e=>t(e).label||e,onUpdate:o})]})},Xp=(e,t)=>{let n=e?.containers?.root?.children||[],r=[];for(let i of n){if(b(i)!==`step`)continue;let n=e?.containers?.[i]?.children||[],a=[];for(let r of n){if(b(r)!==`container`)continue;let n=(e?.containers?.[r]?.children||[]).filter(e=>b(e)===`field`).map(n=>{let r=t(n),i={id:n,config:r};return r.fieldType===`field_array`&&(i.subFields=(e?.containers?.[n]?.children??[]).filter(e=>b(e)===`field`).map(e=>({id:e,config:t(e)}))),i});a.push({id:r,config:t(r),fields:n})}r.push({id:i,config:t(i),containers:a})}return r},Zp=(e,t,n)=>{if(!e||!e.when)return!0;let r=e.source===`evento`?n?.[e.when]||``:t[e.when]||``,i=parseFloat(r),a=parseFloat(e.value||``),o;switch(e.operator){case`igual`:o=r===(e.value||``);break;case`diferente`:o=r!==(e.value||``);break;case`vazio`:o=!r;break;case`naoVazio`:o=!!r;break;case`contem`:o=r.includes(e.value||``);break;case`naoContem`:o=!r.includes(e.value||``);break;case`maiorQue`:o=!isNaN(i)&&!isNaN(a)&&i>a;break;case`menorQue`:o=!isNaN(i)&&!isNaN(a)&&i<a;break;case`maiorOuIgual`:o=!isNaN(i)&&!isNaN(a)&&i>=a;break;case`menorOuIgual`:o=!isNaN(i)&&!isNaN(a)&&i<=a;break;default:o=!0}if(e.logicOperator&&e.extraConditions?.length){let r=e.extraConditions.map(e=>Zp(e,t,n));return e.logicOperator===`and`?o&&r.every(Boolean):o||r.some(Boolean)}return o},Qp=(e,t,n,r)=>{if(!Zp(t.condition,n,r))return;let i=t.validation,a=t.fieldType||`texto`;if(t.required&&!e)return`Campo obrigatório`;if(e){if(i?.minLength&&e.length<i.minLength)return`Mínimo ${i.minLength} caracteres`;if(i?.maxLength&&e.length>i.maxLength)return`Máximo ${i.maxLength} caracteres`;if(a===`number`){let t=Number(e);if(!isNaN(t)){if(i?.min!==void 0&&t<i.min)return`Valor mínimo: ${i.min}`;if(i?.max!==void 0&&t>i.max)return`Valor máximo: ${i.max}`}}if((a===`date`||a===`datetime`)&&e){if(i?.minDate&&e<i.minDate)return`Data mínima: ${i.minDate}`;if(i?.maxDate&&e>i.maxDate)return`Data máxima: ${i.maxDate}`}if(i?.regex)try{if(!new RegExp(i.regex).test(e))return i.regexMessage||`Formato inválido`}catch{}}},$p={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:``},em=(e,t)=>{let n=e.fieldType||`texto`;if(n===`field_array`){let n=Math.max(e.minItems??1,1),r=Array.from({length:n},()=>{let e={};return t?.forEach(t=>{e[t.id]=em(t.config)}),e});return JSON.stringify(r)}return $p[n]===void 0?(n===`select`||n===`radio`)&&e.options?.length?e.options[0].value||``:`Teste`:$p[n]},tm={glassmorphism:`Glass`,card:`Card`,flat:`Flat`,bordered:`Bordered`},nm=()=>{let{previewTemplateId:e,setPreviewTemplateId:t}=j(),[n,r]=(0,c.useState)(!1),i=Object.values(p.TEMPLATE_REGISTRY),a=p.TEMPLATE_REGISTRY[e];return(0,d.jsxs)(Fl,{open:n,onOpenChange:r,children:[(0,d.jsx)(Il,{asChild:!0,children:(0,d.jsxs)(Z,{variant:`outline`,size:`sm`,className:`gap-1.5`,title:`Selecionar template visual`,children:[(0,d.jsx)(`span`,{className:`w-3.5 h-3.5 rounded-full shrink-0 border border-white/20`,style:{background:a?.colors.primary??`#3b82f6`}}),(0,d.jsx)(l.Palette,{className:`w-3.5 h-3.5`}),(0,d.jsx)(`span`,{className:`hidden sm:inline`,children:a?.displayName??`Template`})]})}),(0,d.jsxs)(Ll,{side:`bottom`,align:`end`,className:`w-80 p-3`,children:[(0,d.jsx)(`p`,{className:`text-xs font-semibold text-muted-foreground mb-2 uppercase tracking-wider`,children:`Template de Preview`}),(0,d.jsx)(`div`,{className:`grid grid-cols-3 gap-1.5 max-h-72 overflow-y-auto pr-0.5`,children:i.map(n=>{let i=n.id===e,a=(0,p.isDarkTemplate)(n),o=tm[n.layout.containerStyle]??``;return(0,d.jsxs)(`button`,{onClick:()=>{t(n.id),r(!1)},className:W(`relative flex flex-col items-center gap-1.5 rounded-lg p-2 border text-center transition-all hover:scale-[1.02]`,i?`border-primary ring-1 ring-primary`:`border-border hover:border-muted-foreground/40`),children:[(0,d.jsxs)(`div`,{className:`w-full h-8 rounded-md flex items-center justify-center gap-0.5`,style:{background:n.colors.background.startsWith(`#`)||n.colors.background.startsWith(`rgba`)?n.colors.background:void 0},"data-muted":!n.colors.background.startsWith(`#`)&&!n.colors.background.startsWith(`rgba`)?`true`:void 0,children:[(0,d.jsx)(`div`,{style:{width:8,height:8,borderRadius:`50%`,background:n.colors.primary}}),(0,d.jsx)(`div`,{style:{width:8,height:8,borderRadius:`50%`,background:n.colors.accent}})]}),(0,d.jsx)(`span`,{className:`text-[10px] font-medium leading-tight line-clamp-2`,children:n.displayName}),(0,d.jsxs)(`div`,{className:`flex items-center gap-0.5 flex-wrap justify-center`,children:[a&&(0,d.jsx)(`span`,{className:`text-[9px] px-1 rounded bg-zinc-800 text-zinc-300`,children:`dark`}),o&&(0,d.jsx)(`span`,{className:`text-[9px] px-1 rounded bg-muted text-muted-foreground`,children:o})]}),i&&(0,d.jsx)(`div`,{className:`absolute top-1 right-1`,children:(0,d.jsx)(l.Check,{className:`w-3 h-3 text-primary`})})]},n.id)})})]})]})},rm=({onFillMock:e,onClear:t})=>(0,d.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,d.jsx)(nm,{}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsxs)(Z,{variant:`outline`,size:`sm`,onClick:e,children:[(0,d.jsx)(l.FlaskConical,{className:`w-3.5 h-3.5 mr-1`}),`Preencher mock`]}),(0,d.jsxs)(Z,{variant:`ghost`,size:`sm`,onClick:t,children:[(0,d.jsx)(l.Eraser,{className:`w-3.5 h-3.5 mr-1`}),`Limpar`]})]})]}),im={texto:`text`,number:`number`,email:`email`,telefone:`tel`,cpf:`text`,cep:`text`,date:`date`,datetime:`datetime-local`},am=e=>im[e]||`text`,om=e=>`R$ ${(e/100).toFixed(2).replace(`.`,`,`)}`,sm=({config:e,fieldId:t,subFields:n,tamanho:r,error:i,onChange:a,value:o})=>{let s=e.minItems??1,u=e.maxItems??10,f=e.itemLabel||`Item`,p=e.addLabel||`Adicionar ${f}`,m=(0,c.useRef)(o||``),h=(0,c.useCallback)(()=>Object.fromEntries(n.map(e=>[e.id,``])),[n]),[g,_]=(0,c.useState)(()=>{if(o)try{let e=JSON.parse(o);if(Array.isArray(e)&&e.length>0)return e}catch{}return[h()]}),[v,y]=(0,c.useState)({});(0,c.useEffect)(()=>{if(o!==m.current){if(m.current=o||``,!o){_([h()]);return}try{let e=JSON.parse(o);Array.isArray(e)&&_(e)}catch{}}},[o,h]),(0,c.useEffect)(()=>{if(!i){y({});return}let e={};g.forEach((t,r)=>{n.forEach(n=>{let i=t[n.id]??``;n.config.required&&!i.trim()&&(e[`${r}.${n.id}`]=`Campo obrigatório`)})}),y(e)},[i,g,n]);let b=e=>{if(!a)return;let t=e.map(e=>{let t={};return n.forEach(n=>{t[n.id]=e[n.id]??``}),t}),r=JSON.stringify(t);m.current=r,a(r)},x=()=>{if(g.length>=u)return;let e=[...g,h()];_(e),b(e)},S=e=>{if(g.length<=s)return;let t=g.filter((t,n)=>n!==e);_(t),b(t)},C=(e,t,n)=>{let r=g.map((r,i)=>i===e?{...r,[t]:n}:r);_(r),b(r),y(n=>{let r={...n};return delete r[`${e}.${t}`],r})};return(0,d.jsxs)(`div`,{className:`space-y-2`,style:{gridColumn:`span ${r}`},children:[e.label&&(0,d.jsx)(K,{className:`text-sm font-medium`,children:e.label}),(0,d.jsx)(`div`,{className:`space-y-3`,children:g.map((e,t)=>(0,d.jsxs)(`div`,{className:`rounded-xl border bg-card p-4 space-y-3 shadow-sm`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.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:t+1}),(0,d.jsxs)(`span`,{className:`text-sm font-semibold`,children:[f,` `,t+1]})]}),g.length>s&&(0,d.jsx)(Z,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 text-destructive/60 hover:text-destructive`,onClick:()=>S(t),children:(0,d.jsx)(l.Trash2,{className:`h-4 w-4`})})]}),n.length===0?(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`Sem sub-campos configurados`}):(0,d.jsx)(`div`,{className:`grid grid-cols-12 gap-3`,children:n.map(n=>{let r=n.config.fieldType||`texto`,i=n.config.tamanho||6,a=e[n.id]??``,o=e=>C(t,n.id,e),s=v[`${t}.${n.id}`];return(0,d.jsxs)(`div`,{className:`space-y-1`,style:{gridColumn:`span ${i}`},children:[(0,d.jsxs)(K,{className:`text-xs font-medium`,children:[n.config.label,n.config.required&&(0,d.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),r===`textarea`?(0,d.jsx)(_f,{placeholder:n.config.placeholder,className:s?`text-sm border-destructive`:`text-sm`,value:a,onChange:e=>o(e.target.value)}):r===`select`?(0,d.jsxs)(vd,{value:a,onValueChange:o,children:[(0,d.jsx)(bd,{className:s?`text-sm border-destructive`:`text-sm`,children:(0,d.jsx)(yd,{placeholder:n.config.placeholder||`Selecione...`})}),(0,d.jsx)(Cd,{children:(n.config.options||[]).map((e,t)=>(0,d.jsx)($,{value:e.value||`__opt_${t}`,children:e.label},`${t}-${e.value}`))})]}):r===`checkbox`?(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(X,{checked:a===`true`,onCheckedChange:e=>o(e?`true`:``)}),(0,d.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:n.config.placeholder||n.config.label})]}):(0,d.jsx)(G,{type:am(r),placeholder:n.config.placeholder,className:s?`text-sm border-destructive`:`text-sm`,value:a,onChange:e=>o(e.target.value)}),s&&(0,d.jsxs)(`p`,{className:`text-xs text-destructive flex items-center gap-1`,children:[(0,d.jsx)(l.AlertCircle,{className:`h-3 w-3 shrink-0`}),s]})]},n.id)})})]},t))}),(0,d.jsxs)(Z,{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:x,disabled:g.length>=u,children:[(0,d.jsx)(l.Plus,{className:`h-4 w-4 mr-2`}),p]}),e.maxItems&&(0,d.jsxs)(`p`,{className:`text-xs text-center text-muted-foreground`,children:[`Máximo de `,e.maxItems,` `,(f||`item`).toLowerCase(),e.maxItems===1?``:`s`]}),!e.maxItems&&e.hint&&(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint}),i&&(0,d.jsxs)(`p`,{className:`text-sm text-destructive flex items-center gap-1`,children:[(0,d.jsx)(l.AlertCircle,{className:`h-4 w-4 shrink-0`}),i]})]})},cm=({config:e,fieldId:t,value:n,onChange:r,visible:i,error:a,subFields:o,eventoData:s,allValues:c})=>{let u=e.fieldType||`texto`,f=e.tamanho||6;if(!i)return null;if(u===`field_array`)return(0,d.jsx)(sm,{config:e,fieldId:t,subFields:o??[],tamanho:f,error:a,onChange:r,value:n});let p=a?`border-destructive`:``;return(0,d.jsxs)(`div`,{className:`space-y-1`,style:{gridColumn:e.inicioColuna?`${e.inicioColuna} / span ${f}`:`span ${f}`},children:[u!==`terms`&&(0,d.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,d.jsxs)(K,{className:`text-sm font-medium`,children:[e.label,e.required&&(0,d.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),e.condition&&(0,d.jsxs)(Ep,{variant:`outline`,className:`text-[9px] px-1 py-0 h-4 border-amber-500/50 text-amber-600`,children:[(0,d.jsx)(l.Zap,{className:`h-2.5 w-2.5 mr-0.5`}),`cond`]})]}),u===`textarea`?(0,d.jsx)(_f,{placeholder:e.placeholder,className:W(`text-sm`,p),value:n,onChange:e=>r(e.target.value)}):u===`select`?(0,d.jsxs)(vd,{value:n,onValueChange:r,children:[(0,d.jsx)(bd,{className:W(`text-sm`,p),children:(0,d.jsx)(yd,{placeholder:e.placeholder||`Selecione...`})}),(0,d.jsx)(Cd,{children:(e.options||[]).map((e,t)=>(0,d.jsx)($,{value:e.value||`__opt_${t}`,children:e.label},`${t}-${e.value}`))})]}):u===`checkbox`?(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(X,{checked:n===`true`,onCheckedChange:e=>r(e?`true`:``)}),(0,d.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.placeholder||e.label})]}):u===`checkbox_group`?(0,d.jsx)(lm,{config:e,value:n,onChange:r}):u===`radio`?(0,d.jsx)(`div`,{className:`space-y-2`,children:(e.options||[{value:`1`,label:`Opção 1`}]).map((t,r)=>e.visualStyle===`default`?(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(`input`,{type:`radio`,readOnly:!0,checked:n===t.value,className:`accent-orange-500`}),(0,d.jsx)(`span`,{className:`text-sm`,children:t.label})]},`${r}-${t.value}`):(0,d.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-xl border-2 transition-all cursor-pointer bg-card border-border`,children:[(0,d.jsx)(`input`,{type:`radio`,readOnly:!0,checked:n===t.value,className:`accent-orange-500`}),(0,d.jsx)(`span`,{className:`text-sm flex-1`,children:t.label})]},`${r}-${t.value}`))}):u===`participation_type`?(()=>{let e=parseInt(s?.[`evento.valor`]??`0`)||0,t=parseInt(s?.[`evento.valorPorDia`]??`0`)||0,i=s?.[`evento.vagasTotal`],a=s?.[`evento.vagasPorDia`],o=s?.[`evento.vagasMasculinas`],c=s?.[`evento.vagasFemininas`],u=!!(o&&Number(o)>0)&&!!(c&&Number(c)>0),f=s?.[`evento.dataInicioEvento`],p=s?.[`evento.dataFimEvento`],m=e=>e?e.slice(8,10)+`/`+e.slice(5,7)+`/`+e.slice(0,4):`—`,h=f&&p?`${m(f)} a ${m(p)}`:`Período do evento`,g=(f&&p?Math.round((new Date(p.slice(0,10)+`T00:00:00Z`).getTime()-new Date(f.slice(0,10)+`T00:00:00Z`).getTime())/864e5)+1:0)>1,_={};try{_=n?JSON.parse(n):{}}catch{}let v=_.tipo??null,y=_.data??null,b=_.genero??null,x=e=>r(JSON.stringify({tipo:e,data:null,...u?{genero:b}:{}})),S=e=>r(JSON.stringify({tipo:`por_dia`,data:e,...u?{genero:b}:{}})),C=e=>r(JSON.stringify({tipo:v,data:y,genero:e})),w=[];if(g&&f&&p){let e=new Date(f.slice(0,10)+`T00:00:00Z`),t=new Date(p.slice(0,10)+`T00:00:00Z`),n=0;for(;e<=t&&n++<60;)w.push(e.toISOString().slice(0,10)),e.setUTCDate(e.getUTCDate()+1)}let T=e=>{let[t,n,r]=e.split(`-`).map(Number),i=new Date(Date.UTC(t,n-1,r)),a=String(r).padStart(2,`0`),o=String(n).padStart(2,`0`),s=new Intl.DateTimeFormat(`pt-BR`,{weekday:`long`,timeZone:`UTC`}).format(i);return`${a}/${o} — ${s.charAt(0).toUpperCase()}${s.slice(1)}`};return(0,d.jsxs)(`div`,{className:`space-y-2`,children:[u&&(0,d.jsxs)(`div`,{className:`flex items-center gap-2 px-1`,children:[(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:`Você é:`}),(0,d.jsx)(`div`,{className:`flex gap-2`,children:[`masculino`,`feminino`].map(e=>{let t=e===`masculino`?`Masculino`:`Feminino`;return(0,d.jsx)(`button`,{type:`button`,onClick:()=>C(e),className:W(`px-3 py-1 rounded-full text-xs font-medium border transition-all`,b===e?`border-primary bg-primary text-primary-foreground`:`border-border bg-card text-muted-foreground hover:border-primary/60`),children:t},e)})})]}),(0,d.jsxs)(`button`,{type:`button`,onClick:()=>x(`todos_os_dias`),className:W(`w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all bg-card`,v===`todos_os_dias`?`border-primary bg-primary/10`:`border-border hover:border-primary/40`),children:[(0,d.jsx)(`div`,{className:W(`mt-0.5 p-2 rounded-lg shrink-0`,v===`todos_os_dias`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:(0,d.jsx)(l.CalendarCheck2,{className:`w-4 h-4`})}),(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsx)(`p`,{className:`text-sm font-semibold`,children:`Participar todos os dias`}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:h})]}),(0,d.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,d.jsx)(`p`,{className:W(`text-sm font-bold`,v===`todos_os_dias`?`text-primary`:`text-foreground`),children:e>0?om(e):`R$ —,—`}),i&&(0,d.jsxs)(`p`,{className:`text-xs text-emerald-500 flex items-center justify-end gap-1`,children:[(0,d.jsx)(l.Users,{className:`w-3 h-3`}),i,` vagas`]})]})]}),g?(0,d.jsxs)(`button`,{type:`button`,onClick:()=>x(`por_dia`),className:W(`w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all bg-card`,v===`por_dia`?`border-primary bg-primary/10`:`border-border hover:border-primary/40`),children:[(0,d.jsx)(`div`,{className:W(`mt-0.5 p-2 rounded-lg shrink-0`,v===`por_dia`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:(0,d.jsx)(l.CalendarDays,{className:`w-4 h-4`})}),(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsx)(`p`,{className:`text-sm font-semibold`,children:`Participar um dia`}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Escolha o dia desejado`})]}),(0,d.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,d.jsx)(`p`,{className:W(`text-sm font-bold`,v===`por_dia`?`text-primary`:`text-foreground`),children:t>0?om(t):`R$ —,—`}),a&&(0,d.jsxs)(`p`,{className:`text-xs text-emerald-500 flex items-center justify-end gap-1`,children:[(0,d.jsx)(l.Users,{className:`w-3 h-3`}),a,` vagas/dia`]})]})]}):f?(0,d.jsxs)(`div`,{className:`flex items-start gap-2 px-3 py-2.5 rounded-lg bg-muted/50 border border-border`,children:[(0,d.jsx)(l.Info,{className:`w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground`}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Evento de 1 dia — a opção "Participar um dia" não é exibida.`})]}):(0,d.jsxs)(`div`,{className:`flex items-start gap-3 p-4 rounded-xl border-2 border-border bg-card opacity-40`,children:[(0,d.jsx)(`div`,{className:`mt-0.5 p-2 rounded-lg shrink-0 bg-muted text-muted-foreground`,children:(0,d.jsx)(l.CalendarDays,{className:`w-4 h-4`})}),(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsx)(`p`,{className:`text-sm font-semibold`,children:`Participar um dia`}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`Visível se evento tiver 2+ dias`})]}),(0,d.jsx)(`div`,{className:`text-right shrink-0`,children:(0,d.jsx)(`p`,{className:`text-sm font-bold text-primary`,children:`R$ —,—`})})]}),v===`por_dia`&&w.length>0&&(0,d.jsxs)(`div`,{className:`pl-2 space-y-2`,children:[(0,d.jsx)(`p`,{className:`text-xs font-semibold text-primary uppercase tracking-wide`,children:`Selecione o dia:`}),w.map(e=>(0,d.jsxs)(`button`,{type:`button`,onClick:()=>S(e),className:W(`w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all`,y===e?`border-primary bg-primary/10 text-primary`:`border-border bg-card hover:border-primary/40`),children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,d.jsx)(`span`,{className:W(`w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center`,y===e?`border-primary bg-primary`:`border-muted-foreground`),children:y===e&&(0,d.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-primary-foreground`})}),(0,d.jsx)(`span`,{className:`text-sm`,children:T(e)})]}),a&&(0,d.jsxs)(`span`,{className:`text-xs text-emerald-500`,children:[a,` vagas`]})]},e))]})]})})():u===`payment_method`?(()=>{let e=.0315,t=.124,i=c?._participation_type_field??``,a={};try{a=i?JSON.parse(i):{}}catch{}let o=a.tipo??null,u=Number(s?.[`evento.valor`]??0)||0,f=Number(s?.[`evento.valorPorDia`]??0)||0,p=o===`por_dia`&&f>0?f:u,m=o===`por_dia`?(()=>{if(!a.data)return`Um dia`;let[e,t,n]=a.data.split(`-`);return`${n}/${t}/${e}`})():`Todos os dias`,h=o===`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:e,parcelas:0,taxaLabel:`Taxa InfinityPay: ${(e*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:t,parcelas:12,taxaLabel:`Taxa InfinityPay: ${(t*100).toFixed(2).replace(`.`,`,`)}%`},{id:`dinheiro`,label:`Dinheiro`,desc:`Pagamento em espécie`,taxa:0,parcelas:0}],g={};try{g=n?JSON.parse(n):{}}catch{}let _=g.metodo??null,v=e=>{let t=Math.round(p*(1+e.taxa)*100)/100,n={metodo:e.id,valorTotal:t};e.parcelas>1&&(n.parcelas=e.parcelas),r(JSON.stringify(n))};return(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl border border-border bg-card px-4 py-3`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Tipo de participação`}),(0,d.jsx)(`p`,{className:`font-semibold`,children:m})]}),(0,d.jsxs)(`div`,{className:`text-right`,children:[(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Valor base`}),(0,d.jsx)(`p`,{className:`text-lg font-bold text-primary`,children:om(p)})]})]}),(0,d.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:[(0,d.jsx)(l.Info,{className:`h-4 w-4 text-amber-500 mt-0.5 shrink-0`}),(0,d.jsxs)(`p`,{className:`text-xs text-amber-200`,children:[(0,d.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.`]})]}),(0,d.jsx)(`p`,{className:`text-sm font-semibold text-primary`,children:`Selecione a forma de pagamento:`}),(0,d.jsx)(`div`,{className:`space-y-3`,children:h.map(e=>{let t=_===e.id,n=Math.round(p*(1+e.taxa)*100)/100,r=e.parcelas>1,i=r?Math.round(n/e.parcelas*100)/100:null;return(0,d.jsxs)(`button`,{type:`button`,onClick:()=>v(e),className:W(`w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all bg-card`,t?`border-primary bg-primary/10`:`border-border hover:border-primary/50`),children:[(0,d.jsx)(`div`,{className:W(`flex items-center justify-center w-10 h-10 rounded-lg shrink-0`,t?`bg-primary/20`:`bg-muted`),children:(0,d.jsx)(l.Wallet,{className:W(`h-5 w-5`,t?`text-primary`:`text-muted-foreground`)})}),(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsx)(`p`,{className:`font-semibold text-sm leading-tight`,children:e.label}),(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.desc}),e.taxaLabel&&(0,d.jsxs)(`p`,{className:`text-xs text-amber-400 mt-0.5`,children:[`* `,e.taxaLabel]}),e.taxa>0&&(0,d.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Total com taxa: `,om(n)]})]}),(0,d.jsx)(`div`,{className:`text-right shrink-0`,children:r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.parcelas,`x de`]}),(0,d.jsx)(`p`,{className:`text-base font-bold text-primary`,children:om(i)})]}):(0,d.jsx)(`p`,{className:`text-base font-bold text-primary`,children:om(n)})})]},e.id)})})]})})():u===`terms`?(()=>{let t=n===`accepted`,i=e.termoTexto,a=e.termoPdfUrl,o=!!e.termoPdfUploadId,s=!!(i||a||o);return(0,d.jsxs)(`div`,{className:W(`rounded-lg border p-4 space-y-4 transition-colors`,t?`border-green-500/40 bg-green-500/5`:`border-border bg-muted/30`),children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(l.ScrollText,{className:`h-4 w-4 text-primary shrink-0`}),(0,d.jsx)(`span`,{className:`text-sm font-medium`,children:e.label||`Termos e condições`})]}),s?(0,d.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[o&&(0,d.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 ✓`}),(0,d.jsxs)(Z,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 gap-1.5 text-xs`,onClick:()=>{},children:[(0,d.jsx)(l.ExternalLink,{className:`h-3 w-3`}),`Ler termos`]})]}):(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:`Conteúdo não configurado`})]}),(0,d.jsxs)(`label`,{className:`flex items-start gap-3 cursor-pointer select-none`,children:[(0,d.jsx)(X,{checked:t,onCheckedChange:e=>r(e?`accepted`:``),className:`mt-0.5`}),(0,d.jsxs)(`span`,{className:`text-sm leading-snug flex-1`,children:[`Li e aceito`,` `,e.label?`"${e.label}"`:`os termos e condições`]}),t&&(0,d.jsx)(l.CheckCircle2,{className:`h-4 w-4 text-green-500 shrink-0 mt-0.5`})]})]})})():u===`file`?(0,d.jsx)(G,{type:`file`,className:W(`text-sm`,p)}):u===`hidden`?(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`Campo oculto`}):(0,d.jsx)(G,{type:am(u),placeholder:e.placeholder,className:W(`text-sm`,p),value:n,onChange:e=>r(e.target.value)}),a?(0,d.jsxs)(`p`,{className:`text-xs text-destructive flex items-center gap-1`,children:[(0,d.jsx)(l.AlertCircle,{className:`h-3 w-3 shrink-0`}),a]}):e.hint?(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.hint}):null]})},lm=({config:e,value:t,onChange:n})=>{let r=new Set(t?t.split(`,`):[]),i=e.options?.length?e.options:[{value:`1`,label:`Opção 1`}],a=e=>{let t=new Set(r);t.has(e)?t.delete(e):t.add(e),n(Array.from(t).join(`,`))};return(0,d.jsx)(`div`,{className:`space-y-1`,children:i.map((e,t)=>(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(X,{checked:r.has(e.value),onCheckedChange:()=>a(e.value),disabled:e.disabled}),(0,d.jsx)(`span`,{className:`text-sm`,children:e.label})]},`${t}-${e.value}`))})},um=({step:e,stepIndex:t,formValues:n,errors:r,eventoData:i,onChange:a})=>(0,d.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 space-y-5`,children:[(0,d.jsxs)(`div`,{children:[e.config.showLabel!==!1&&(0,d.jsxs)(`h2`,{className:`text-base font-bold text-foreground`,children:[`Step `,t+1,` — `,e.config.label]}),e.config.description&&(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground mt-0.5`,children:e.config.description})]}),(0,d.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-12 gap-4`,children:e.containers.map(e=>(0,d.jsxs)(`div`,{className:W(`space-y-3`,e.config.showAsCard&&`rounded-lg border bg-card p-4 shadow-sm`),style:{gridColumn:e.config.inicioColuna?`${e.config.inicioColuna} / span ${e.config.tamanho||12}`:`span ${e.config.tamanho||12}`},children:[e.config.showLabel!==!1&&e.config.label!==`Novo Container`&&(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:e.config.label}),e.config.description&&(0,d.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.config.description})]}),(0,d.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-12 gap-3`,children:e.fields.map(e=>(0,d.jsx)(cm,{config:e.config,fieldId:e.id,subFields:e.subFields,value:n[e.id]||``,onChange:t=>a(e.id,t),visible:Zp(e.config.condition,n,i),error:r[e.id],eventoData:i,allValues:n},e.id))})]},e.id))})]}),dm=({currentStep:e,isLastStep:t,onBack:n,onNext:r})=>(0,d.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,d.jsxs)(Z,{variant:`outline`,onClick:n,disabled:e===0,children:[(0,d.jsx)(l.ChevronLeft,{className:`w-4 h-4 mr-1`}),`Voltar`]}),(0,d.jsx)(Z,{onClick:r,children:t?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l.Check,{className:`w-4 h-4 mr-1`}),`Finalizar`]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l.ChevronRight,{className:`w-4 h-4 mr-1`}),`Próximo`]})})]}),fm=({onRestart:e})=>(0,d.jsxs)(`div`,{className:`max-w-4xl mx-auto flex flex-col items-center justify-center py-16 space-y-4`,children:[(0,d.jsx)(`div`,{className:`w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center`,children:(0,d.jsx)(l.PartyPopper,{className:`w-8 h-8 text-primary`})}),(0,d.jsx)(`h2`,{className:`text-xl font-bold text-foreground`,children:`Formulário enviado!`}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Este é um preview simulado. Nenhum dado foi enviado.`}),(0,d.jsxs)(Z,{variant:`outline`,onClick:e,children:[(0,d.jsx)(l.RotateCcw,{className:`w-4 h-4 mr-1`}),`Recomeçar`]})]}),pm=e=>{if(e)return l[e]},mm=({steps:e,currentStep:t,onStepClick:n})=>(0,d.jsx)(`div`,{className:`flex items-center justify-center gap-2 flex-wrap`,children:e.map((e,r)=>(0,d.jsx)(`div`,{role:n?`button`:void 0,tabIndex:n?0:void 0,onClick:()=>n?.(r),onKeyDown:e=>e.key===`Enter`&&n?.(r),className:W(`w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all shrink-0`,n&&`cursor-pointer hover:opacity-80`),style:r===t?{background:`var(--t-primary)`,color:`#ffffff`,boxShadow:`0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)`}:r<t?{background:`#22c55e`,color:`#ffffff`}:{background:`hsl(var(--muted))`,color:`hsl(var(--muted-foreground))`},children:r<t?(0,d.jsx)(l.Check,{className:`w-4 h-4`}):r+1},e.id))}),hm=({steps:e,currentStep:t,onStepClick:n})=>(0,d.jsx)(`div`,{className:`flex items-center justify-center gap-2 flex-wrap`,children:e.map((e,r)=>{let i=pm(e.icone)??l.CircleDot;return(0,d.jsx)(`div`,{role:n?`button`:void 0,tabIndex:n?0:void 0,onClick:()=>n?.(r),onKeyDown:e=>e.key===`Enter`&&n?.(r),className:W(`w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0`,n&&`cursor-pointer hover:opacity-80`),style:r===t?{background:`var(--t-primary)`,color:`#ffffff`,boxShadow:`0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)`}:r<t?{background:`#22c55e`,color:`#ffffff`}:{background:`hsl(var(--muted))`,color:`hsl(var(--muted-foreground))`},children:r<t?(0,d.jsx)(l.Check,{className:`w-4 h-4`}):(0,d.jsx)(i,{className:`w-4 h-4`})},e.id)})}),gm=({steps:e,currentStep:t,position:n,orientation:r=`horizontal`,onStepClick:i})=>r===`vertical`?(0,d.jsx)(`div`,{className:`flex flex-col gap-0`,children:e.map((n,r)=>{let a=pm(n.icone)??l.CircleDot,o=r===t,s=r<t,c=r===e.length-1;return(0,d.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,d.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>i?.(r),className:W(`w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0`,i&&`cursor-pointer hover:opacity-80`),style:o?{background:`var(--t-primary)`,color:`#fff`,boxShadow:`0 0 10px color-mix(in srgb, var(--t-primary) 50%, transparent)`}:s?{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:s?(0,d.jsx)(l.Check,{className:`w-3.5 h-3.5`}):(0,d.jsx)(a,{className:`w-3.5 h-3.5`})}),!c&&(0,d.jsx)(`div`,{className:`w-[2px] my-1`,style:{height:`24px`,background:s?`#22c55e`:`color-mix(in srgb, var(--t-border) 50%, transparent)`}})]}),(0,d.jsx)(`span`,{className:`text-sm font-medium leading-tight mt-1.5`,style:o?{color:`var(--t-primary)`}:s?{color:`#16a34a`}:{color:`var(--t-text-muted)`},children:n.label})]},n.id)})}):(0,d.jsx)(`div`,{className:`w-full flex items-start`,children:e.map((n,r)=>{let a=pm(n.icone)??l.CircleDot,o=r===t,s=r<t,c=r===e.length-1;return(0,d.jsxs)(`div`,{className:W(`flex items-start`,!c&&`flex-1`),children:[(0,d.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:()=>i?.(r),className:W(`w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0`,i&&`cursor-pointer hover:opacity-80`),style:o?{background:`var(--t-primary)`,color:`#ffffff`,boxShadow:`0 0 12px color-mix(in srgb, var(--t-primary) 50%, transparent)`}:s?{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:s?(0,d.jsx)(l.Check,{className:`w-4 h-4`}):(0,d.jsx)(a,{className:`w-4 h-4`})}),(0,d.jsx)(`span`,{className:`text-[10px] font-medium text-center leading-tight line-clamp-2 px-0.5`,style:o?{color:`var(--t-primary)`}:s?{color:`#16a34a`}:{color:`var(--t-text-muted)`},children:n.label})]}),!c&&(0,d.jsx)(`div`,{className:`flex-1 h-[1.5px] mt-5 mx-1`,style:{background:s?`linear-gradient(90deg, var(--t-primary), color-mix(in srgb, var(--t-primary) 40%, transparent))`:`color-mix(in srgb, var(--t-border) 50%, transparent)`}})]},n.id)})}),_m=({steps:e,currentStep:t,onStepClick:n,className:r})=>{let{layout:i}=(0,p.useTemplate)();if(!i.showStepIndicators||e.length<=1)return null;let a=i.stepIndicatorVariant??`numbers`,o=i.stepIndicatorPosition??`top-center`,s=i.stepIndicatorOrientation??`horizontal`,c=(t+1)/e.length*100,u=e[t],f=pm(u?.icone)??l.CircleDot,m=(0,d.jsx)(`div`,{className:`h-1 rounded-full overflow-hidden`,style:{background:`color-mix(in srgb, var(--t-primary) 15%, transparent)`},children:(0,d.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500`,style:{width:`${c}%`,background:`linear-gradient(90deg, var(--t-primary), var(--t-accent))`}})}),h=(0,d.jsxs)(`div`,{className:`block sm:hidden space-y-2`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,d.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center shrink-0`,style:{background:`var(--t-primary)`,color:`#fff`},children:(0,d.jsx)(f,{className:`w-5 h-5`})}),(0,d.jsxs)(`div`,{className:`min-w-0`,children:[(0,d.jsx)(`p`,{className:`text-sm font-semibold leading-tight truncate`,style:{color:`var(--t-text)`},children:u?.label}),(0,d.jsxs)(`p`,{className:`text-xs leading-tight`,style:{color:`var(--t-text-muted)`},children:[`Passo `,t+1,` de `,e.length]})]})]}),m]}),g=(0,d.jsxs)(`div`,{className:`hidden sm:block`,children:[a===`numbers`&&(0,d.jsx)(mm,{steps:e,currentStep:t,onStepClick:n}),a===`icons`&&(0,d.jsx)(hm,{steps:e,currentStep:t,onStepClick:n}),a===`icons-labeled`&&(0,d.jsx)(gm,{steps:e,currentStep:t,position:o,orientation:s,onStepClick:n})]}),_=i.showProgressBar?(0,d.jsx)(`div`,{className:`hidden sm:block`,children:m}):null;return s===`vertical`?(0,d.jsxs)(`div`,{className:W(`flex gap-6 items-start`,r),children:[h,(0,d.jsxs)(`div`,{className:`hidden sm:flex gap-6 items-start shrink-0`,children:[g,_&&(0,d.jsx)(`div`,{className:`flex-1 pt-4`,children:_})]})]}):(0,d.jsxs)(`div`,{className:W(`space-y-3`,r),children:[h,(0,d.jsxs)(`div`,{className:`hidden sm:block space-y-3`,children:[g,_]})]})},vm=({eventoData:e})=>{let{getConfig:t,containers:n,previewTemplateId:r}=j(),i=Xp({containers:n},t),[a,o]=(0,c.useState)({}),[s,l]=(0,c.useState)(0),[u,f]=(0,c.useState)(!1),[m,h]=(0,c.useState)({}),[g,_]=(0,c.useState)(!1),v=Math.min(s,Math.max(i.length-1,0));(0,c.useEffect)(()=>{v!==s&&l(v)},[v,s,l]);let y=(0,c.useCallback)((t,n)=>{if(o(e=>({...e,[t]:n})),g){let r=i[v]?.containers.flatMap(e=>e.fields).find(e=>e.id===t);if(r){let i=Qp(n,r.config,{...a,[t]:n},e);h(e=>{let n={...e};return i?n[t]=i:delete n[t],n})}}},[g,i,v,a,e,o,h]),b=(0,c.useCallback)(()=>{let t=i[v];if(!t)return!0;let n={};for(let r of t.containers)for(let t of r.fields){if(t.config.fieldType===`field_array`){let e=!1;try{let r=a[t.id],i=r?JSON.parse(r):[],o=t.config.minItems??1;if(i.length<o)n[t.id]=`Mínimo de ${o} item${o===1?``:`s`} obrigatório${o===1?``:`s`}`,e=!0;else{for(let n of i){for(let r of t.subFields??[]){let t=n[r.id]??``;if(r.config.required&&!t.trim()){e=!0;break}}if(e)break}e&&(n[t.id]=`Preencha todos os campos obrigatórios`)}}catch{t.config.required&&(n[t.id]=`Campo obrigatório`)}continue}let r=Qp(a[t.id]||``,t.config,a,e);r&&(n[t.id]=r)}h(n),_(!0);let r=Object.keys(n).length;return r>0?(console.warn(`Corrija ${r} campo(s) destacado(s) antes de continuar`),!1):!0},[i,v,a,e,h,_]),x=(0,c.useCallback)(()=>{b()&&(_(!1),h({}),v>=i.length-1?f(!0):l(e=>e+1))},[b,v,i.length,_,h,f,l]),S=(0,c.useCallback)(()=>{l(e=>e-1),_(!1),h({})},[l,_,h]),C=(0,c.useCallback)(()=>{let t={};for(let n of i)for(let r of n.containers)for(let n of r.fields)Zp(n.config.condition,a,e)&&(t[n.id]=em(n.config,n.subFields));o(e=>({...e,...t}))},[i,a,e,o]),w=(0,c.useCallback)(()=>{o({}),h({}),_(!1)},[o,h,_]),T=(0,c.useCallback)(()=>{f(!1),l(0),w()},[f,l,w]);if(i.length===0)return(0,d.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(u)return(0,d.jsx)(fm,{onRestart:T});let E=i[v],D=v===i.length-1,O=(0,p.getTemplateConfig)(r);return(0,d.jsxs)(`div`,{className:`space-y-3`,children:[(0,d.jsx)(`div`,{className:`px-1`,children:(0,d.jsx)(rm,{onFillMock:C,onClear:w})}),(0,d.jsx)(p.TemplateProvider,{config:O,className:O.wrapperClass,style:{minHeight:`100%`,padding:`12px`,borderRadius:`12px`},children:(0,d.jsxs)(`div`,{className:`max-w-4xl mx-auto space-y-4`,children:[(0,d.jsx)(_m,{steps:i.map(e=>({id:e.id,label:e.config.label,icone:e.config.icone})),currentStep:v}),(0,d.jsx)(um,{step:E,stepIndex:v,formValues:a,errors:m,eventoData:e,onChange:y}),(0,d.jsx)(dm,{currentStep:v,isLastStep:D,onBack:S,onNext:x})]})})]})},ym=({id:e,currentTamanho:t,inicioColuna:n,onResize:r})=>{let i=(0,c.useRef)(null),[a,o]=(0,c.useState)(!1),[s,l]=(0,c.useState)(null),u=(0,c.useRef)(null);return(0,c.useEffect)(()=>()=>{u.current?.()},[]),{resizeRef:i,resizing:a,resizePreview:s,handleResizeStart:(0,c.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let t=i.current;if(!t)return;let a=t.parentElement;if(!a)return;let s=a.getBoundingClientRect().width,c=t.getBoundingClientRect().width,d=e.clientX,f=n?13-n:12;o(!0);let p=e=>{let t=(c+(e.clientX-d))/s,n=Math.max(1,Math.min(f,Math.round(t*12)));l(n),r(n)},m=()=>{o(!1),l(null),u.current=null,window.removeEventListener(`mousemove`,p),window.removeEventListener(`mouseup`,m)};u.current=()=>{o(!1),l(null),window.removeEventListener(`mousemove`,p),window.removeEventListener(`mouseup`,m)},window.addEventListener(`mousemove`,p),window.addEventListener(`mouseup`,m)},[n,r])}},bm=({id:e,elementRef:t,onPositionApply:n,setPositionDrag:r,setSelected:i})=>{let a=(0,c.useRef)(null);return(0,c.useEffect)(()=>()=>{a.current?.()},[]),{handlePositionMouseDown:(0,c.useCallback)(o=>{o.preventDefault(),o.stopPropagation(),i(e);let s=t.current;if(!s)return;let c=s.parentElement;if(!c)return;let l=c.getBoundingClientRect(),u=l.width/12,d=s.getBoundingClientRect(),f=Math.max(1,Math.round(d.width/u)),p=d.left-l.left,m=o.clientX-d.left,h=e=>{let t=e-l.left-m,n=Math.round(t/u)+1;return Math.max(1,Math.min(13-f,n))};r({itemId:e,ghostStart:Math.max(1,Math.min(12,Math.round(p/u)+1)),ghostSpan:f,cursorX:o.clientX,cursorY:o.clientY});let g=t=>{r({itemId:e,ghostStart:h(t.clientX),ghostSpan:f,cursorX:t.clientX,cursorY:t.clientY})},_=e=>{n(h(e.clientX)),r(null),a.current=null,window.removeEventListener(`mousemove`,g),window.removeEventListener(`mouseup`,_)};a.current=()=>{r(null),window.removeEventListener(`mousemove`,g),window.removeEventListener(`mouseup`,_)},window.addEventListener(`mousemove`,g),window.addEventListener(`mouseup`,_)},[e,t,n,r,i])}},xm=({id:e,container:t})=>{let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=(0,m.useSortable)({id:e,data:{isCanvasItem:!0,type:`field`,id:e,fromContainer:t}}),{selectedId:c,setSelected:u,getConfig:f,updateConfig:p,removeItem:g,setPositionDrag:_,positionDrag:v}=j(),y=f(e),b=S(e)?.icon||l.Type,x=c===e,C=y.tamanho||6,w=v?.itemId===e,{resizeRef:T,resizing:E,resizePreview:D,handleResizeStart:O}=ym({id:e,currentTamanho:C,inicioColuna:y.inicioColuna,onResize:t=>p(e,{tamanho:t})}),{handlePositionMouseDown:k}=bm({id:e,elementRef:T,onPositionApply:t=>p(e,{inicioColuna:t}),setPositionDrag:_,setSelected:u});return(0,d.jsxs)(`div`,{ref:e=>{i(e),T.current=e},onClick:t=>{t.stopPropagation(),u(e)},"data-field-id":e,className:W(`group relative flex items-center gap-2 rounded border bg-card/80 backdrop-blur-sm px-2.5 py-1.5 pb-3 cursor-pointer transition-all text-xs`,E&&`ring-2 ring-blue-400/50`,w&&`opacity-0 pointer-events-none`,x?`border-primary ring-2 ring-primary/30 shadow-md`:`border-border/60 hover:border-muted-foreground/50 shadow-sm`),style:{gridColumn:y.inicioColuna?`${y.inicioColuna} / span ${C}`:`span ${C}`,transform:h.CSS.Transform.toString(a),transition:o,opacity:s?0:1},children:[(0,d.jsx)(`div`,{onMouseDown:k,onClick:e=>e.stopPropagation(),className:`cursor-ew-resize shrink-0 p-0.5 rounded hover:bg-primary/20 transition-colors`,title:`Arrastar para mudar coluna`,children:(0,d.jsx)(l.ArrowLeftRight,{className:`h-3 w-3 text-primary/60`})}),(0,d.jsx)(`div`,{...r,...n,className:`cursor-grab shrink-0`,onClick:e=>e.stopPropagation(),children:(0,d.jsx)(l.GripVertical,{className:`h-3 w-3 text-muted-foreground`})}),(0,d.jsx)(b,{className:`h-3.5 w-3.5 text-primary shrink-0`}),(0,d.jsx)(`span`,{className:`font-medium truncate flex-1`,children:y.label}),y.condition&&(0,d.jsx)(l.Zap,{className:`h-3 w-3 text-amber-500 shrink-0`}),y.required&&(0,d.jsx)(`span`,{className:`text-destructive font-bold`,children:`*`}),(0,d.jsxs)(`span`,{className:`text-[9px] text-muted-foreground shrink-0`,children:[D??C,`/12`]}),(0,d.jsx)(`button`,{onClick:t=>{t.stopPropagation(),g(e)},className:`opacity-0 group-hover:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10`,children:(0,d.jsx)(l.Trash2,{className:`h-3 w-3 text-destructive`})}),(0,d.jsx)(`div`,{className:`absolute -bottom-0.5 left-2 text-[8px] text-muted-foreground/30 font-mono truncate max-w-[90%] pointer-events-none`,children:e}),(0,d.jsx)(`div`,{"data-resize":!0,onMouseDown:O,className:`absolute right-0 top-0 bottom-0 w-2 cursor-col-resize hover:bg-primary/20 transition-colors flex items-center justify-center`,children:(0,d.jsx)(l.GripHorizontal,{className:`h-3 w-3 text-primary/40 rotate-90`})})]})},Sm=({id:e,container:t})=>{let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=(0,m.useSortable)({id:e,data:{isCanvasItem:!0,type:`field`,id:e,fromContainer:t}}),{setNodeRef:c,isOver:u}=(0,g.useDroppable)({id:`zone-${e}`}),{selectedId:f,setSelected:p,getConfig:_,removeItem:v,moveItem:y,containers:x}=j(),S=_(e),C=(x[e]?.children??[]).filter(e=>b(e)===`field`),w=f===e,T=S.tamanho||12;return(0,d.jsxs)(`div`,{ref:i,onClick:t=>{t.stopPropagation(),p(e)},className:W(`group/fa relative rounded-lg border overflow-hidden transition-all`,s&&`opacity-0 pointer-events-none`,w?`border-amber-500 ring-2 ring-amber-500/20 shadow-lg`:`border-amber-500/30 hover:border-amber-500/50`),style:{gridColumn:S.inicioColuna?`${S.inicioColuna} / span ${T}`:`span ${T}`,transform:h.CSS.Transform.toString(a),transition:o},children:[(0,d.jsxs)(`div`,{className:W(`flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors`,w?`bg-amber-500/15 border-amber-500/30`:`bg-amber-500/10 border-amber-500/20`),children:[(0,d.jsx)(`div`,{...r,...n,className:`cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-amber-500/20 active:cursor-grabbing transition-colors`,onClick:e=>e.stopPropagation(),children:(0,d.jsx)(l.GripVertical,{className:`h-3.5 w-3.5 text-amber-500`})}),(0,d.jsxs)(`div`,{className:`flex flex-col -my-1 shrink-0`,children:[(0,d.jsx)(`button`,{onClick:t=>{t.stopPropagation(),y(e,`up`)},className:`p-0 hover:bg-amber-500/10 rounded transition-colors`,title:`Mover para cima`,children:(0,d.jsx)(l.ChevronUp,{className:`h-3 w-3 text-muted-foreground hover:text-amber-500`})}),(0,d.jsx)(`button`,{onClick:t=>{t.stopPropagation(),y(e,`down`)},className:`p-0 hover:bg-amber-500/10 rounded transition-colors`,title:`Mover para baixo`,children:(0,d.jsx)(l.ChevronDown,{className:`h-3 w-3 text-muted-foreground hover:text-amber-500`})})]}),(0,d.jsx)(l.List,{className:`h-3.5 w-3.5 text-amber-500 shrink-0`}),(0,d.jsx)(`span`,{className:`text-xs font-semibold truncate flex-1 text-amber-700 dark:text-amber-300`,children:S.label}),(0,d.jsxs)(`span`,{className:`text-[10px] text-muted-foreground shrink-0 bg-amber-500/10 px-1.5 rounded`,children:[S.itemLabel||`Item`,` · `,C.length,` campo`,C.length===1?``:`s`]}),(0,d.jsx)(`button`,{onClick:t=>{t.stopPropagation(),v(e)},className:`opacity-0 group-hover/fa:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10`,children:(0,d.jsx)(l.Trash2,{className:`h-3 w-3 text-destructive`})})]}),(0,d.jsx)(`div`,{className:`px-2 -mt-0.5 mb-0.5`,children:(0,d.jsx)(`span`,{className:`text-[8px] text-muted-foreground/30 font-mono`,children:e})}),(0,d.jsxs)(`div`,{ref:c,className:W(`relative p-2 min-h-[40px] gap-1.5 transition-all duration-150`,u?`bg-amber-500/10 ring-2 ring-inset ring-amber-500/40`:``),style:{display:`grid`,gridTemplateColumns:`repeat(12, minmax(0, 1fr))`,gridAutoRows:`min-content`},children:[C.length===0&&(0,d.jsx)(`p`,{className:`text-[10px] text-muted-foreground/60 text-center py-2 italic`,style:{gridColumn:`span 12`},children:`Arraste campos aqui`}),(0,d.jsx)(m.SortableContext,{items:C,strategy:m.rectSortingStrategy,children:C.map(t=>(0,d.jsx)(xm,{id:t,container:e},t))})]})]})},Cm=5,wm=({id:e,elementRef:t,tamanho:n,inicioColuna:r,onPositionApply:i,setPositionDrag:a,setSelected:o,reorderStrategy:s})=>{let l=(0,c.useRef)({inicioColuna:r,tamanho:n});l.current={inicioColuna:r,tamanho:n};let u=(0,c.useRef)(null);return(0,c.useEffect)(()=>()=>{u.current?.()},[]),{handleGripMouseDown:(0,c.useCallback)(n=>{n.preventDefault(),n.stopPropagation(),o(e);let r=n.clientX,c=n.clientY,d=!1,f=()=>{u.current=null,window.removeEventListener(`mousemove`,p),window.removeEventListener(`mouseup`,m)},p=e=>{let t=Math.abs(e.clientX-r),n=Math.abs(e.clientY-c);t<Cm&&n<Cm||(d=!0,f(),t>=n?h(e):g(e))},m=()=>{d||f()};window.addEventListener(`mousemove`,p),window.addEventListener(`mouseup`,m),u.current=f;let h=n=>{let r=t.current;if(!r)return;let o=r.parentElement;if(!o)return;let s=o.getBoundingClientRect(),c=s.width/12,{tamanho:d}=l.current,f=r.getBoundingClientRect(),p=f.left-s.left,m=Math.max(1,Math.min(12,Math.round(p/c)+1)),h=f.left;a({itemId:e,ghostStart:m,ghostSpan:d,cursorX:n.clientX,cursorY:n.clientY});let g=e=>{let t=e-h,n=Math.round(t/c)+1;return Math.max(1,Math.min(13-d,n))};a({itemId:e,ghostStart:g(n.clientX),ghostSpan:d,cursorX:n.clientX,cursorY:n.clientY});let _=t=>{a({itemId:e,ghostStart:g(t.clientX),ghostSpan:d,cursorX:t.clientX,cursorY:t.clientY})},v=e=>{i(g(e.clientX)),a(null),u.current=null,window.removeEventListener(`mousemove`,_),window.removeEventListener(`mouseup`,v)};window.addEventListener(`mousemove`,_),window.addEventListener(`mouseup`,v),u.current=()=>{a(null),window.removeEventListener(`mousemove`,_),window.removeEventListener(`mouseup`,v)}},g=n=>{let r=s,i=t.current;if(!i)return;let a=i.parentElement;if(!a)return;let o=r.dataAttribute||`data-container-id`;r.pushSnapshot(),r.setReorderDrag({draggingId:e});let c=n.clientY,l=t=>{let n=Array.from(a.children).filter(e=>e!==i&&e.getAttribute(o));for(let i of n){let n=i.getBoundingClientRect(),a=n.top+n.height/2;if(t.clientY<a&&t.clientY>n.top&&t.clientY<c){r.moveItemNoSnapshot(e,`up`),c=t.clientY;break}else if(t.clientY>a&&t.clientY<n.bottom&&t.clientY>c){r.moveItemNoSnapshot(e,`down`),c=t.clientY;break}}},d=()=>{r.setReorderDrag(null),u.current=null,window.removeEventListener(`mousemove`,l),window.removeEventListener(`mouseup`,d)};window.addEventListener(`mousemove`,l),window.addEventListener(`mouseup`,d),u.current=()=>{r.setReorderDrag(null),window.removeEventListener(`mousemove`,l),window.removeEventListener(`mouseup`,d)}}},[e,t,i,a,o,s])}},Tm=({showGuides:e,positionDrag:t})=>!e&&!t?null:(0,d.jsxs)(d.Fragment,{children:[e&&(0,d.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},(e,t)=>(0,d.jsx)(`div`,{className:`border border-dashed border-muted-foreground/20 rounded-sm flex items-end justify-center pb-1`,children:(0,d.jsx)(`span`,{className:`text-[8px] text-muted-foreground/40 font-mono`,children:t+1})},t))}),t&&(0,d.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:(0,d.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]})})]}),Em=({id:e,container:t})=>{let{setNodeRef:n,isOver:r}=(0,g.useDroppable)({id:`zone-${e}`}),{selectedId:i,setSelected:a,getConfig:o,updateConfig:s,removeItem:u,moveItem:p,moveItemNoSnapshot:h,setPositionDrag:_,positionDrag:v,reorderDrag:y,setReorderDrag:x,pushSnapshot:S,containers:C}=j(),w=o(e),T=C[e]?.children??[],E=T.filter(e=>b(e)===`field`),D=i===e,O=w.tamanho||12,k=v?.itemId===e,A=y?.draggingId===e,M=v&&T.includes(v.itemId),N=i&&T.includes(i)&&b(i)===`field`,{resizeRef:P,resizing:ee,resizePreview:F,handleResizeStart:I}=ym({id:e,currentTamanho:O,inicioColuna:w.inicioColuna,onResize:t=>s(e,{tamanho:t})}),te=(0,c.useMemo)(()=>({kind:`custom`,moveItemNoSnapshot:h,pushSnapshot:S,setReorderDrag:x,dataAttribute:`data-container-id`}),[h,S,x]),{handleGripMouseDown:ne}=wm({id:e,elementRef:P,tamanho:O,inicioColuna:w.inicioColuna||1,onPositionApply:t=>s(e,{inicioColuna:t}),setPositionDrag:_,setSelected:a,reorderStrategy:te});return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`div`,{ref:e=>{P.current=e},onClick:t=>{t.stopPropagation(),a(e)},className:W(`group/cont relative rounded-lg border overflow-hidden transition-all`,ee&&`ring-2 ring-blue-400/50`,k&&`opacity-0 pointer-events-none`,A&&`opacity-50 ring-2 ring-primary/40`,D?`border-primary ring-2 ring-primary/20 shadow-lg`:`border-blue-500/30 hover:border-blue-500/50`),"data-container-id":e,style:{gridColumn:w.inicioColuna?`${w.inicioColuna} / span ${O}`:`span ${O}`,minWidth:`80px`},children:[(0,d.jsxs)(`div`,{className:W(`flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors`,D?`bg-primary/15 border-primary/30`:`bg-blue-500/10 border-blue-500/20`),children:[(0,d.jsx)(`div`,{"data-grip":!0,onMouseDown:ne,className:`cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-primary/20 active:cursor-grabbing transition-colors`,children:(0,d.jsx)(l.GripVertical,{className:`h-3.5 w-3.5 text-primary`})}),(0,d.jsxs)(`div`,{className:`flex flex-col -my-1 shrink-0`,children:[(0,d.jsx)(`button`,{onClick:t=>{t.stopPropagation(),p(e,`up`)},className:`p-0 hover:bg-primary/10 rounded transition-colors`,title:`Mover para cima`,children:(0,d.jsx)(l.ChevronUp,{className:`h-3 w-3 text-muted-foreground hover:text-primary`})}),(0,d.jsx)(`button`,{onClick:t=>{t.stopPropagation(),p(e,`down`)},className:`p-0 hover:bg-primary/10 rounded transition-colors`,title:`Mover para baixo`,children:(0,d.jsx)(l.ChevronDown,{className:`h-3 w-3 text-muted-foreground hover:text-primary`})})]}),(0,d.jsx)(l.BoxSelect,{className:`h-3.5 w-3.5 text-blue-500 shrink-0`}),(0,d.jsx)(`span`,{className:W(`text-xs font-semibold truncate flex-1`,w.showLabel===!1?`text-blue-400/50 dark:text-blue-500/40 italic`:`text-blue-700 dark:text-blue-300`),children:w.label}),w.showAsCard&&(0,d.jsx)(l.SquareStack,{className:`h-3 w-3 text-blue-400 shrink-0`}),w.showLabel===!1&&(0,d.jsx)(l.EyeOff,{className:`h-3 w-3 text-muted-foreground/50 shrink-0`}),(0,d.jsxs)(`span`,{className:`text-[10px] text-muted-foreground shrink-0 bg-blue-500/10 px-1.5 rounded`,children:[F??O,`/12`]}),(0,d.jsx)(`button`,{onClick:t=>{t.stopPropagation(),u(e)},className:`opacity-0 group-hover/cont:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10`,children:(0,d.jsx)(l.Trash2,{className:`h-3 w-3 text-destructive`})})]}),(0,d.jsx)(`div`,{className:`px-2 -mt-0.5 mb-0.5`,children:(0,d.jsx)(`span`,{className:`text-[8px] text-muted-foreground/30 font-mono`,children:e})}),(0,d.jsxs)(`div`,{ref:n,className:W(`relative p-2 min-h-[40px] gap-1.5 transition-all duration-150`,r?`bg-primary/15 ring-2 ring-inset ring-primary/50`:(M||N)&&`bg-muted/30`),style:{display:`grid`,gridTemplateColumns:`repeat(12, minmax(0, 1fr))`,gridAutoRows:`min-content`},children:[(0,d.jsx)(Tm,{showGuides:!!M||!!N,positionDrag:M?v:null}),T.length===0&&(0,d.jsx)(`p`,{className:`text-[10px] text-muted-foreground/60 text-center py-2 italic`,style:{gridColumn:`span 12`},children:`Arraste campos aqui`}),(0,d.jsx)(m.SortableContext,{items:E,strategy:m.rectSortingStrategy,children:T.filter(e=>b(e)===`field`).map(t=>o(t).fieldType===`field_array`?(0,d.jsx)(Sm,{id:t,container:e},t):(0,d.jsx)(xm,{id:t,container:e},t))})]}),(0,d.jsx)(`div`,{onMouseDown:I,className:`absolute right-0 top-0 bottom-0 w-2 cursor-col-resize hover:bg-blue-500/20 transition-colors flex items-center justify-center`,children:(0,d.jsx)(l.GripHorizontal,{className:`h-3 w-3 text-blue-500/40 rotate-90`})})]}),k&&v&&(0,f.createPortal)((0,d.jsxs)(`div`,{style:{position:`fixed`,left:v.cursorX+14,top:v.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:[(0,d.jsx)(l.BoxSelect,{className:`h-2.5 w-2.5`}),`col `,v.ghostStart,`–`,v.ghostStart+v.ghostSpan-1]}),document.body),` `]})},Dm=({id:e,container:t,index:n})=>{let{attributes:r,listeners:i,setNodeRef:a,transform:o,transition:s,isDragging:c}=(0,m.useSortable)({id:e,data:{isCanvasItem:!0,type:`step`,id:e}}),{setNodeRef:u,isOver:f}=(0,g.useDroppable)({id:`zone-${e}`}),{selectedId:p,setSelected:_,getConfig:v,removeItem:y,containers:x,positionDrag:S}=j(),C=v(e),w=x[e]?.children??[],T=p===e,E=S&&w.includes(S.itemId);return(0,d.jsxs)(`div`,{ref:a,style:{transform:h.CSS.Transform.toString(o),transition:s,opacity:c?0:1},onClick:t=>{t.stopPropagation(),_(e)},className:W(`group/step rounded-xl border-2 overflow-hidden transition-all`,T?`border-primary ring-2 ring-primary/20`:`border-primary/20 hover:border-primary/40`),children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2 bg-primary/10 border-b border-primary/20 px-3 py-2`,children:[(0,d.jsx)(`div`,{...i,...r,className:`cursor-grab shrink-0`,onClick:e=>e.stopPropagation(),children:(0,d.jsx)(l.GripVertical,{className:`h-3.5 w-3.5 text-muted-foreground`})}),(0,d.jsx)(l.Layers,{className:`h-4 w-4 text-primary`}),(0,d.jsxs)(`span`,{className:`text-sm font-bold text-primary truncate flex-1`,children:[`Step `,n+1,` — `,C.label]}),C.description&&(0,d.jsx)(`span`,{className:`text-[10px] text-muted-foreground truncate hidden md:block`,children:C.description}),(0,d.jsx)(`button`,{onClick:t=>{t.stopPropagation(),y(e)},className:`opacity-0 group-hover/step:opacity-100 transition-opacity shrink-0 p-1 rounded hover:bg-destructive/10`,children:(0,d.jsx)(l.Trash2,{className:`h-3.5 w-3.5 text-destructive`})})]}),(0,d.jsxs)(`div`,{ref:u,className:W(`relative p-3 min-h-[80px] gap-2 items-start transition-all duration-150`,f?`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:[(0,d.jsx)(Tm,{showGuides:!!E,positionDrag:E?S:null}),w.length===0&&(0,d.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(t=>b(t)===`container`?(0,d.jsx)(Em,{id:t,container:e},t):(0,d.jsx)(xm,{id:t,container:e},t))]})]})},Om=()=>{let{containers:e,setSelected:t}=j(),n=e.root?.children??[],r=n.filter(e=>b(e)===`step`),{setNodeRef:i,isOver:a}=(0,g.useDroppable)({id:`root`});return(0,d.jsxs)(`div`,{ref:i,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:[n.length===0&&(0,d.jsx)(`div`,{className:`flex items-center justify-center h-[400px]`,children:(0,d.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,d.jsx)(l.Layers,{className:`h-10 w-10 text-muted-foreground/30 mx-auto`}),(0,d.jsxs)(`p`,{className:`text-sm text-muted-foreground/50`,children:[`Arraste `,(0,d.jsx)(`strong`,{children:`Steps`}),` da paleta para cá`]})]})}),(0,d.jsx)(m.SortableContext,{items:r,strategy:m.verticalListSortingStrategy,children:n.map((e,t)=>{let n=b(e);return n===`step`?(0,d.jsx)(Dm,{id:e,container:`root`,index:t},e):n===`container`?(0,d.jsx)(Em,{id:e,container:`root`},e):(0,d.jsx)(xm,{id:e,container:`root`},e)})})]})},km={personal:`Pessoal`,address:`Endereço`,health:`Saúde`,event:`Evento`,payment:`Pagamento`,emergency:`Emergência`},Am={texto:`Texto`,selecao:`Seleção`,range:`Numérico / Visual`,data:`Data e Hora`,contato:`Contato / Endereço`,outros:`Arquivo / Outros`},jm=()=>{let e=_.reduce((e,t)=>{let n=t.group??`outros`;return e[n]||(e[n]=[]),e[n].push(t),e},{});return(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsx)(`h2`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Estrutura`}),v.map(e=>(0,d.jsx)(Nm,{component:e.component,label:e.label,icon:e.icon,color:e.color},e.component))]}),Object.entries(e).map(([e,t])=>(0,d.jsx)(Mm,{label:Am[e]??e,children:t.map(e=>(0,d.jsx)(Nm,{component:e.component,label:e.label,icon:e.icon,color:`border-border`},e.component))},e)),(0,d.jsx)(Mm,{label:`Blocos pré-configurados`,defaultOpen:!1,children:p.PRESET_BLOCKS.map(e=>(0,d.jsx)(Pm,{block:e},e.id))}),(0,d.jsx)(Mm,{label:`Blocos de steps`,defaultOpen:!1,children:p.PRESET_STEP_BLOCKS.map(e=>(0,d.jsx)(Fm,{block:e},e.id))})]})},Mm=({label:e,children:t,defaultOpen:n=!0})=>{let[r,i]=(0,c.useState)(n);return(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),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,(0,d.jsx)(l.ChevronDown,{className:`h-3.5 w-3.5 transition-transform ${r?``:`-rotate-90`}`})]}),r&&(0,d.jsx)(`div`,{className:`space-y-1.5`,children:t})]})},Nm=({component:e,label:t,icon:n,color:r})=>{let{attributes:i,listeners:a,setNodeRef:o,transform:s,isDragging:c}=(0,g.useDraggable)({id:`palette-${e}`,data:{isPaletteItem:!0,componentType:e}});return(0,d.jsxs)(`div`,{ref:o,...a,...i,className:`flex items-center gap-2 rounded-lg border px-3 py-2 cursor-grab select-none hover:bg-accent transition-colors ${r} ${c?`opacity-50`:``}`,style:{transform:c?void 0:h.CSS.Translate.toString(s)},children:[(0,d.jsx)(l.GripVertical,{className:`h-4 w-4 text-muted-foreground`}),(0,d.jsx)(n,{className:`h-4 w-4`}),(0,d.jsx)(`span`,{className:`text-sm font-medium`,children:t})]})},Pm=({block:e})=>{let{attributes:t,listeners:n,setNodeRef:r,transform:i,isDragging:a}=(0,g.useDraggable)({id:`preset-${e.id}`,data:{isPalettePreset:!0,presetId:e.id}}),o=e.icon?l[e.icon]:void 0,s=km[e.category]??e.category;return(0,d.jsxs)(`div`,{ref:r,...n,...t,className:`flex items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-3 py-2 cursor-grab select-none hover:bg-primary/10 transition-colors ${a?`opacity-50`:``}`,style:{transform:a?void 0:h.CSS.Translate.toString(i)},title:e.description,children:[(0,d.jsx)(l.GripVertical,{className:`h-4 w-4 text-muted-foreground shrink-0`}),o?(0,d.jsx)(o,{className:`h-4 w-4 text-primary shrink-0`}):(0,d.jsx)(l.Blocks,{className:`h-4 w-4 text-primary shrink-0`}),(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsx)(`span`,{className:`text-sm font-medium block truncate`,children:e.name}),(0,d.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:s})]})]})},Fm=({block:e})=>{let{addPresetStepBlock:t}=j(),n=e.icon?l[e.icon]:void 0;return(0,d.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:[n?(0,d.jsx)(n,{className:`h-4 w-4 text-amber-400 shrink-0`}):(0,d.jsx)(l.Layers,{className:`h-4 w-4 text-amber-400 shrink-0`}),(0,d.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,d.jsx)(`span`,{className:`text-sm font-medium block truncate`,children:e.name}),(0,d.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[e.steps.length,` steps`]})]}),(0,d.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`]})]})},Im=e=>({when:e.campoId,operator:e.operador,value:e.valor,source:e.source}),Lm=e=>{let t={campoId:e.when,operador:e.operator,valor:e.value,source:e.source};if(e.logicOperator&&e.extraConditions?.length){let n=[t,...e.extraConditions.map(e=>({campoId:e.when,operador:e.operator,valor:e.value,source:e.source}))];return e.logicOperator===`or`?{or:n}:{and:n}}return t},Rm=e=>{if(`campoId`in e)return Im(e);let t=(`and`in e?e.and:e.or)??[];if(t.length===0)return;let n=`and`in e?`and`:`or`,[r,...i]=t;if(!(`campoId`in r))return;let a=Im(r);return i.length===0?a:{...a,logicOperator:n,extraConditions:i.filter(e=>`campoId`in e).map(Im)}},zm=(e,t,n)=>{let r=e=>t[e]||{label:e,name:e},i=(e?.containers?.root?.children||[]).filter(e=>b(e)===`step`).map((t,n)=>{let i=r(t),a=(e?.containers?.[t]?.children||[]).filter(e=>b(e)===`container`).map((t,n)=>{let i=r(t),a=(e?.containers?.[t]?.children||[]).filter(e=>b(e)===`field`).map((t,n)=>{let i=Bm(r(t),t,n);return i.tipo===u.FieldType.FIELD_ARRAY&&(i.subFields=(e?.containers?.[t]?.children??[]).filter(e=>b(e)===`field`).map((e,t)=>Bm(r(e),e,t))),i}),o={id:t,titulo:i.label||`Container`,descricao:i.description,icone:i.icone,ordem:n,colunas:i.columns||2,tamanho:i.tamanho||12,inicioColuna:i.inicioColuna,showLabel:i.showLabel,showAsCard:i.showAsCard,campos:a};return i.condition&&(o.condicional=Lm(i.condition)),o});return{id:t,titulo:i.label||`Step`,descricao:i.description,icone:i.icone,ordem:n,showLabel:i.showLabel,containers:a}});return{id:n.id||``,nome:n.nome,descricao:n.descricao,status:n.status,template:n.template??null,steps:i}},Bm=(e,t,n)=>{let r={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:n,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?void 0:e.clearedValue,initialValue:e.initialValue===void 0?void 0:e.initialValue,resolvePropsKey:e.resolvePropsKey||void 0};if(e.validate?.length&&(r.validate=e.validate),e.warn?.length&&(r.warn=e.warn),e.options?.length&&(r.opcoes=e.options.map(e=>({valor:e.value,label:e.label,disabled:e.disabled}))),e.validation){let t=e.validation;r.validacao={},t.minLength!==void 0&&(r.validacao.minLength=t.minLength),t.maxLength!==void 0&&(r.validacao.maxLength=t.maxLength),t.min!==void 0&&(r.validacao.min=t.min),t.max!==void 0&&(r.validacao.max=t.max),t.regex&&(r.validacao.regex=t.regex),t.regexMessage&&(r.validacao.regexMessage=t.regexMessage),t.minDate&&(r.validacao.minDate=t.minDate),t.maxDate&&(r.validacao.maxDate=t.maxDate),t.minAge!==void 0&&(r.validacao.minAge=t.minAge),t.maxAge!==void 0&&(r.validacao.maxAge=t.maxAge),t.fileTypes?.length&&(r.validacao.fileTypes=t.fileTypes),t.maxFileSize!==void 0&&(r.validacao.maxFileSize=t.maxFileSize)}if(r.tipo===u.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)),r.tipo===u.FieldType.TERMS&&(e.termoTexto&&(r.termoTexto=e.termoTexto),e.termoPdfUrl&&(r.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(r.termoPdfUploadId=e.termoPdfUploadId)),r.tipo===u.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)),r.tipo===u.FieldType.RATING&&e.maxRating!==void 0&&(r.maxRating=e.maxRating),r.tipo===u.FieldType.DATE_RANGE&&(e.dateRangeStartLabel&&(r.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(r.dateRangeEndLabel=e.dateRangeEndLabel)),r.tipo===u.FieldType.SUB_FORM){let t=e.subSchemaFields??[];(t.length>0||e.subSchemaTitle)&&(r.subSchema={titulo:e.subSchemaTitle,fields:t.map((e,t)=>Bm(e,e.name??`subfield-${t}`,t))})}return e.condition&&(r.condicional=Lm(e.condition)),r},Vm=e=>{let t={},n={root:{children:[]}},r=[...e.steps].sort((e,t)=>e.ordem-t.ordem);for(let e of r){let r=e.id||`step-${(0,u.v4Fallback)()}`;n.root.children.push(r),t[r]={label:e.titulo,name:r,fieldType:`step`,description:e.descricao,icone:e.icone,showLabel:e.showLabel};let i=[],a=[...e.containers].sort((e,t)=>e.ordem-t.ordem);for(let e of a){let r=e.id||`container-${(0,u.v4Fallback)()}`;i.push(r);let a=e.condicional?Rm(e.condicional):void 0;t[r]={label:e.titulo,name:r,fieldType:`container`,description:e.descricao,icone:e.icone,columns:e.colunas,tamanho:e.tamanho||12,inicioColuna:e.inicioColuna,showLabel:e.showLabel,showAsCard:e.showAsCard,...a?{condition:a}:{}};let o=[],s=[...e.campos].sort((e,t)=>e.ordem-t.ordem);for(let e of s){let r=e.id||`${e.tipo}-${(0,u.v4Fallback)()}`;if(o.push(r),t[r]=Hm(e,r),e.tipo===u.FieldType.FIELD_ARRAY){let i=[];for(let n of e.subFields??[]){let e=n.id||`${n.tipo}-${(0,u.v4Fallback)()}`;i.push(e),t[e]=Hm(n,e)}n[r]={children:i}}}n[r]={children:o}}n[r]={children:i}}return{dndState:{containers:n},configs:t,templateId:e.template??null}},Hm=(e,t)=>{let n={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?void 0:String(e.clearedValue),initialValue:e.initialValue===void 0?void 0:String(e.initialValue),resolvePropsKey:e.resolvePropsKey||void 0,validate:e.validate?.length?e.validate:void 0,warn:e.warn?.length?e.warn:void 0};if(e.opcoes?.length&&(n.options=e.opcoes.map(e=>({value:e.valor,label:e.label,disabled:e.disabled}))),e.validacao){let t=e.validacao;n.validation={},t.minLength!==void 0&&(n.validation.minLength=t.minLength),t.maxLength!==void 0&&(n.validation.maxLength=t.maxLength),t.min!==void 0&&(n.validation.min=t.min),t.max!==void 0&&(n.validation.max=t.max),t.regex&&(n.validation.regex=t.regex),t.regexMessage&&(n.validation.regexMessage=t.regexMessage),t.minDate&&(n.validation.minDate=t.minDate),t.maxDate&&(n.validation.maxDate=t.maxDate),t.minAge!==void 0&&(n.validation.minAge=t.minAge),t.maxAge!==void 0&&(n.validation.maxAge=t.maxAge),t.fileTypes?.length&&(n.validation.fileTypes=t.fileTypes),t.maxFileSize!==void 0&&(n.validation.maxFileSize=t.maxFileSize)}if(e.tipo===u.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)),e.tipo===u.FieldType.TERMS&&(e.termoTexto&&(n.termoTexto=e.termoTexto),e.termoPdfUrl&&(n.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(n.termoPdfUploadId=e.termoPdfUploadId)),e.tipo===u.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)),e.tipo===u.FieldType.RATING&&e.maxRating!==void 0&&(n.maxRating=e.maxRating),e.tipo===u.FieldType.DATE_RANGE&&(e.dateRangeStartLabel&&(n.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(n.dateRangeEndLabel=e.dateRangeEndLabel)),e.tipo===u.FieldType.SUB_FORM&&e.subSchema&&(n.subSchemaTitle=e.subSchema.titulo,n.subSchemaFields=e.subSchema.fields.map(e=>Hm(e,e.id))),e.condicional){let t=Rm(e.condicional);t&&(n.condition=t)}return n},Um=(e,t)=>{let n=[],r=[],i=e=>t[e]||{label:e,name:e},a=e?.containers?.root?.children||[],o=new Set;for(let t of a){if(b(t)!==`step`)continue;let a=i(t).label||t,s=e?.containers?.[t]?.children||[];if(s.length===0){r.push(`Step "${a}" está vazio (sem containers).`);continue}for(let t of s){if(b(t)!==`container`)continue;let r=i(t).label||t,a=e?.containers?.[t]?.children||[],s=new Map;for(let e of a){if(b(e)!==`field`)continue;o.add(e);let t=i(e).name||e;s.has(t)||s.set(t,[]),s.get(t).push(e)}for(let[e,t]of s.entries())t.length>1&&n.push(`Nome duplicado "${e}" no container "${r}" (IDs: ${t.join(`, `)}).`)}}for(let[e,n]of Object.entries(t)){if(!n.condition?.when)continue;let t=n.condition.when;if(!o.has(t)){let i=n.label||e;r.push(`Campo "${i}" referencia campo inexistente na condição (when: "${t}").`)}}return{errors:n,warnings:r}};exports.BuilderProvider=A,exports.Canvas=Om,exports.ConfigPanel=Yp,exports.DroppedContainer=Em,exports.DroppedField=xm,exports.DroppedStep=Dm,exports.EVENT_VARIABLES=y,exports.FIELD_TYPES=_,exports.GridOverlay=Tm,exports.LivePreview=vm,exports.Palette=jm,exports.STRUCTURE_TYPES=v,exports.builderToFormSchema=zm,exports.findParentContainer=k,exports.formSchemaToBuilder=Vm,exports.getFieldMeta=x,exports.getFieldMetaById=S,exports.getItemType=b,exports.useBuilder=j,exports.validateBuilderIntegrity=Um;
51
- //# sourceMappingURL=index.cjs.map
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:W("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=te(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(J.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:Y(e.onPointerMove,f=>{f.pointerType!=="touch"&&!m.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),m.current=!0)}),onPointerLeave:Y(e.onPointerLeave,()=>{s.onTriggerLeave(),m.current=!1}),onPointerDown:Y(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Y(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:Y(e.onBlur,s.onClose),onClick:Y(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=te(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:W("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:W(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(X,{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(T.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(T.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(T.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(X,{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(T.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(T.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(X,{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(T.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(T.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(T.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(X,{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(X,{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(T.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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(T.GripVertical,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}),o.jsx(X,{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(X,{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(T.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(T.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(X,{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(T.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(T.Trash2,{className:"w-3 h-3"})}),r===c?o.jsx(T.ChevronUp,{className:"w-3 h-3 text-muted-foreground shrink-0"}):o.jsx(T.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(X,{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(X,{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(X,{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(X,{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 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(T.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(T.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(T.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(X,{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(X,{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(X,{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(X,{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(T.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(T.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(T.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(T.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(T.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 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(T.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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(X,{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(T.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:W("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(T.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(T.FlaskConical,{className:"w-3.5 h-3.5 mr-1"}),"Preencher mock"]}),o.jsxs(le,{variant:"ghost",size:"sm",onClick:t,children:[o.jsx(T.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)},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((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:()=>N(S),children:o.jsx(T.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]??"",O=F=>C(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=>O(F.target.value)}):y==="select"?o.jsxs(Ce,{value:I,onValueChange:O,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,z)=>o.jsx(pe,{value:F.value||`__opt_${z}`,children:F.label},`${z}-${F.value}`))})]}):y==="checkbox"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(xe,{checked:I==="true",onCheckedChange:F=>O(F?"true":"")}),o.jsx("span",{className:"text-sm text-muted-foreground",children:P.config.placeholder||P.config.label})]}):o.jsx(X,{type:Ol(y),placeholder:P.config.placeholder,className:D?"text-sm border-destructive":"text-sm",value:I,onChange:F=>O(F.target.value)}),D&&o.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[o.jsx(T.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(T.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(T.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(T.Zap,{className:"h-2.5 w-2.5 mr-0.5"}),"cond"]})]}),d==="textarea"?o.jsx(Mr,{placeholder:e.placeholder,className:W("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:W("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 A={};try{A=r?JSON.parse(r):{}}catch{}const I=A.tipo??null,O=A.data??null,D=A.genero??null,F=R=>n(JSON.stringify({tipo:R,data:null,...w?{genero:D}:{}})),z=R=>n(JSON.stringify({tipo:"por_dia",data:R,...w?{genero:D}:{}})),V=R=>n(JSON.stringify({tipo:I,data:O,genero:R})),k=[];if(y&&N&&C){const R=new Date(N.slice(0,10)+"T00:00:00Z"),$=new Date(C.slice(0,10)+"T00:00:00Z");let L=0;for(;R<=$&&L++<60;)k.push(R.toISOString().slice(0,10)),R.setUTCDate(R.getUTCDate()+1)}const E=R=>{const[$,L,q]=R.split("-").map(Number),ne=new Date(Date.UTC($,L-1,q)),ae=String(q).padStart(2,"0"),ie=String(L).padStart(2,"0"),oe=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(ne);return`${ae}/${ie} — ${oe.charAt(0).toUpperCase()}${oe.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 $=R==="masculino"?"Masculino":"Feminino";return o.jsx("button",{type:"button",onClick:()=>V(R),className:W("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:$},R)})})]}),o.jsxs("button",{type:"button",onClick:()=>F("todos_os_dias"),className:W("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:W("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(T.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:W("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(T.Users,{className:"w-3 h-3"}),g," vagas"]})]})]}),y?o.jsxs("button",{type:"button",onClick:()=>F("por_dia"),className:W("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:W("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(T.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:W("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(T.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(T.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(T.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"&&k.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:"}),k.map(R=>o.jsxs("button",{type:"button",onClick:()=>z(R),className:W("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",O===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:W("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center",O===R?"border-primary bg-primary":"border-muted-foreground"),children:O===R&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-primary-foreground"})}),o.jsx("span",{className:"text-sm",children:E(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[A,I,O]=h.data.split("-");return`${O}/${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(N*(1+A.taxa)*100)/100,O={metodo:A.id,valorTotal:I};A.parcelas>1&&(O.parcelas=A.parcelas),n(JSON.stringify(O))};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(T.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,O=Math.round(N*(1+A.taxa)*100)/100,D=A.parcelas>1,F=D?Math.round(O/A.parcelas*100)/100:null;return o.jsxs("button",{type:"button",onClick:()=>y(A),className:W("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:W("flex items-center justify-center w-10 h-10 rounded-lg shrink-0",I?"bg-primary/20":"bg-muted"),children:o.jsx(T.Wallet,{className:W("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(O)]})]}),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(O)})})]},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:W("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(T.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(T.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(T.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]})})():d==="file"?o.jsx(X,{type:"file",className:W("text-sm",p)}):d==="hidden"?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Campo oculto"}):o.jsx(X,{type:Ol(d),placeholder:e.placeholder,className:W("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(T.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:W("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(T.ChevronLeft,{className:"w-4 h-4 mr-1"}),"Voltar"]}),o.jsx(le,{onClick:n,children:t?o.jsxs(o.Fragment,{children:[o.jsx(T.Check,{className:"w-4 h-4 mr-1"}),"Finalizar"]}):o.jsxs(o.Fragment,{children:[o.jsx(T.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(T.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(T.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:W("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(T.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)??T.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:W("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(T.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)??T.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:W("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(T.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)??T.CircleDot,c=i===t,d=i<t,m=i===e.length-1;return o.jsxs("div",{className:W("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:W("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(T.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)??T.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:W("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:W("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((O,D)=>{var F;if(i(z=>({...z,[O]:D})),x){const z=(F=s[h])==null?void 0:F.containers.flatMap(V=>V.fields).find(V=>V.id===O);if(z){const V=ts(D,z.config,{...a,[O]:D},e);f(k=>{const E={...k};return V?E[O]=V:delete E[O],E})}}},[x,s,h,a,e,i,f]),b=_.useCallback(()=>{const O=s[h];if(!O)return!0;const D={};for(const z of O.containers)for(const V of z.fields){if(V.config.fieldType==="field_array"){let E=!1;try{const R=a[V.id],$=R?JSON.parse(R):[],L=V.config.minItems??1;if($.length<L)D[V.id]=`Mínimo de ${L} item${L!==1?"s":""} obrigatório${L!==1?"s":""}`,E=!0;else{for(const q of $){for(const ne of V.subFields??[]){const ae=q[ne.id]??"";if(ne.config.required&&!ae.trim()){E=!0;break}}if(E)break}E&&(D[V.id]="Preencha todos os campos obrigatórios")}}catch{V.config.required&&(D[V.id]="Campo obrigatório")}continue}const k=ts(a[V.id]||"",V.config,a,e);k&&(D[V.id]=k)}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(O=>O+1))},[b,h,s.length,g,f,m,c]),N=_.useCallback(()=>{c(O=>O-1),g(!1),f({})},[c,g,f]),C=_.useCallback(()=>{const O={};for(const D of s)for(const F of D.containers)for(const z of F.fields)Br(z.config.condition,a,e)&&(O[z.id]=Ll(z.config,z.subFields));i(D=>({...D,...O}))},[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: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(O=>({id:O.id,label:O.config.label,icone:O.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: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)||T.Type,w=c===e,N=h.tamanho||6,C=(g==null?void 0:g.itemId)===e,{resizeRef:j,resizing:S,resizePreview:P,handleResizeStart:y}=_l({id:e,currentTamanho:N,inicioColuna:h.inicioColuna,onResize:I=>p(e,{tamanho:I})}),{handlePositionMouseDown:A}=vh({id:e,elementRef:j,onPositionApply:I=>p(e,{inicioColuna:I}),setPositionDrag:x,setSelected:d});return o.jsxs("div",{ref:I=>{s(I),j.current=I},onClick:I=>{I.stopPropagation(),d(e)},"data-field-id":e,className:W("group relative flex items-center gap-2 rounded border bg-card/80 backdrop-blur-sm px-2.5 py-1.5 pb-3 cursor-pointer transition-all text-xs",S&&"ring-2 ring-blue-400/50",C&&"opacity-0 pointer-events-none",w?"border-primary ring-2 ring-primary/30 shadow-md":"border-border/60 hover:border-muted-foreground/50 shadow-sm"),style:{gridColumn:h.inicioColuna?`${h.inicioColuna} / span ${N}`:`span ${N}`,transform:Mt.CSS.Transform.toString(a),transition:i,opacity:l?0:1},children:[o.jsx("div",{onMouseDown:A,onClick:I=>I.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(T.ArrowLeftRight,{className:"h-3 w-3 text-primary/60"})}),o.jsx("div",{...n,...r,className:"cursor-grab shrink-0",onClick:I=>I.stopPropagation(),children:o.jsx(T.GripVertical,{className:"h-3 w-3 text-muted-foreground"})}),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(T.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:[P??N,"/12"]}),o.jsx("button",{onClick:I=>{I.stopPropagation(),f(e)},className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",children:o.jsx(T.Trash2,{className:"h-3 w-3 text-destructive"})}),o.jsx("div",{className:"absolute -bottom-0.5 left-2 text-[8px] text-muted-foreground/30 font-mono truncate max-w-[90%] pointer-events-none",children:e}),o.jsx("div",{"data-resize":!0,onMouseDown:y,className:"absolute right-0 top-0 bottom-0 w-2 cursor-col-resize hover:bg-primary/20 transition-colors flex items-center justify-center",children:o.jsx(T.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:W("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/50"),style:{gridColumn:v.inicioColuna?`${v.inicioColuna} / span ${C}`:`span ${C}`,transform:Mt.CSS.Transform.toString(a),transition:i},children:[o.jsxs("div",{className:W("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 active:cursor-grabbing transition-colors",onClick:S=>S.stopPropagation(),children:o.jsx(T.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(T.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(T.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})})]}),o.jsx(T.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(T.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:W("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(),A=P.width/12,{tamanho:I}=c.current,O=j.getBoundingClientRect(),D=O.left-P.left,F=Math.max(1,Math.min(12,Math.round(D/A)+1)),z=O.left;a({itemId:e,ghostStart:F,ghostSpan:I,cursorX:C.clientX,cursorY:C.clientY});const V=R=>{const $=R-z,L=Math.round($/A)+1;return Math.max(1,Math.min(13-I,L))};a({itemId:e,ghostStart:V(C.clientX),ghostSpan:I,cursorX:C.clientX,cursorY:C.clientY});const k=R=>{a({itemId:e,ghostStart:V(R.clientX),ghostSpan:I,cursorX:R.clientX,cursorY:R.clientY})},E=R=>{s(V(R.clientX)),a(null),d.current=null,window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",E)};window.addEventListener("mousemove",k),window.addEventListener("mouseup",E),d.current=()=>{a(null),window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",E)}},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 A=C.clientY;const I=D=>{const F=Array.from(P.children).filter(z=>z!==S&&z.getAttribute(y));for(const z of F){const V=z.getBoundingClientRect(),k=V.top+V.height/2;if(D.clientY<k&&D.clientY>V.top&&D.clientY<A){j.moveItemNoSnapshot(e,"up"),A=D.clientY;break}else if(D.clientY>k&&D.clientY<V.bottom&&D.clientY>A){j.moveItemNoSnapshot(e,"down"),A=D.clientY;break}}},O=()=>{j.setReorderDrag(null),d.current=null,window.removeEventListener("mousemove",I),window.removeEventListener("mouseup",O)};window.addEventListener("mousemove",I),window.addEventListener("mouseup",O),d.current=()=>{j.setReorderDrag(null),window.removeEventListener("mousemove",I),window.removeEventListener("mouseup",O)}}},[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 k;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=((k=v[e])==null?void 0:k.children)??[],N=w.filter(E=>me(E)==="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),A=s&&w.includes(s)&&me(s)==="field",{resizeRef:I,resizing:O,resizePreview:D,handleResizeStart:F}=_l({id:e,currentTamanho:j,inicioColuna:b.inicioColuna,onResize:E=>l(e,{tamanho:E})}),z=_.useMemo(()=>({kind:"custom",moveItemNoSnapshot:m,pushSnapshot:h,setReorderDrag:g,dataAttribute:"data-container-id"}),[m,h,g]),{handleGripMouseDown:V}=yh({id:e,elementRef:I,tamanho:j,inicioColuna:b.inicioColuna||1,onPositionApply:E=>l(e,{inicioColuna:E}),setPositionDrag:p,setSelected:a,reorderStrategy:z});return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:E=>{I.current=E},onClick:E=>{E.stopPropagation(),a(e)},className:W("group/cont relative rounded-lg border overflow-hidden transition-all",O&&"ring-2 ring-blue-400/50",S&&"opacity-0 pointer-events-none",P&&"opacity-50 ring-2 ring-primary/40",C?"border-primary ring-2 ring-primary/20 shadow-lg":"border-blue-500/30 hover:border-blue-500/50"),"data-container-id":e,style:{gridColumn:b.inicioColuna?`${b.inicioColuna} / span ${j}`:`span ${j}`,minWidth:"80px"},children:[o.jsxs("div",{className:W("flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",C?"bg-primary/15 border-primary/30":"bg-blue-500/10 border-blue-500/20"),children:[o.jsx("div",{"data-grip":!0,onMouseDown:V,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-primary/20 active:cursor-grabbing transition-colors",children:o.jsx(T.GripVertical,{className:"h-3.5 w-3.5 text-primary"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:E=>{E.stopPropagation(),d(e,"up")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(T.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})}),o.jsx("button",{onClick:E=>{E.stopPropagation(),d(e,"down")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(T.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})})]}),o.jsx(T.BoxSelect,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"}),o.jsx("span",{className:W("text-xs font-semibold truncate flex-1",b.showLabel===!1?"text-blue-400/50 dark:text-blue-500/40 italic":"text-blue-700 dark:text-blue-300"),children:b.label}),b.showAsCard&&o.jsx(T.SquareStack,{className:"h-3 w-3 text-blue-400 shrink-0"}),b.showLabel===!1&&o.jsx(T.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:[D??j,"/12"]}),o.jsx("button",{onClick:E=>{E.stopPropagation(),c(e)},className:"opacity-0 group-hover/cont:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",children:o.jsx(T.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:W("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:N,strategy:Fe.rectSortingStrategy,children:w.filter(E=>me(E)==="field").map(E=>i(E).fieldType==="field_array"?o.jsx(bh,{id:E,container:e},E):o.jsx(Bt,{id:E,container:e},E))})]}),o.jsx("div",{onMouseDown:F,className:"absolute right-0 top-0 bottom-0 w-2 cursor-col-resize hover:bg-blue-500/20 transition-colors flex items-center justify-center",children:o.jsx(T.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(T.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 S;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=((S=h[e])==null?void 0:S.children)??[],N=p===e,C=v&&w.includes(v.itemId),j={transform:Mt.CSS.Transform.toString(i),transition:l,opacity:c?0:1};return o.jsxs("div",{ref:a,style:j,onClick:P=>{P.stopPropagation(),f(e)},className:W("group/step rounded-xl border-2 overflow-hidden transition-all",N?"border-primary ring-2 ring-primary/20":"border-primary/20 hover:border-primary/40"),children:[o.jsxs("div",{className:"flex items-center gap-2 bg-primary/10 border-b border-primary/20 px-3 py-2",children:[o.jsx("div",{...s,...n,className:"cursor-grab shrink-0",onClick:P=>P.stopPropagation(),children:o.jsx(T.GripVertical,{className:"h-3.5 w-3.5 text-muted-foreground"})}),o.jsx(T.Layers,{className:"h-4 w-4 text-primary"}),o.jsxs("span",{className:"text-sm font-bold text-primary truncate flex-1",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:P=>{P.stopPropagation(),g(e)},className:"opacity-0 group-hover/step:opacity-100 transition-opacity shrink-0 p-1 rounded hover:bg-destructive/10",children:o.jsx(T.Trash2,{className:"h-3.5 w-3.5 text-destructive"})})]}),o.jsxs("div",{ref:d,className:W("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(P=>me(P)==="container"?o.jsx(mn,{id:P,container:e},P):o.jsx(Bt,{id:P,container:e},P))]})]})},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(T.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(T.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:`flex items-center gap-2 rounded-lg border px-3 py-2 cursor-grab select-none hover:bg-accent transition-colors ${n} ${c?"opacity-50":""}`,style:{transform:c?void 0:Mt.CSS.Translate.toString(l)},children:[o.jsx(T.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:`flex items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-3 py-2 cursor-grab 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(T.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 O,D;const A=n(P),I=Co(A,P,y);if(I.tipo===de.FieldType.FIELD_ARRAY){const F=((D=(O=e==null?void 0:e.containers)==null?void 0:O[P])==null?void 0:D.children)??[];I.subFields=F.filter(z=>me(z)==="field").map((z,V)=>Co(n(z),z,V))}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;
51
+ //# sourceMappingURL=index.cjs.map