@sawabona/forms 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,9 @@
1
- (function(i,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("react/jsx-runtime"),require("react"),require("framer-motion"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","framer-motion","lucide-react"],t):(i=typeof globalThis!="undefined"?globalThis:i||self,t(i.SawabonaForms={},i.jsxRuntime,i.React,i.Motion,i.Lucide))})(this,(function(i,t,l,m,I){"use strict";var q=Object.defineProperty,R=Object.defineProperties;var ee=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var D=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var _=(i,t,l)=>t in i?q(i,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[t]=l,s=(i,t)=>{for(var l in t||(t={}))D.call(t,l)&&_(i,l,t[l]);if(B)for(var l of B(t))O.call(t,l)&&_(i,l,t[l]);return i},S=(i,t)=>R(i,ee(t));var K=i=>typeof i=="symbol"?i:i+"",Q=(i,t)=>{var l={};for(var m in i)D.call(i,m)&&t.indexOf(m)<0&&(l[m]=i[m]);if(i!=null&&B)for(var m of B(i))t.indexOf(m)<0&&O.call(i,m)&&(l[m]=i[m]);return l};function H({schema:e,onSubmit:a}){var p;const[o,r]=l.useState({answers:{},currentStepId:((p=e.questions[0])==null?void 0:p.id)||"",history:[],isSubmitting:!1,errors:{},isCompleted:!1}),d=l.useMemo(()=>e.questions.findIndex(n=>n.id===o.currentStepId),[e.questions,o.currentStepId]),u=e.questions[d],y=l.useCallback((n,f)=>{r(x=>S(s({},x),{answers:S(s({},x.answers),{[n]:f}),errors:S(s({},x.errors),{[n]:""})}))},[]),h=l.useCallback((n,f)=>{r(x=>{if(f===null){const $=x.errors,{[n]:z}=$,j=Q($,[K(n)]);return S(s({},x),{errors:j})}return S(s({},x),{errors:S(s({},x.errors),{[n]:f})})})},[]),g=l.useCallback(()=>{var x;if(!u)return!0;const n=o.answers[u.id],f=u.validation;return f&&f.required&&(n===void 0||n===""||Array.isArray(n)&&n.length===0)?(h(u.id,((x=e.i18n)==null?void 0:x.required)||"This field is required"),!1):!0},[u,o.answers,h,e.i18n]),v=l.useCallback(n=>{const f=e.questions.findIndex(x=>x.id===n.id);return f<e.questions.length-1?e.questions[f+1].id:"submit"},[e.questions]),N=l.useCallback(()=>{if(!g())return;const n=v(u);n==="submit"?(r(f=>S(s({},f),{isCompleted:!0})),a==null||a(o.answers)):r(f=>S(s({},f),{history:[...f.history,f.currentStepId],currentStepId:n}))},[u,o.answers,g,v,a]),c=l.useCallback(()=>{if(o.history.length===0)return;const n=o.history[o.history.length-1];r(f=>S(s({},f),{history:f.history.slice(0,-1),currentStepId:n}))},[o.history]),C=l.useCallback(n=>{if(!e.questions.some(x=>x.id===n)){console.warn(`Step ${n} does not exist`);return}r(x=>S(s({},x),{history:[...x.history,x.currentStepId],currentStepId:n}))},[e.questions]),w=l.useCallback(()=>{var n;r({answers:{},currentStepId:((n=e.questions[0])==null?void 0:n.id)||"",history:[],isSubmitting:!1,errors:{},isCompleted:!1})},[e.questions]);return S(s({},o),{setAnswer:y,nextStep:N,prevStep:c,jumpToStep:C,submitForm:()=>a==null?void 0:a(o.answers),resetForm:w,registerError:h,progress:d/e.questions.length*100})}const P=l.createContext(void 0),A=()=>{const e=l.useContext(P);if(!e)throw new Error("useFormContext must be used within a FormProvider");return e};function U(e,a,o){if(!e)return"";const r=e.replace(/\D/g,"");if(a==="phone")return r.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2").slice(0,14);if(a==="cellphone")return r.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2").slice(0,15);if(a==="cpf")return r.replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})/,"$1-$2").replace(/(-\d{2})\d+?$/,"$1");if(a==="cnpj")return r.replace(/(\d{2})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1/$2").replace(/(\d{4})(\d)/,"$1-$2").replace(/(-\d{2})\d+?$/,"$1");if(a==="cep")return r.replace(/(\d{5})(\d)/,"$1-$2").slice(0,9);if(a==="custom"&&o){let d=0;return o.replace(/[#X0]/g,()=>r[d++]||"").replace(/[^0-9a-zA-Z]+$/,"")}return e}function V({question:e}){var p,n,f,x,$,z,j,W;const{answers:a,setAnswer:o,nextStep:r,schema:d}=A(),u=a[e.id],y=u!=null?String(u):"",h=l.useRef(null),g=d.questions[0].id===e.id,v=!d.disableAutoFocus||!g;l.useEffect(()=>{if(v){const k=setTimeout(()=>{var b;(b=h.current)==null||b.focus()},500);return()=>clearTimeout(k)}},[e.id,v]);const N=k=>{var L,T,F;let b=k.target.value;((L=e.validation)!=null&&L.maskType||(T=e.validation)!=null&&T.mask)&&(b=U(b,e.validation.maskType,e.validation.mask));const E=((F=e.validation)==null?void 0:F.maxLength)||2048;if(b.length>E&&(b=b.slice(0,E)),e.type==="number"){const M=b===""?"":parseFloat(b);o(e.id,M)}else o(e.id,b)},c=()=>{var k,b,E,L,T;if((k=e.validation)!=null&&k.required&&!y)return!1;if(y){if((b=e.validation)!=null&&b.minLength&&y.length<e.validation.minLength||e.type==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(y))return!1;if((E=e.validation)!=null&&E.pattern)try{if(!new RegExp(e.validation.pattern).test(y))return!1}catch(F){console.error("Invalid regex pattern in schema",F)}if(e.type==="number"){const F=parseFloat(y);if(!isNaN(F)&&(((L=e.validation)==null?void 0:L.min)!==void 0&&F<e.validation.min||((T=e.validation)==null?void 0:T.max)!==void 0&&F>e.validation.max))return!1}}return!0},C=k=>{if(k.key==="Enter"&&!k.shiftKey){if(k.preventDefault(),!c()){const b=document.querySelector(".sawabona-form-container")||document.body;b.classList.add("shake-animation"),setTimeout(()=>b.classList.remove("shake-animation"),500);return}r()}};return t.jsxs("div",{className:"w-full relative group",children:[t.jsx("input",{ref:h,type:e.type,value:typeof y=="string"||typeof y=="number"?y:"",onChange:N,onKeyDown:C,placeholder:e.placeholder,minLength:(p=e.validation)==null?void 0:p.minLength,maxLength:((n=e.validation)==null?void 0:n.maxLength)||2048,min:(f=e.validation)==null?void 0:f.min,max:(x=e.validation)==null?void 0:x.max,pattern:($=e.validation)==null?void 0:$.pattern,className:`
2
- w-full bg-transparent border-b-2 border-sw-text-secondary/20
1
+ (function(S,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("react/jsx-runtime"),require("react"),require("framer-motion"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","framer-motion","lucide-react"],n):(S=typeof globalThis!="undefined"?globalThis:S||self,n(S.SawabonaForms={},S.jsxRuntime,S.React,S.Motion,S.Lucide))})(this,(function(S,n,z,F,ee){"use strict";var Yt=Object.defineProperty,Jt=Object.defineProperties;var Zt=Object.getOwnPropertyDescriptors;var pe=Object.getOwnPropertySymbols;var Xe=Object.prototype.hasOwnProperty,Ye=Object.prototype.propertyIsEnumerable;var He=(S,n,z)=>n in S?Yt(S,n,{enumerable:!0,configurable:!0,writable:!0,value:z}):S[n]=z,w=(S,n)=>{for(var z in n||(n={}))Xe.call(n,z)&&He(S,z,n[z]);if(pe)for(var z of pe(n))Ye.call(n,z)&&He(S,z,n[z]);return S},O=(S,n)=>Jt(S,Zt(n));var Je=S=>typeof S=="symbol"?S:S+"",Ze=(S,n)=>{var z={};for(var F in S)Xe.call(S,F)&&n.indexOf(F)<0&&(z[F]=S[F]);if(S!=null&&pe)for(var F of pe(S))n.indexOf(F)<0&&Ye.call(S,F)&&(z[F]=S[F]);return z};function Re({schema:e,onSubmit:o}){var C;const[r,t]=z.useState({answers:{},currentStepId:((C=e.questions[0])==null?void 0:C.id)||"",history:[],isSubmitting:!1,errors:{},isCompleted:!1}),s=z.useMemo(()=>e.questions.findIndex(m=>m.id===r.currentStepId),[e.questions,r.currentStepId]),i=e.questions[s],a=z.useCallback((m,f)=>{t(y=>O(w({},y),{answers:O(w({},y.answers),{[m]:f}),errors:O(w({},y.errors),{[m]:""})}))},[]),u=z.useCallback((m,f)=>{t(y=>{if(f===null){const P=y.errors,{[m]:$}=P,I=Ze(P,[Je(m)]);return O(w({},y),{errors:I})}return O(w({},y),{errors:O(w({},y.errors),{[m]:f})})})},[]),d=z.useCallback(()=>{var y;if(!i)return!0;const m=r.answers[i.id],f=i.validation;return f&&f.required&&(m===void 0||m===""||Array.isArray(m)&&m.length===0)?(u(i.id,((y=e.i18n)==null?void 0:y.required)||"This field is required"),!1):!0},[i,r.answers,u,e.i18n]),g=z.useCallback(m=>{const f=e.questions.findIndex(y=>y.id===m.id);return f<e.questions.length-1?e.questions[f+1].id:"submit"},[e.questions]),v=z.useCallback(()=>{if(!d())return;const m=g(i);m==="submit"?(t(f=>O(w({},f),{isCompleted:!0})),o==null||o(r.answers)):t(f=>O(w({},f),{history:[...f.history,f.currentStepId],currentStepId:m}))},[i,r.answers,d,g,o]),x=z.useCallback(()=>{if(r.history.length===0)return;const m=r.history[r.history.length-1];t(f=>O(w({},f),{history:f.history.slice(0,-1),currentStepId:m}))},[r.history]),k=z.useCallback(m=>{if(!e.questions.some(y=>y.id===m)){console.warn(`Step ${m} does not exist`);return}t(y=>O(w({},y),{history:[...y.history,y.currentStepId],currentStepId:m}))},[e.questions]),A=z.useCallback(()=>{var m;t({answers:{},currentStepId:((m=e.questions[0])==null?void 0:m.id)||"",history:[],isSubmitting:!1,errors:{},isCompleted:!1})},[e.questions]);return O(w({},r),{setAnswer:a,nextStep:v,prevStep:x,jumpToStep:k,submitForm:()=>o==null?void 0:o(r.answers),resetForm:A,registerError:u,progress:s/e.questions.length*100})}const we=z.createContext(void 0),te=()=>{const e=z.useContext(we);if(!e)throw new Error("useFormContext must be used within a FormProvider");return e};function ve(e){var o,r,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(o=0;o<s;o++)e[o]&&(r=ve(e[o]))&&(t&&(t+=" "),t+=r)}else for(r in e)e[r]&&(t&&(t+=" "),t+=r);return t}function qe(){for(var e,o,r=0,t="",s=arguments.length;r<s;r++)(e=arguments[r])&&(o=ve(e))&&(t&&(t+=" "),t+=o);return t}const et=(e,o)=>{const r=new Array(e.length+o.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let t=0;t<o.length;t++)r[e.length+t]=o[t];return r},tt=(e,o)=>({classGroupId:e,validator:o}),ke=(e=new Map,o=null,r)=>({nextPart:e,validators:o,classGroupId:r}),se="-",Ce=[],rt="arbitrary..",ot=e=>{const o=nt(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:t}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return st(a);const u=a.split(se),d=u[0]===""&&u.length>1?1:0;return Se(u,d,o)},getConflictingClassGroupIds:(a,u)=>{if(u){const d=t[a],g=r[a];return d?g?et(g,d):d:g||Ce}return r[a]||Ce}}},Se=(e,o,r)=>{if(e.length-o===0)return r.classGroupId;const s=e[o],i=r.nextPart.get(s);if(i){const g=Se(e,o+1,i);if(g)return g}const a=r.validators;if(a===null)return;const u=o===0?e.join(se):e.slice(o).join(se),d=a.length;for(let g=0;g<d;g++){const v=a[g];if(v.validator(u))return v.classGroupId}},st=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const o=e.slice(1,-1),r=o.indexOf(":"),t=o.slice(0,r);return t?rt+t:void 0})(),nt=e=>{const{theme:o,classGroups:r}=e;return at(r,o)},at=(e,o)=>{const r=ke();for(const t in e){const s=e[t];me(s,r,t,o)}return r},me=(e,o,r,t)=>{const s=e.length;for(let i=0;i<s;i++){const a=e[i];it(a,o,r,t)}},it=(e,o,r,t)=>{if(typeof e=="string"){lt(e,o,r);return}if(typeof e=="function"){ct(e,o,r,t);return}dt(e,o,r,t)},lt=(e,o,r)=>{const t=e===""?o:ze(o,e);t.classGroupId=r},ct=(e,o,r,t)=>{if(pt(e)){me(e(t),o,r,t);return}o.validators===null&&(o.validators=[]),o.validators.push(tt(r,e))},dt=(e,o,r,t)=>{const s=Object.entries(e),i=s.length;for(let a=0;a<i;a++){const[u,d]=s[a];me(d,ze(o,u),r,t)}},ze=(e,o)=>{let r=e;const t=o.split(se),s=t.length;for(let i=0;i<s;i++){const a=t[i];let u=r.nextPart.get(a);u||(u=ke(),r.nextPart.set(a,u)),r=u}return r},pt=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,mt=e=>{if(e<1)return{get:()=>{},set:()=>{}};let o=0,r=Object.create(null),t=Object.create(null);const s=(i,a)=>{r[i]=a,o++,o>e&&(o=0,t=r,r=Object.create(null))};return{get(i){let a=r[i];if(a!==void 0)return a;if((a=t[i])!==void 0)return s(i,a),a},set(i,a){i in r?r[i]=a:s(i,a)}}},ue="!",Ne=":",ut=[],Ae=(e,o,r,t,s)=>({modifiers:e,hasImportantModifier:o,baseClassName:r,maybePostfixModifierPosition:t,isExternal:s}),ft=e=>{const{prefix:o,experimentalParseClassName:r}=e;let t=s=>{const i=[];let a=0,u=0,d=0,g;const v=s.length;for(let m=0;m<v;m++){const f=s[m];if(a===0&&u===0){if(f===Ne){i.push(s.slice(d,m)),d=m+1;continue}if(f==="/"){g=m;continue}}f==="["?a++:f==="]"?a--:f==="("?u++:f===")"&&u--}const x=i.length===0?s:s.slice(d);let k=x,A=!1;x.endsWith(ue)?(k=x.slice(0,-1),A=!0):x.startsWith(ue)&&(k=x.slice(1),A=!0);const C=g&&g>d?g-d:void 0;return Ae(i,A,k,C)};if(o){const s=o+Ne,i=t;t=a=>a.startsWith(s)?i(a.slice(s.length)):Ae(ut,!1,a,void 0,!0)}if(r){const s=t;t=i=>r({className:i,parseClassName:s})}return t},bt=e=>{const o=new Map;return e.orderSensitiveModifiers.forEach((r,t)=>{o.set(r,1e6+t)}),r=>{const t=[];let s=[];for(let i=0;i<r.length;i++){const a=r[i],u=a[0]==="[",d=o.has(a);u||d?(s.length>0&&(s.sort(),t.push(...s),s=[]),t.push(a)):s.push(a)}return s.length>0&&(s.sort(),t.push(...s)),t}},gt=e=>w({cache:mt(e.cacheSize),parseClassName:ft(e),sortModifiers:bt(e)},ot(e)),ht=/\s+/,xt=(e,o)=>{const{parseClassName:r,getClassGroupId:t,getConflictingClassGroupIds:s,sortModifiers:i}=o,a=[],u=e.trim().split(ht);let d="";for(let g=u.length-1;g>=0;g-=1){const v=u[g],{isExternal:x,modifiers:k,hasImportantModifier:A,baseClassName:C,maybePostfixModifierPosition:m}=r(v);if(x){d=v+(d.length>0?" "+d:d);continue}let f=!!m,y=t(f?C.substring(0,m):C);if(!y){if(!f){d=v+(d.length>0?" "+d:d);continue}if(y=t(C),!y){d=v+(d.length>0?" "+d:d);continue}f=!1}const P=k.length===0?"":k.length===1?k[0]:i(k).join(":"),$=A?P+ue:P,I=$+y;if(a.indexOf(I)>-1)continue;a.push(I);const M=s(y,f);for(let G=0;G<M.length;++G){const W=M[G];a.push($+W)}d=v+(d.length>0?" "+d:d)}return d},yt=(...e)=>{let o=0,r,t,s="";for(;o<e.length;)(r=e[o++])&&(t=Fe(r))&&(s&&(s+=" "),s+=t);return s},Fe=e=>{if(typeof e=="string")return e;let o,r="";for(let t=0;t<e.length;t++)e[t]&&(o=Fe(e[t]))&&(r&&(r+=" "),r+=o);return r},wt=(e,...o)=>{let r,t,s,i;const a=d=>{const g=o.reduce((v,x)=>x(v),e());return r=gt(g),t=r.cache.get,s=r.cache.set,i=u,u(d)},u=d=>{const g=t(d);if(g)return g;const v=xt(d,r);return s(d,v),v};return i=a,(...d)=>i(yt(...d))},vt=[],T=e=>{const o=r=>r[e]||vt;return o.isThemeGetter=!0,o},Ie=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Te=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kt=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ct=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,St=/\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$/,zt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Nt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,At=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,K=e=>kt.test(e),h=e=>!!e&&!Number.isNaN(Number(e)),Q=e=>!!e&&Number.isInteger(Number(e)),fe=e=>e.endsWith("%")&&h(e.slice(0,-1)),U=e=>Ct.test(e),$e=()=>!0,Ft=e=>St.test(e)&&!zt.test(e),be=()=>!1,It=e=>Nt.test(e),Tt=e=>At.test(e),$t=e=>!l(e)&&!c(e),Pt=e=>H(e,Oe,be),l=e=>Ie.test(e),J=e=>H(e,Me,Ft),Pe=e=>H(e,Wt,h),Et=e=>H(e,We,$e),Lt=e=>H(e,Be,be),Ee=e=>H(e,je,be),jt=e=>H(e,Ge,Tt),ne=e=>H(e,Ve,It),c=e=>Te.test(e),re=e=>Z(e,Me),Gt=e=>Z(e,Be),Le=e=>Z(e,je),Ot=e=>Z(e,Oe),Mt=e=>Z(e,Ge),ae=e=>Z(e,Ve,!0),Bt=e=>Z(e,We,!0),H=(e,o,r)=>{const t=Ie.exec(e);return t?t[1]?o(t[1]):r(t[2]):!1},Z=(e,o,r=!1)=>{const t=Te.exec(e);return t?t[1]?o(t[1]):r:!1},je=e=>e==="position"||e==="percentage",Ge=e=>e==="image"||e==="url",Oe=e=>e==="length"||e==="size"||e==="bg-size",Me=e=>e==="length",Wt=e=>e==="number",Be=e=>e==="family-name",We=e=>e==="number"||e==="weight",Ve=e=>e==="shadow",Vt=wt(()=>{const e=T("color"),o=T("font"),r=T("text"),t=T("font-weight"),s=T("tracking"),i=T("leading"),a=T("breakpoint"),u=T("container"),d=T("spacing"),g=T("radius"),v=T("shadow"),x=T("inset-shadow"),k=T("text-shadow"),A=T("drop-shadow"),C=T("blur"),m=T("perspective"),f=T("aspect"),y=T("ease"),P=T("animate"),$=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],M=()=>[...I(),c,l],G=()=>["auto","hidden","clip","visible","scroll"],W=()=>["auto","contain","none"],p=()=>[c,l,d],N=()=>[K,"full","auto",...p()],X=()=>[Q,"none","subgrid",c,l],Y=()=>["auto",{span:["full",Q,c,l]},Q,c,l],D=()=>[Q,"auto",c,l],B=()=>["auto","min","max","fr",c,l],oe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],q=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...p()],R=()=>[K,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...p()],ge=()=>[K,"screen","full","dvw","lvw","svw","min","max","fit",...p()],he=()=>[K,"screen","full","lh","dvh","lvh","svh","min","max","fit",...p()],b=()=>[e,c,l],_e=()=>[...I(),Le,Ee,{position:[c,l]}],De=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ue=()=>["auto","cover","contain",Ot,Pt,{size:[c,l]}],xe=()=>[fe,re,J],L=()=>["","none","full",g,c,l],j=()=>["",h,re,J],ie=()=>["solid","dashed","dotted","double"],Ke=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],E=()=>[h,fe,Le,Ee],Qe=()=>["","none",C,c,l],le=()=>["none",h,c,l],ce=()=>["none",h,c,l],ye=()=>[h,c,l],de=()=>[K,"full",...p()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[U],breakpoint:[U],color:[$e],container:[U],"drop-shadow":[U],ease:["in","out","in-out"],font:[$t],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[U],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[U],shadow:[U],spacing:["px",h],text:[U],"text-shadow":[U],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",K,l,c,f]}],container:["container"],columns:[{columns:[h,l,c,u]}],"break-after":[{"break-after":$()}],"break-before":[{"break-before":$()}],"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:M()}],overflow:[{overflow:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:W()}],"overscroll-x":[{"overscroll-x":W()}],"overscroll-y":[{"overscroll-y":W()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[Q,"auto",c,l]}],basis:[{basis:[K,"full","auto",u,...p()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[h,K,"auto","initial","none",l]}],grow:[{grow:["",h,c,l]}],shrink:[{shrink:["",h,c,l]}],order:[{order:[Q,"first","last","none",c,l]}],"grid-cols":[{"grid-cols":X()}],"col-start-end":[{col:Y()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":X()}],"row-start-end":[{row:Y()}],"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":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:p()}],"gap-x":[{"gap-x":p()}],"gap-y":[{"gap-y":p()}],"justify-content":[{justify:[...oe(),"normal"]}],"justify-items":[{"justify-items":[...q(),"normal"]}],"justify-self":[{"justify-self":["auto",...q()]}],"align-content":[{content:["normal",...oe()]}],"align-items":[{items:[...q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...q(),{baseline:["","last"]}]}],"place-content":[{"place-content":oe()}],"place-items":[{"place-items":[...q(),"baseline"]}],"place-self":[{"place-self":["auto",...q()]}],p:[{p:p()}],px:[{px:p()}],py:[{py:p()}],ps:[{ps:p()}],pe:[{pe:p()}],pbs:[{pbs:p()}],pbe:[{pbe:p()}],pt:[{pt:p()}],pr:[{pr:p()}],pb:[{pb:p()}],pl:[{pl:p()}],m:[{m:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mbs:[{mbs:V()}],mbe:[{mbe:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"space-x":[{"space-x":p()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":p()}],"space-y-reverse":["space-y-reverse"],size:[{size:R()}],"inline-size":[{inline:["auto",...ge()]}],"min-inline-size":[{"min-inline":["auto",...ge()]}],"max-inline-size":[{"max-inline":["none",...ge()]}],"block-size":[{block:["auto",...he()]}],"min-block-size":[{"min-block":["auto",...he()]}],"max-block-size":[{"max-block":["none",...he()]}],w:[{w:[u,"screen",...R()]}],"min-w":[{"min-w":[u,"screen","none",...R()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[a]},...R()]}],h:[{h:["screen","lh",...R()]}],"min-h":[{"min-h":["screen","lh","none",...R()]}],"max-h":[{"max-h":["screen","lh",...R()]}],"font-size":[{text:["base",r,re,J]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,Bt,Et]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fe,l]}],"font-family":[{font:[Gt,Lt,o]}],"font-features":[{"font-features":[l]}],"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,c,l]}],"line-clamp":[{"line-clamp":[h,"none",c,Pe]}],leading:[{leading:[i,...p()]}],"list-image":[{"list-image":["none",c,l]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",c,l]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:b()}],"text-color":[{text:b()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[h,"from-font","auto",c,J]}],"text-decoration-color":[{decoration:b()}],"underline-offset":[{"underline-offset":[h,"auto",c,l]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:p()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",c,l]}],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",c,l]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_e()}],"bg-repeat":[{bg:De()}],"bg-size":[{bg:Ue()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Q,c,l],radial:["",c,l],conic:[Q,c,l]},Mt,jt]}],"bg-color":[{bg:b()}],"gradient-from-pos":[{from:xe()}],"gradient-via-pos":[{via:xe()}],"gradient-to-pos":[{to:xe()}],"gradient-from":[{from:b()}],"gradient-via":[{via:b()}],"gradient-to":[{to:b()}],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:j()}],"border-w-x":[{"border-x":j()}],"border-w-y":[{"border-y":j()}],"border-w-s":[{"border-s":j()}],"border-w-e":[{"border-e":j()}],"border-w-bs":[{"border-bs":j()}],"border-w-be":[{"border-be":j()}],"border-w-t":[{"border-t":j()}],"border-w-r":[{"border-r":j()}],"border-w-b":[{"border-b":j()}],"border-w-l":[{"border-l":j()}],"divide-x":[{"divide-x":j()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":j()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:b()}],"border-color-x":[{"border-x":b()}],"border-color-y":[{"border-y":b()}],"border-color-s":[{"border-s":b()}],"border-color-e":[{"border-e":b()}],"border-color-bs":[{"border-bs":b()}],"border-color-be":[{"border-be":b()}],"border-color-t":[{"border-t":b()}],"border-color-r":[{"border-r":b()}],"border-color-b":[{"border-b":b()}],"border-color-l":[{"border-l":b()}],"divide-color":[{divide:b()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[h,c,l]}],"outline-w":[{outline:["",h,re,J]}],"outline-color":[{outline:b()}],shadow:[{shadow:["","none",v,ae,ne]}],"shadow-color":[{shadow:b()}],"inset-shadow":[{"inset-shadow":["none",x,ae,ne]}],"inset-shadow-color":[{"inset-shadow":b()}],"ring-w":[{ring:j()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:b()}],"ring-offset-w":[{"ring-offset":[h,J]}],"ring-offset-color":[{"ring-offset":b()}],"inset-ring-w":[{"inset-ring":j()}],"inset-ring-color":[{"inset-ring":b()}],"text-shadow":[{"text-shadow":["none",k,ae,ne]}],"text-shadow-color":[{"text-shadow":b()}],opacity:[{opacity:[h,c,l]}],"mix-blend":[{"mix-blend":[...Ke(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ke()}],"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":[h]}],"mask-image-linear-from-pos":[{"mask-linear-from":E()}],"mask-image-linear-to-pos":[{"mask-linear-to":E()}],"mask-image-linear-from-color":[{"mask-linear-from":b()}],"mask-image-linear-to-color":[{"mask-linear-to":b()}],"mask-image-t-from-pos":[{"mask-t-from":E()}],"mask-image-t-to-pos":[{"mask-t-to":E()}],"mask-image-t-from-color":[{"mask-t-from":b()}],"mask-image-t-to-color":[{"mask-t-to":b()}],"mask-image-r-from-pos":[{"mask-r-from":E()}],"mask-image-r-to-pos":[{"mask-r-to":E()}],"mask-image-r-from-color":[{"mask-r-from":b()}],"mask-image-r-to-color":[{"mask-r-to":b()}],"mask-image-b-from-pos":[{"mask-b-from":E()}],"mask-image-b-to-pos":[{"mask-b-to":E()}],"mask-image-b-from-color":[{"mask-b-from":b()}],"mask-image-b-to-color":[{"mask-b-to":b()}],"mask-image-l-from-pos":[{"mask-l-from":E()}],"mask-image-l-to-pos":[{"mask-l-to":E()}],"mask-image-l-from-color":[{"mask-l-from":b()}],"mask-image-l-to-color":[{"mask-l-to":b()}],"mask-image-x-from-pos":[{"mask-x-from":E()}],"mask-image-x-to-pos":[{"mask-x-to":E()}],"mask-image-x-from-color":[{"mask-x-from":b()}],"mask-image-x-to-color":[{"mask-x-to":b()}],"mask-image-y-from-pos":[{"mask-y-from":E()}],"mask-image-y-to-pos":[{"mask-y-to":E()}],"mask-image-y-from-color":[{"mask-y-from":b()}],"mask-image-y-to-color":[{"mask-y-to":b()}],"mask-image-radial":[{"mask-radial":[c,l]}],"mask-image-radial-from-pos":[{"mask-radial-from":E()}],"mask-image-radial-to-pos":[{"mask-radial-to":E()}],"mask-image-radial-from-color":[{"mask-radial-from":b()}],"mask-image-radial-to-color":[{"mask-radial-to":b()}],"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":I()}],"mask-image-conic-pos":[{"mask-conic":[h]}],"mask-image-conic-from-pos":[{"mask-conic-from":E()}],"mask-image-conic-to-pos":[{"mask-conic-to":E()}],"mask-image-conic-from-color":[{"mask-conic-from":b()}],"mask-image-conic-to-color":[{"mask-conic-to":b()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_e()}],"mask-repeat":[{mask:De()}],"mask-size":[{mask:Ue()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",c,l]}],filter:[{filter:["","none",c,l]}],blur:[{blur:Qe()}],brightness:[{brightness:[h,c,l]}],contrast:[{contrast:[h,c,l]}],"drop-shadow":[{"drop-shadow":["","none",A,ae,ne]}],"drop-shadow-color":[{"drop-shadow":b()}],grayscale:[{grayscale:["",h,c,l]}],"hue-rotate":[{"hue-rotate":[h,c,l]}],invert:[{invert:["",h,c,l]}],saturate:[{saturate:[h,c,l]}],sepia:[{sepia:["",h,c,l]}],"backdrop-filter":[{"backdrop-filter":["","none",c,l]}],"backdrop-blur":[{"backdrop-blur":Qe()}],"backdrop-brightness":[{"backdrop-brightness":[h,c,l]}],"backdrop-contrast":[{"backdrop-contrast":[h,c,l]}],"backdrop-grayscale":[{"backdrop-grayscale":["",h,c,l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h,c,l]}],"backdrop-invert":[{"backdrop-invert":["",h,c,l]}],"backdrop-opacity":[{"backdrop-opacity":[h,c,l]}],"backdrop-saturate":[{"backdrop-saturate":[h,c,l]}],"backdrop-sepia":[{"backdrop-sepia":["",h,c,l]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":p()}],"border-spacing-x":[{"border-spacing-x":p()}],"border-spacing-y":[{"border-spacing-y":p()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",c,l]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[h,"initial",c,l]}],ease:[{ease:["linear","initial",y,c,l]}],delay:[{delay:[h,c,l]}],animate:[{animate:["none",P,c,l]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,c,l]}],"perspective-origin":[{"perspective-origin":M()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":["scale-3d"],skew:[{skew:ye()}],"skew-x":[{"skew-x":ye()}],"skew-y":[{"skew-y":ye()}],transform:[{transform:[c,l,"","none","gpu","cpu"]}],"transform-origin":[{origin:M()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:de()}],"translate-x":[{"translate-x":de()}],"translate-y":[{"translate-y":de()}],"translate-z":[{"translate-z":de()}],"translate-none":["translate-none"],accent:[{accent:b()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:b()}],"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",c,l]}],"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":p()}],"scroll-mx":[{"scroll-mx":p()}],"scroll-my":[{"scroll-my":p()}],"scroll-ms":[{"scroll-ms":p()}],"scroll-me":[{"scroll-me":p()}],"scroll-mbs":[{"scroll-mbs":p()}],"scroll-mbe":[{"scroll-mbe":p()}],"scroll-mt":[{"scroll-mt":p()}],"scroll-mr":[{"scroll-mr":p()}],"scroll-mb":[{"scroll-mb":p()}],"scroll-ml":[{"scroll-ml":p()}],"scroll-p":[{"scroll-p":p()}],"scroll-px":[{"scroll-px":p()}],"scroll-py":[{"scroll-py":p()}],"scroll-ps":[{"scroll-ps":p()}],"scroll-pe":[{"scroll-pe":p()}],"scroll-pbs":[{"scroll-pbs":p()}],"scroll-pbe":[{"scroll-pbe":p()}],"scroll-pt":[{"scroll-pt":p()}],"scroll-pr":[{"scroll-pr":p()}],"scroll-pb":[{"scroll-pb":p()}],"scroll-pl":[{"scroll-pl":p()}],"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",c,l]}],fill:[{fill:["none",...b()]}],"stroke-w":[{stroke:[h,re,J,Pe]}],stroke:[{stroke:["none",...b()]}],"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 _(...e){return Vt(qe(e))}function _t(e,o,r){if(!e)return"";const t=e.replace(/\D/g,"");if(o==="phone")return t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2").slice(0,14);if(o==="cellphone")return t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2").slice(0,15);if(o==="cpf")return t.replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})/,"$1-$2").replace(/(-\d{2})\d+?$/,"$1");if(o==="cnpj")return t.replace(/(\d{2})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1/$2").replace(/(\d{4})(\d)/,"$1-$2").replace(/(-\d{2})\d+?$/,"$1");if(o==="cep")return t.replace(/(\d{5})(\d)/,"$1-$2").slice(0,9);if(o==="custom"&&r){let s=0;return r.replace(/[#X0]/g,()=>t[s++]||"").replace(/[^0-9a-zA-Z]+$/,"")}return e}function Dt({question:e}){var C,m,f,y,P,$,I,M,G,W;const{answers:o,setAnswer:r,nextStep:t,schema:s}=te(),i=o[e.id],a=i!=null?String(i):"",u=z.useRef(null),d=s.questions[0].id===e.id,g=!s.disableAutoFocus||!d;z.useEffect(()=>{if(g){const p=setTimeout(()=>{var N;(N=u.current)==null||N.focus()},500);return()=>clearTimeout(p)}},[e.id,g]);const v=p=>{var Y,D,B;let N=p.target.value;((Y=e.validation)!=null&&Y.maskType||(D=e.validation)!=null&&D.mask)&&(N=_t(N,e.validation.maskType,e.validation.mask));const X=((B=e.validation)==null?void 0:B.maxLength)||2048;if(N.length>X&&(N=N.slice(0,X)),e.type==="number"){const oe=N===""?"":parseFloat(N);r(e.id,oe)}else r(e.id,N)},x=()=>{var p,N,X,Y,D;if((p=e.validation)!=null&&p.required&&!a)return!1;if(a){if((N=e.validation)!=null&&N.minLength&&a.length<e.validation.minLength||e.type==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a))return!1;if((X=e.validation)!=null&&X.pattern)try{if(!new RegExp(e.validation.pattern).test(a))return!1}catch(B){console.error("Invalid regex pattern in schema",B)}if(e.type==="number"){const B=parseFloat(a);if(!isNaN(B)&&(((Y=e.validation)==null?void 0:Y.min)!==void 0&&B<e.validation.min||((D=e.validation)==null?void 0:D.max)!==void 0&&B>e.validation.max))return!1}}return!0},k=p=>{if(p.key==="Enter"&&!p.shiftKey){if(p.preventDefault(),!x()){const N=document.querySelector(".sawabona-form-container")||document.body;N.classList.add("shake-animation"),setTimeout(()=>N.classList.remove("shake-animation"),500);return}t()}};return n.jsxs("div",{className:"w-full relative group",children:[n.jsx("input",{ref:u,type:e.type,value:typeof a=="string"||typeof a=="number"?a:"",onChange:v,onKeyDown:k,placeholder:e.placeholder,minLength:(C=e.validation)==null?void 0:C.minLength,maxLength:((m=e.validation)==null?void 0:m.maxLength)||2048,min:(f=e.validation)==null?void 0:f.min,max:(y=e.validation)==null?void 0:y.max,pattern:(P=e.validation)==null?void 0:P.pattern,className:_(`w-full bg-transparent border-b-2 border-sw-text-secondary/20
3
2
  py-4 text-2xl md:text-3xl font-medium outline-none transition-colors
4
3
  placeholder:text-sw-text-secondary/30
5
4
  focus:border-sw-primary
6
- font-sw-heading
7
- `,style:s(s({},((z=d.theme)==null?void 0:z.labelFont)&&{fontFamily:"var(--font-sw-label)"}),((j=d.theme)==null?void 0:j.labelFontSize)&&{fontSize:"var(--size-sw-label)"})}),void 0,t.jsx("p",{className:"text-sm opacity-50 mt-4",children:(e.type==="email"||e.type==="text"||e.type==="number"||e.type==="url")&&(((W=d.i18n)==null?void 0:W.pressEnter)||"Press Enter to continue")})]})}function G({question:e}){var N;const{answers:a,setAnswer:o,nextStep:r,schema:d}=A(),u=e.type==="multi-select"||e.multiple,y=a[e.id],h=u?Array.isArray(y)?y:y!==void 0?[y]:[]:y||"",g=c=>{if(u){const C=h,w=C.includes(c);let p;w?p=C.filter(n=>n!==c):p=[...C,c],o(e.id,p)}else o(e.id,c),setTimeout(()=>r(),400)},v="ABCDEFGHIJKLMNOPQRSTUVWXYZ";return l.useEffect(()=>{const c=C=>{var n;const w=C.key.toUpperCase(),p=v.indexOf(w);p>=0&&p<(((n=e.options)==null?void 0:n.length)||0)&&g(e.options[p].value)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[e.options,e.id]),t.jsx("div",{className:"flex flex-col gap-3 w-full max-w-xl max-h-[55vh] overflow-y-auto pr-2 pb-2 -mr-2 scroll-smooth",style:{gap:"var(--sw-option-gap, 0.75rem)",scrollbarWidth:"thin",scrollbarColor:"var(--sw-primary) transparent"},children:(N=e.options)==null?void 0:N.map((c,C)=>{var p,n,f,x,$,z;const w=u?h.includes(c.value):h===c.value;return t.jsxs(m.motion.button,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:Math.min(C*.05,.5)},onClick:()=>g(c.value),className:`
8
- w-full text-left p-4 rounded-lg border-2 transition-all duration-200
9
- flex items-center justify-between group flex-shrink-0
10
- ${w?"border-sw-primary bg-sw-primary/5 text-sw-primary":"border-sw-text-secondary/10 hover:border-sw-primary/50 hover:bg-sw-primary/5"}
11
- `,style:s({padding:"var(--sw-option-padding, 1rem)",borderRadius:"var(--sw-option-radius, 0.5rem)",borderWidth:"var(--sw-option-border, 2px)"},w&&((p=d.theme)!=null&&p.optionActiveColor)?{borderColor:"var(--sw-option-active)"}:{}),children:[t.jsxs("span",{className:"text-base md:text-lg font-medium flex items-center gap-3 w-full",style:s(s({},((n=d.theme)==null?void 0:n.labelFont)&&{fontFamily:"var(--font-sw-label)"}),((f=d.theme)==null?void 0:f.labelFontSize)&&{fontSize:"var(--size-sw-label)"}),children:[t.jsx("span",{className:`
5
+ font-sw-heading`,(I=($=s.theme)==null?void 0:$.customClasses)==null?void 0:I.input),style:w(w({},((M=s.theme)==null?void 0:M.labelFont)&&{fontFamily:"var(--font-sw-label)"}),((G=s.theme)==null?void 0:G.labelFontSize)&&{fontSize:"var(--size-sw-label)"})}),void 0,n.jsx("p",{className:"text-sm opacity-50 mt-4",children:(e.type==="email"||e.type==="text"||e.type==="number"||e.type==="url")&&(((W=s.i18n)==null?void 0:W.pressEnter)||"Press Enter to continue")})]})}function Ut({question:e}){var v;const{answers:o,setAnswer:r,nextStep:t,schema:s}=te(),i=e.type==="multi-select"||e.multiple,a=o[e.id],u=i?Array.isArray(a)?a:a!==void 0?[a]:[]:a||"",d=x=>{if(i){const k=u,A=k.includes(x);let C;A?C=k.filter(m=>m!==x):C=[...k,x],r(e.id,C)}else r(e.id,x),setTimeout(()=>t(),400)},g="ABCDEFGHIJKLMNOPQRSTUVWXYZ";return z.useEffect(()=>{const x=k=>{var m;const A=k.key.toUpperCase(),C=g.indexOf(A);C>=0&&C<(((m=e.options)==null?void 0:m.length)||0)&&d(e.options[C].value)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[e.options,e.id]),n.jsx("div",{className:"flex flex-col gap-3 w-full max-w-xl max-h-[55vh] overflow-y-auto pr-2 pb-2 -mr-2 scroll-smooth",style:{gap:"var(--sw-option-gap, 0.75rem)",scrollbarWidth:"thin",scrollbarColor:"var(--sw-primary) transparent"},children:(v=e.options)==null?void 0:v.map((x,k)=>{var C,m,f,y,P,$,I,M,G,W;const A=i?u.includes(x.value):u===x.value;return n.jsxs(F.motion.button,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:Math.min(k*.05,.5)},onClick:()=>d(x.value),className:_(`w-full text-left p-4 rounded-lg border-2 transition-all duration-200
6
+ flex items-center justify-between group flex-shrink-0`,A?"border-sw-primary bg-sw-primary/5 text-sw-primary":"border-sw-text-secondary/10 hover:border-sw-primary/50 hover:bg-sw-primary/5",(m=(C=s.theme)==null?void 0:C.customClasses)==null?void 0:m.option,A&&((y=(f=s.theme)==null?void 0:f.customClasses)==null?void 0:y.optionActive)),style:w({padding:"var(--sw-option-padding, 1rem)",borderRadius:"var(--sw-option-radius, 0.5rem)",borderWidth:"var(--sw-option-border, 2px)"},A&&((P=s.theme)!=null&&P.optionActiveColor)?{borderColor:"var(--sw-option-active)"}:{}),children:[n.jsxs("span",{className:"text-base md:text-lg font-medium flex items-center gap-3 w-full",style:w(w({},(($=s.theme)==null?void 0:$.labelFont)&&{fontFamily:"var(--font-sw-label)"}),((I=s.theme)==null?void 0:I.labelFontSize)&&{fontSize:"var(--size-sw-label)"}),children:[n.jsx("span",{className:`
12
7
  flex-shrink-0 w-5 h-5 md:w-6 md:h-6 rounded-full border-2 flex items-center justify-center transition-colors
13
- ${w?"border-sw-primary bg-sw-primary":"border-sw-text-secondary/30 group-hover:border-sw-primary/50"}
14
- `,style:s({},w&&((x=d.theme)!=null&&x.optionActiveColor)?{borderColor:"var(--sw-option-active)",backgroundColor:"var(--sw-option-active)"}:{}),children:w&&t.jsx(I.Check,{size:14,className:"text-sw-background"})}),t.jsx("span",{className:"break-words whitespace-pre-wrap",children:c.label})]}),!(($=d.i18n)!=null&&$.hideSelectText)&&t.jsxs("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-[10px] md:text-xs font-mono uppercase tracking-widest text-sw-text-secondary/50 flex-shrink-0 ml-4 hidden sm:inline-block",children:[((z=d.i18n)==null?void 0:z.selectKey)||"Select"," ",t.jsxs("span",{className:"hidden md:inline",children:["Key ",C+1]})]})]},String(c.value))})})}function X({question:e}){var u;const{answers:a,setAnswer:o}=A(),r=a[e.id]||0,d=Math.min(((u=e.validation)==null?void 0:u.max)||5,20);return t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx("div",{className:"flex gap-4 flex-wrap",children:Array.from({length:d}).map((y,h)=>{const g=h+1,v=g<=r;return t.jsx(m.motion.button,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{delay:h*.05},onClick:()=>o(e.id,g),whileHover:{scale:1.2,rotate:5},whileTap:{scale:.9},className:"focus:outline-none",children:t.jsx(I.Star,{className:`w-12 h-12 md:w-16 md:h-16 transition-all duration-300 ${v?"fill-yellow-400 text-yellow-400 drop-shadow-[0_0_15px_rgba(250,204,21,0.4)]":"text-zinc-600 hover:text-yellow-400/50"}`,strokeWidth:1.5})},h)})}),t.jsxs("div",{className:"flex justify-between w-full max-w-[300px] md:max-w-[400px] px-2 items-center",children:[t.jsx("span",{className:"text-sm md:text-base font-medium text-sw-text-secondary/50 uppercase tracking-wide",children:e.minLabel||"Poor"}),t.jsx(m.motion.div,{initial:{opacity:0,scale:.8},animate:{opacity:r?1:0,scale:r?1:.8},className:"font-bold text-primary text-xl",children:r?`${r} / ${d}`:""}),t.jsx("span",{className:"text-sm md:text-base font-medium text-muted-foreground uppercase tracking-wide",children:e.maxLabel||"Excellent"})]})]})}function Z({question:e}){var h,g,v,N;const{schema:a}=A(),o=a.questions.findIndex(c=>c.id===e.id)+1,r=a.questions.length,d={hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:.5,ease:[.22,1,.36,1]}}},u=c=>c&&c.replace(/\{\{(\w+)\}\}/g,(C,w)=>{const p=y.answers[w];return p!=null?String(p):""}),y=A();return t.jsxs(m.motion.div,{className:"flex flex-col gap-8 w-full max-w-4xl mx-auto",initial:"hidden",animate:"visible",variants:{visible:{transition:{staggerChildren:.1}}},children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(m.motion.div,{variants:d,className:"flex gap-4 items-baseline",children:t.jsxs("span",{className:"flex items-center gap-2 text-sm md:text-base font-medium text-sw-primary/90 bg-sw-primary/10 px-3 py-1 rounded-full border border-sw-primary/20 backdrop-blur-sm",children:[t.jsx("span",{children:o}),t.jsx("span",{className:"opacity-40 text-xs",children:"/"}),t.jsx("span",{className:"opacity-60",children:r})]})}),t.jsxs(m.motion.h2,{variants:d,className:"text-3xl md:text-4xl lg:text-5xl font-bold leading-tight tracking-tight text-pretty mt-2 font-sw-heading",style:s(s({},((h=a.theme)==null?void 0:h.titleFont)&&{fontFamily:"var(--font-sw-title)"}),((g=a.theme)==null?void 0:g.titleFontSize)&&{fontSize:"var(--size-sw-title)"}),children:[u(e.title)," ",t.jsx("span",{className:"text-sw-primary",children:"*"})]}),e.description&&t.jsx(m.motion.p,{variants:d,className:"text-lg md:text-xl text-muted-foreground font-normal leading-relaxed max-w-2xl mt-2",style:s(s({},((v=a.theme)==null?void 0:v.descriptionFont)&&{fontFamily:"var(--font-sw-description)"}),((N=a.theme)==null?void 0:N.descriptionFontSize)&&{fontSize:"var(--size-sw-description)"}),children:u(e.description)})]}),t.jsx(m.motion.div,{variants:d,className:"w-full mt-6",children:e.type==="text"||e.type==="email"||e.type==="number"||e.type==="url"?t.jsx(V,{question:e}):e.type==="select"||e.type==="multi-select"?t.jsx(G,{question:e}):e.type==="rating"?t.jsx(X,{question:e}):t.jsxs("div",{className:"p-4 bg-yellow-100 dark:bg-yellow-900/30 text-yellow-800 dark:text-yellow-200 rounded",children:["Unsupported question type: ",e.type," (ID: ",e.id,")"]})})]})}const J={next:"Next",back:"Back",submit:"Submit",required:"Required",optional:"Optional",stepInfo:"Question {{current}} of {{total}}"};function Y({schema:e,onSubmit:a}){var w;const o=H({schema:e,onSubmit:a}),r=e.theme||{backgroundColor:"#ffffff",textColor:"#000000",primaryColor:"#000000",borderRadius:"8px"},d=s(s({},J),e.i18n),u=s(s(s(s(s(s(s(s(s(s(s({backgroundColor:r.backgroundColor,color:r.textColor,fontFamily:r.fontFamily,"--color-sw-primary":r.primaryColor,"--color-sw-background":r.backgroundColor,"--color-sw-text-primary":r.primaryColor,"--color-sw-text-secondary":r.textColor,"--font-sw-heading":r.fontFamily||"inherit","--font-sw-body":r.fontFamily||"inherit"},r.titleFont&&{"--font-sw-title":r.titleFont}),r.descriptionFont&&{"--font-sw-description":r.descriptionFont}),r.labelFont&&{"--font-sw-label":r.labelFont}),r.titleFontSize&&{"--size-sw-title":r.titleFontSize}),r.descriptionFontSize&&{"--size-sw-description":r.descriptionFontSize}),r.labelFontSize&&{"--size-sw-label":r.labelFontSize}),r.optionPadding&&{"--sw-option-padding":r.optionPadding}),r.optionBorderRadius&&{"--sw-option-radius":r.optionBorderRadius}),r.optionBorderWidth&&{"--sw-option-border":r.optionBorderWidth}),r.optionGap&&{"--sw-option-gap":r.optionGap}),r.optionActiveColor&&{"--sw-option-active":r.optionActiveColor}),y=r.buttonVariant==="outline",h={backgroundColor:y?"transparent":r.primaryColor,color:y?r.primaryColor:r.textColor,border:y?`2px solid ${r.primaryColor}`:"none",borderRadius:r.borderRadius||"8px",fontWeight:600},g={color:r.primaryColor,borderRadius:r.borderRadius||"8px",fontWeight:600},{autoReload:v,reloadDelay:N=3e3}=e;if(l.useEffect(()=>{if(o.isCompleted&&v){const p=setTimeout(()=>{o.resetForm()},N);return()=>clearTimeout(p)}},[o.isCompleted,v,N,o.resetForm]),o.isCompleted)return t.jsxs("div",{className:"flex flex-col items-center justify-center h-full w-full p-8 text-center relative overflow-hidden",style:u,children:[v&&t.jsx(m.motion.div,{initial:{width:"0%"},animate:{width:"100%"},transition:{duration:N/1e3,ease:"linear"},className:"absolute top-0 left-0 h-1 bg-green-500 z-50"}),t.jsxs(m.motion.div,{initial:{scale:.9,opacity:0,y:20},animate:{scale:1,opacity:1,y:0},transition:{duration:.6,ease:[.22,1,.36,1]},className:"flex flex-col items-center",children:[t.jsx("div",{className:"mb-6 p-4 rounded-full bg-green-500/20 text-green-500 w-24 h-24 flex items-center justify-center",children:t.jsx(I.Check,{size:48})}),t.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-4 tracking-tight",children:"Obrigado!"}),t.jsx("p",{className:"text-xl opacity-70 max-w-md leading-relaxed",children:"Suas respostas foram enviadas com sucesso."})]})]});const c=e.questions.find(p=>p.id===o.currentStepId),C=(e.questions.findIndex(p=>p.id===o.currentStepId)+1)/e.questions.length*100;return t.jsx(P.Provider,{value:S(s({},o),{schema:e}),children:t.jsxs("div",{className:"w-full h-full flex flex-col relative overflow-hidden transition-colors duration-700",style:u,children:[t.jsxs("div",{className:"absolute top-0 left-0 w-full h-1 z-50",children:[t.jsx("div",{className:"absolute top-0 left-0 w-full h-full bg-current opacity-10"}),t.jsx(m.motion.div,{className:"h-full relative z-10",initial:{width:0},animate:{width:`${C}%`},transition:{duration:.5,ease:"easeInOut"},style:{backgroundColor:r.primaryColor}})]}),t.jsxs("div",{className:"flex-1 w-full relative z-10 overflow-y-auto flex flex-col px-6 md:px-12",style:{scrollbarWidth:"none"},children:[t.jsx("div",{className:"flex-1 flex-shrink-0 min-h-[2rem]"}),t.jsx("div",{className:"w-full max-w-5xl mx-auto py-4",children:t.jsx(m.AnimatePresence,{mode:"wait",children:c&&t.jsx(m.motion.div,{initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.5,ease:[.22,1,.36,1]},className:"w-full",children:t.jsx(Z,{question:c})},c.id)})}),t.jsx("div",{className:"flex-1 flex-shrink-0 min-h-[2rem]"})]}),t.jsxs("div",{className:"w-full px-6 pt-6 pb-8 md:p-10 flex flex-col md:flex-row justify-between items-center z-20 gap-4",children:[r.showPoweredBy!==!1&&t.jsxs("a",{href:r.poweredByUrl||"#",target:r.poweredByUrl?"_blank":void 0,rel:r.poweredByUrl?"noopener noreferrer":void 0,className:"order-3 md:order-1 group flex items-center gap-2 px-3 py-1.5 rounded-md border border-white/10 bg-black/20 hover:border-sw-primary/50 hover:bg-black/40 transition-all duration-300 cursor-pointer no-underline backdrop-blur-sm",children:[t.jsx("span",{className:"text-[10px] md:text-xs font-mono font-medium tracking-[0.2em] uppercase text-muted-foreground group-hover:text-muted-foreground/80 transition-colors",children:"Powered By"}),t.jsx("span",{className:"text-[10px] md:text-xs font-mono font-bold tracking-[0.2em] uppercase transition-colors shadow-sw-primary",style:{color:r.brandColor||r.primaryColor},children:((w=r.poweredBy)==null?void 0:w.replace("Powered by ",""))||"SAWABONA TECH"})]}),t.jsxs("div",{className:"flex items-center gap-4 order-2 md:order-3 ml-auto",children:[t.jsx(m.motion.button,{onClick:o.prevStep,disabled:o.history.length===0,whileHover:{scale:1.05},whileTap:{scale:.95},className:"w-12 h-12 md:w-14 md:h-14 flex items-center justify-center disabled:opacity-0 disabled:pointer-events-none transition-all hover:bg-white/5 rounded-full",style:g,children:t.jsx(I.ChevronLeft,{size:24})}),t.jsxs(m.motion.button,{onClick:o.nextStep,whileHover:{scale:1.02},whileTap:{scale:.98},className:"px-8 py-3 md:px-10 md:py-4 text-lg font-bold shadow-2xl flex items-center gap-3 transition-all rounded-lg",style:h,children:[t.jsx("span",{children:o.currentStepId===e.questions[e.questions.length-1].id?r.submitText||d.submit:d.next}),o.currentStepId!==e.questions[e.questions.length-1].id&&t.jsx(I.ChevronRight,{size:20,strokeWidth:3})]})]})]})]})})}i.FormRenderer=Y,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
8
+ ${A?"border-sw-primary bg-sw-primary":"border-sw-text-secondary/30 group-hover:border-sw-primary/50"}
9
+ `,style:w({},A&&((M=s.theme)!=null&&M.optionActiveColor)?{borderColor:"var(--sw-option-active)",backgroundColor:"var(--sw-option-active)"}:{}),children:A&&n.jsx(ee.Check,{size:14,className:"text-sw-background"})}),n.jsx("span",{className:"break-words whitespace-pre-wrap",children:x.label})]}),!((G=s.i18n)!=null&&G.hideSelectText)&&n.jsxs("span",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-[10px] md:text-xs font-mono uppercase tracking-widest text-sw-text-secondary/50 flex-shrink-0 ml-4 hidden sm:inline-block",children:[((W=s.i18n)==null?void 0:W.selectKey)||"Select"," ",n.jsxs("span",{className:"hidden md:inline",children:["Key ",k+1]})]})]},String(x.value))})})}function Kt({question:e}){var a;const{answers:o,setAnswer:r,schema:t}=te(),s=o[e.id]||0,i=Math.min(((a=e.validation)==null?void 0:a.max)||5,20);return n.jsxs("div",{className:"flex flex-col gap-6",children:[n.jsx("div",{className:"flex gap-4 flex-wrap",children:Array.from({length:i}).map((u,d)=>{var x,k,A,C;const g=d+1,v=g<=s;return n.jsx(F.motion.button,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{delay:d*.05},onClick:()=>r(e.id,g),whileHover:{scale:1.2,rotate:5},whileTap:{scale:.9},className:_("focus:outline-none",(k=(x=t.theme)==null?void 0:x.customClasses)==null?void 0:k.option,v&&((C=(A=t.theme)==null?void 0:A.customClasses)==null?void 0:C.optionActive)),children:n.jsx(ee.Star,{className:`w-12 h-12 md:w-16 md:h-16 transition-all duration-300 ${v?"fill-yellow-400 text-yellow-400 drop-shadow-[0_0_15px_rgba(250,204,21,0.4)]":"text-zinc-600 hover:text-yellow-400/50"}`,strokeWidth:1.5})},d)})}),n.jsxs("div",{className:"flex justify-between w-full max-w-[300px] md:max-w-[400px] px-2 items-center",children:[n.jsx("span",{className:"text-sm md:text-base font-medium text-sw-text-secondary/50 uppercase tracking-wide",children:e.minLabel||"Poor"}),n.jsx(F.motion.div,{initial:{opacity:0,scale:.8},animate:{opacity:s?1:0,scale:s?1:.8},className:"font-bold text-primary text-xl",children:s?`${s} / ${i}`:""}),n.jsx("span",{className:"text-sm md:text-base font-medium text-muted-foreground uppercase tracking-wide",children:e.maxLabel||"Excellent"})]})]})}function Qt({question:e}){var u,d,g,v,x,k,A,C,m;const{schema:o}=te(),r=o.questions.findIndex(f=>f.id===e.id)+1,t=o.questions.length,s={hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:.5,ease:[.22,1,.36,1]}}},i=f=>f&&f.replace(/\{\{(\w+)\}\}/g,(y,P)=>{const $=a.answers[P];return $!=null?String($):""}),a=te();return n.jsxs(F.motion.div,{className:"flex flex-col gap-8 w-full max-w-4xl mx-auto",initial:"hidden",animate:"visible",variants:{visible:{transition:{staggerChildren:.1}}},children:[n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx(F.motion.div,{variants:s,className:"flex gap-4 items-baseline",children:n.jsxs("span",{className:"flex items-center gap-2 text-sm md:text-base font-medium text-sw-primary/90 bg-sw-primary/10 px-3 py-1 rounded-full border border-sw-primary/20 backdrop-blur-sm",children:[n.jsx("span",{children:r}),n.jsx("span",{className:"opacity-40 text-xs",children:"/"}),n.jsx("span",{className:"opacity-60",children:t})]})}),n.jsxs(F.motion.h2,{variants:s,className:_("text-3xl md:text-4xl lg:text-5xl font-bold leading-tight tracking-tight text-pretty mt-2 font-sw-heading",(d=(u=o.theme)==null?void 0:u.customClasses)==null?void 0:d.title),style:w(w({},((g=o.theme)==null?void 0:g.titleFont)&&{fontFamily:"var(--font-sw-title)"}),((v=o.theme)==null?void 0:v.titleFontSize)&&{fontSize:"var(--size-sw-title)"}),children:[i(e.title)," ",((x=e.validation)==null?void 0:x.required)&&n.jsx("span",{className:"text-sw-primary",children:"*"})]}),e.description&&n.jsx(F.motion.p,{variants:s,className:_("text-lg md:text-xl text-muted-foreground font-normal leading-relaxed max-w-2xl mt-2",(A=(k=o.theme)==null?void 0:k.customClasses)==null?void 0:A.description),style:w(w({},((C=o.theme)==null?void 0:C.descriptionFont)&&{fontFamily:"var(--font-sw-description)"}),((m=o.theme)==null?void 0:m.descriptionFontSize)&&{fontSize:"var(--size-sw-description)"}),children:i(e.description)})]}),n.jsx(F.motion.div,{variants:s,className:"w-full mt-6",children:e.type==="text"||e.type==="email"||e.type==="number"||e.type==="url"?n.jsx(Dt,{question:e}):e.type==="select"||e.type==="multi-select"?n.jsx(Ut,{question:e}):e.type==="rating"?n.jsx(Kt,{question:e}):n.jsxs("div",{className:"p-4 bg-yellow-100 dark:bg-yellow-900/30 text-yellow-800 dark:text-yellow-200 rounded",children:["Unsupported question type: ",e.type," (ID: ",e.id,")"]})})]})}const Ht={next:"Next",back:"Back",submit:"Submit",required:"Required",optional:"Optional",stepInfo:"Question {{current}} of {{total}}"};function Xt({schema:e,onSubmit:o}){var C,m,f,y,P,$;const r=Re({schema:e,onSubmit:o}),t=e.theme||{backgroundColor:"#ffffff",textColor:"#000000",primaryColor:"#000000",borderRadius:"8px"},s=w(w({},Ht),e.i18n),i=w(w(w(w(w(w(w(w(w(w(w({backgroundColor:t.backgroundColor,color:t.textColor,fontFamily:t.fontFamily,"--color-sw-primary":t.primaryColor,"--color-sw-background":t.backgroundColor,"--color-sw-text-primary":t.primaryColor,"--color-sw-text-secondary":t.textColor,"--font-sw-heading":t.fontFamily||"inherit","--font-sw-body":t.fontFamily||"inherit"},t.titleFont&&{"--font-sw-title":t.titleFont}),t.descriptionFont&&{"--font-sw-description":t.descriptionFont}),t.labelFont&&{"--font-sw-label":t.labelFont}),t.titleFontSize&&{"--size-sw-title":t.titleFontSize}),t.descriptionFontSize&&{"--size-sw-description":t.descriptionFontSize}),t.labelFontSize&&{"--size-sw-label":t.labelFontSize}),t.optionPadding&&{"--sw-option-padding":t.optionPadding}),t.optionBorderRadius&&{"--sw-option-radius":t.optionBorderRadius}),t.optionBorderWidth&&{"--sw-option-border":t.optionBorderWidth}),t.optionGap&&{"--sw-option-gap":t.optionGap}),t.optionActiveColor&&{"--sw-option-active":t.optionActiveColor}),a=t.buttonVariant==="outline",u={backgroundColor:a?"transparent":t.primaryColor,color:a?t.primaryColor:t.textColor,border:a?`2px solid ${t.primaryColor}`:"none",borderRadius:t.borderRadius||"8px",fontWeight:600},d={color:t.primaryColor,borderRadius:t.borderRadius||"8px",fontWeight:600},{autoReload:g,reloadDelay:v=3e3}=e,x=((C=e.layoutSettings)==null?void 0:C.internalScroll)!==!1;if(z.useEffect(()=>{if(r.isCompleted&&g){const I=setTimeout(()=>{r.resetForm()},v);return()=>clearTimeout(I)}},[r.isCompleted,g,v,r.resetForm]),r.isCompleted)return n.jsxs("div",{className:_("flex flex-col items-center justify-center w-full p-8 text-center relative",x?"h-full overflow-hidden":"min-h-screen",(m=t.customClasses)==null?void 0:m.container),style:i,children:[g&&n.jsx(F.motion.div,{initial:{width:"0%"},animate:{width:"100%"},transition:{duration:v/1e3,ease:"linear"},className:"absolute top-0 left-0 h-1 bg-green-500 z-50"}),n.jsxs(F.motion.div,{initial:{scale:.9,opacity:0,y:20},animate:{scale:1,opacity:1,y:0},transition:{duration:.6,ease:[.22,1,.36,1]},className:"flex flex-col items-center",children:[n.jsx("div",{className:"mb-6 p-4 rounded-full bg-green-500/20 text-green-500 w-24 h-24 flex items-center justify-center",children:n.jsx(ee.Check,{size:48})}),n.jsx("h1",{className:"text-4xl md:text-5xl font-bold mb-4 tracking-tight",children:"Obrigado!"}),n.jsx("p",{className:"text-xl opacity-70 max-w-md leading-relaxed",children:"Suas respostas foram enviadas com sucesso."})]})]});const k=e.questions.find(I=>I.id===r.currentStepId),A=(e.questions.findIndex(I=>I.id===r.currentStepId)+1)/e.questions.length*100;return n.jsx(we.Provider,{value:O(w({},r),{schema:e}),children:n.jsxs("div",{className:_("w-full flex flex-col relative transition-colors duration-700",x?"h-full overflow-hidden":"min-h-screen",(f=t.customClasses)==null?void 0:f.container),style:i,children:[n.jsxs("div",{className:"absolute top-0 left-0 w-full h-1 z-50",children:[n.jsx("div",{className:"absolute top-0 left-0 w-full h-full bg-current opacity-10"}),n.jsx(F.motion.div,{className:"h-full relative z-10",initial:{width:0},animate:{width:`${A}%`},transition:{duration:.5,ease:"easeInOut"},style:{backgroundColor:t.primaryColor}})]}),n.jsxs("div",{className:_("flex-1 w-full relative z-10 flex flex-col px-6 md:px-12",x?"overflow-y-auto":""),style:{scrollbarWidth:"none"},children:[n.jsx("div",{className:"flex-1 flex-shrink-0 min-h-[2rem]"}),n.jsx("div",{className:"w-full max-w-5xl mx-auto py-4",children:n.jsx(F.AnimatePresence,{mode:"wait",children:k&&n.jsx(F.motion.div,{initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.5,ease:[.22,1,.36,1]},className:"w-full",children:n.jsx(Qt,{question:k})},k.id)})}),n.jsx("div",{className:"flex-1 flex-shrink-0 min-h-[2rem]"})]}),n.jsxs("div",{className:"w-full px-6 pt-6 pb-8 md:p-10 flex flex-col md:flex-row justify-between items-center z-20 gap-4",children:[t.showPoweredBy!==!1&&n.jsxs("a",{href:t.poweredByUrl||"#",target:t.poweredByUrl?"_blank":void 0,rel:t.poweredByUrl?"noopener noreferrer":void 0,className:"order-3 md:order-1 group flex items-center gap-2 px-3 py-1.5 rounded-md border border-white/10 bg-black/20 hover:border-sw-primary/50 hover:bg-black/40 transition-all duration-300 cursor-pointer no-underline backdrop-blur-sm",children:[n.jsx("span",{className:"text-[10px] md:text-xs font-mono font-medium tracking-[0.2em] uppercase text-muted-foreground group-hover:text-muted-foreground/80 transition-colors",children:"Powered By"}),n.jsx("span",{className:"text-[10px] md:text-xs font-mono font-bold tracking-[0.2em] uppercase transition-colors shadow-sw-primary",style:{color:t.brandColor||t.primaryColor},children:((y=t.poweredBy)==null?void 0:y.replace("Powered by ",""))||"SAWABONA TECH"})]}),n.jsxs("div",{className:"flex items-center gap-4 order-2 md:order-3 ml-auto",children:[n.jsx(F.motion.button,{onClick:r.prevStep,disabled:r.history.length===0,whileHover:{scale:1.05},whileTap:{scale:.95},className:_("w-12 h-12 md:w-14 md:h-14 flex items-center justify-center disabled:opacity-0 disabled:pointer-events-none transition-all hover:bg-white/5 rounded-full",(P=t.customClasses)==null?void 0:P.buttonSecondary),style:d,children:n.jsx(ee.ChevronLeft,{size:24})}),n.jsxs(F.motion.button,{onClick:r.nextStep,whileHover:{scale:1.02},whileTap:{scale:.98},className:_("px-8 py-3 md:px-10 md:py-4 text-lg font-bold shadow-2xl flex items-center gap-3 transition-all rounded-lg",($=t.customClasses)==null?void 0:$.buttonPrimary),style:u,children:[n.jsx("span",{children:r.currentStepId===e.questions[e.questions.length-1].id?t.submitText||s.submit:s.next}),r.currentStepId!==e.questions[e.questions.length-1].id&&n.jsx(ee.ChevronRight,{size:20,strokeWidth:3})]})]})]})]})})}S.FormRenderer=Xt,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sawabona/forms",
3
3
  "private": false,
4
- "version": "1.0.5",
4
+ "version": "1.0.7",
5
5
  "type": "module",
6
6
  "main": "./dist/sawabona-forms.umd.js",
7
7
  "module": "./dist/sawabona-forms.es.js",