@dipusevilla/componentes-iu 1.0.18 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -26,7 +26,7 @@ React keys must be passed directly to JSX without using spread:
26
26
  text-ds-lg`,children:r}),e&&o.jsx("div",{className:"flex items-center space-x-2",children:e})]}),o.jsx("main",{className:"flex-1 overflow-auto",children:t})]})}function os({options:r,value:e,onChange:t,children:s}){const n=b.useRef(null),[a,i]=b.useState({left:0,width:0});return b.useLayoutEffect(()=>{const l=n.current;if(!l)return;const c=()=>{const d=r.findIndex(T=>T.value===e);if(d<0)return;const f=l.children[d],h=f.querySelector("span"),m=(h==null?void 0:h.offsetWidth)??f.offsetWidth,g=f.offsetWidth,j=f.offsetLeft+(g-m)/2;i({left:j,width:m})};return c(),window.addEventListener("resize",c),l.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),l.removeEventListener("scroll",c)}},[e,r]),o.jsxs("div",{children:[o.jsxs("div",{className:"relative",children:[o.jsx("ul",{ref:n,role:"tablist",className:"flex justify-center overflow-x-auto border-b border-[var(--color-ds-border-default-50)]",children:r.map(l=>{const c=l.value===e;return o.jsx("li",{role:"tab","aria-selected":c,onClick:()=>t(l.value),className:D("cursor-pointer whitespace-nowrap px-4 py-2 transition-colors duration-150 ease-in-out",c?"text-[var(--color-ds-background-accent)]":"text-[var(--color-ds-text-primary)]"),children:o.jsx("span",{className:"inline-block",children:l.label})},l.value)})}),o.jsx("span",{className:"absolute bottom-0 h-1 bg-[var(--color-ds-background-accent)] transition-all duration-200 ease-in-out rounded-t-full",style:{left:a.left,width:a.width}})]}),o.jsx("div",{className:"mt-4 pb-4 border-b border-[var(--color-ds-border-default-50)]",children:s[e]})]})}const Ct={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},ha={sm:"h-6",md:"h-10",lg:"h-12"},ma={sm:"px-2",md:"px-2.5",lg:"px-3"},vr={sm:"1.5rem",md:"2.5rem",lg:"3rem"};function br(r,e,t,s,n,a,i,l,c){return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"relative flex items-center w-full",children:[o.jsx("select",{id:r,...s,disabled:n,className:D("box-border w-full rounded-lg border bg-[var(--color-ds-background-page)] outline-none transition font-[var(--font-primary)]",Ct[t],ha[t],ma[t],a?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",n?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-primary)] cursor-not-allowed":"text-[var(--color-ds-text-primary)]",l),children:e.map(d=>o.jsx("option",{value:d.value,className:"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",children:d.label},d.value))}),c&&o.jsx("div",{className:"flex items-center h-full pr-2",children:c})]}),!i&&o.jsx("div",{className:"min-h-[18px] w-full",children:a!=null&&a.message?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:a.message}):o.jsx("span",{"aria-hidden":"true",children:" "})})]})}function Xe(r){const{control:e,name:t,rules:s,defaultValue:n,options:a=[],loadOptions:i,reloadDeps:l=[],value:c,onChange:d,size:f="sm",width:h="100%",label:m,labelHidden:g=!1,hasError:F=!1,errorMessage:j="",disableErrorPlaceholder:T=!1,disabled:y=!1,className:v,suffixButton:k}=r,A=b.useId(),S=t||A,[I,q]=b.useState(a),[Z,z]=b.useState(!!i);if(b.useEffect(()=>{i&&(z(!0),i().then(U=>q(U)).finally(()=>z(!1)))},[i,...l]),b.useEffect(()=>{!e&&I.length>0&&(c===void 0||c===""||!I.some(U=>U.value===c))&&(d==null||d(I[0].value))},[I,c,d,e]),e&&t){const{field:U,fieldState:R}=Hr({name:t,control:e,rules:s,defaultValue:n});return b.useEffect(()=>{if(!Z&&I.length>0){const L=U.value;(L===void 0||!I.some(B=>B.value===L))&&U.onChange(I[0].value)}},[I,Z,U]),o.jsxs("div",{className:D("flex flex-col",v),style:{width:h,maxWidth:"100%"},children:[m&&o.jsx("label",{htmlFor:S,className:D("pb-2 text-[var(--color-ds-text-primary)]",Ct[f],g&&"sr-only"),children:m}),Z?o.jsx(Me,{width:"100%",height:vr[f],variant:"rect",className:"rounded-lg"}):br(S,I,f,{value:U.value,onChange:L=>U.onChange(L.target.value)},y,R.error,T,v,k)]})}return o.jsxs("div",{className:D("flex flex-col",v),style:{width:h,maxWidth:"100%"},children:[m&&o.jsx("label",{htmlFor:S,className:D("pb-2 text-[var(--color-ds-text-primary)]",Ct[f],g&&"sr-only"),children:m}),Z?o.jsx(Me,{width:"100%",height:vr[f],variant:"rect",className:"rounded-lg"}):br(S,I,f,{value:c,onChange:U=>d==null?void 0:d(U.target.value)},y,F?{message:j}:void 0,T,v,k)]})}const yr={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"};function ls({groupLabel:r,inputs:e=[],separator:t=o.jsx("span",{className:"px-1 select-none",children:"/"}),useSeparator:s=!0,className:n,showVisibleLabel:a=!1,size:i="sm",width:l}){const c=e.length;return o.jsxs("div",{className:D("flex flex-col",n),style:l?{width:l}:void 0,children:[o.jsx("label",{className:D("sr-only pb-2",yr[i]),children:r}),a&&o.jsx("label",{className:D("pb-2",yr[i]),children:r}),o.jsx("div",{className:"flex items-center flex-nowrap",children:e.map((d,f)=>{const{width:h,className:m,options:g,loadOptions:F,...j}=d,T=Array.isArray(g)||typeof F=="function";let y="rounded-lg";!s&&c>1&&(f===0?y="rounded-l-lg rounded-r-none":f===c-1?y="rounded-r-lg rounded-l-none":y="rounded-none");const v=D("inline-flex items-center flex-shrink-0 overflow-hidden",typeof h=="string"&&h.startsWith("w-")?h:void 0),k=typeof h=="string"&&!h.startsWith("w-")?{width:h}:void 0,A=D(m,y);return o.jsxs("div",{className:v,style:k,children:[T?o.jsx(Xe,{...j,size:i,className:A,options:g,loadOptions:F}):o.jsx(vt,{...j,size:i,className:A}),s&&f<c-1&&t]},f)})})]})}const wr={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},xa={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function cs({groupLabel:r,options:e,control:t,name:s,rules:n,defaultValue:a,multiple:i=!0,size:l="sm",vertical:c=!0,className:d,showVisibleLabel:f=!0}){return o.jsx(je,{name:s,control:t,rules:n,defaultValue:a,render:({field:h,fieldState:m})=>{const{value:g,onChange:F}=h;m.error;const j=y=>i?Array.isArray(g)&&g.includes(y):g===y,T=y=>{if(i){const v=Array.isArray(g)?[...g]:[],k=v.indexOf(y);k>=0?v.splice(k,1):v.push(y),F(v)}else F(y)};return o.jsxs("div",{className:D("w-full",d),children:[o.jsx("label",{className:D("sr-only pb-2 text-[var(--color-ds-text-primary)]",wr[l]),children:r}),f&&o.jsx("label",{className:D("block pb-2 text-[var(--color-ds-text-primary)]",wr[l]),children:r}),o.jsx("div",{className:D(c?"flex flex-col gap-2":"flex flex-wrap gap-4"),children:e.map(y=>o.jsxs("label",{className:"inline-flex items-center space-x-2 cursor-pointer select-none",children:[o.jsx("input",{type:i?"checkbox":"radio",name:s,value:y.value,checked:j(y.value),onChange:()=>T(y.value),className:D(xa[l],"text-[var(--color-ds-button-primary-bg)]","border-[var(--color-ds-border-default)]")}),o.jsx("span",{className:"text-[var(--color-ds-text-primary)] text-ds-md",children:y.label})]},y.value))})]})}})}function pa(r){function e(i){var l,c;for(const d of Object.keys(i)){if((l=i[d])!=null&&l.types||(c=i[d])!=null&&c.message)return d;if(typeof i[d]=="object"){const f=e(i[d]);if(f)return`${d}.${f}`}}return null}const t=e(r);if(!t)return;const s=`[name="${t}"]`,n=`[name^="${t}["], [name^="${t}."]`,a=document.querySelector(s)??document.querySelector(n);a&&(a.scrollIntoView({behavior:"smooth",block:"center"}),a.focus({preventScroll:!0}))}const ga={success:"bg-green-100 border-green-500 text-green-800",error:"bg-red-100 border-red-500 text-red-800",info:"bg-blue-100 border-blue-500 text-blue-800",warning:"bg-yellow-100 border-yellow-500 text-yellow-800"},us=({id:r,message:e,variant:t="info",duration:s=5e3,onClose:n})=>(b.useEffect(()=>{const a=setTimeout(()=>n(r),s);return()=>clearTimeout(a)},[r,s,n]),o.jsxs("div",{className:D("w-80 max-w-full border-l-4 rounded shadow-md p-4 mb-2 flex justify-between items-start",ga[t]),role:"alert","aria-live":"assertive",children:[o.jsx("span",{className:"flex-1",children:e}),o.jsx("button",{onClick:()=>n(r),className:"ml-4 text-xl font-bold leading-none focus:outline-none",children:"×"})]}));let nt;const va=new Uint8Array(16);function ba(){if(!nt&&(nt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!nt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return nt(va)}const ue=[];for(let r=0;r<256;++r)ue.push((r+256).toString(16).slice(1));function ya(r,e=0){return ue[r[e+0]]+ue[r[e+1]]+ue[r[e+2]]+ue[r[e+3]]+"-"+ue[r[e+4]]+ue[r[e+5]]+"-"+ue[r[e+6]]+ue[r[e+7]]+"-"+ue[r[e+8]]+ue[r[e+9]]+"-"+ue[r[e+10]]+ue[r[e+11]]+ue[r[e+12]]+ue[r[e+13]]+ue[r[e+14]]+ue[r[e+15]]}const wa=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),jr={randomUUID:wa};function ja(r,e,t){if(jr.randomUUID&&!r)return jr.randomUUID();r=r||{};const s=r.random||(r.rng||ba)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,ya(s)}const ds=b.createContext(null),fs=()=>{const r=b.useContext(ds);if(!r)throw new Error("useToast debe usarse dentro de <ToastProvider>");return r},ka=({children:r})=>{const[e,t]=b.useState([]),s=(a,i="info",l=5e3)=>{const c=ja();t(d=>[...d,{id:c,message:a,variant:i,duration:l}])},n=a=>{t(i=>i.filter(l=>l.id!==a))};return o.jsxs(ds.Provider,{value:{show:s},children:[r,o.jsx("div",{className:"fixed top-4 right-4 z-50 flex flex-col items-end",children:e.map(a=>o.jsx(us,{id:a.id,message:a.message,variant:a.variant,duration:a.duration,onClose:n},a.id))})]})},kr=(r,e,t)=>{if(r&&"reportValidity"in r){const s=C(t,e);r.setCustomValidity(s&&s.message||""),r.reportValidity()}},hs=(r,e)=>{for(const t in e.fields){const s=e.fields[t];s&&s.ref&&"reportValidity"in s.ref?kr(s.ref,t,r):s&&s.refs&&s.refs.forEach(n=>kr(n,t,r))}},Ea=(r,e)=>{e.shouldUseNativeValidation&&hs(r,e);const t={};for(const s in r){const n=C(e.fields,s),a=Object.assign(r[s]||{},{ref:n&&n.ref});if(_a(e.names||Object.keys(r),s)){const i=Object.assign({},C(t,s));ee(i,"root",a),ee(t,s,i)}else ee(t,s,a)}return t},_a=(r,e)=>{const t=Er(e);return r.some(s=>Er(s).match(`^${t}\\.\\d+`))};function Er(r){return r.replace(/\]|\[/g,"")}function _r(r,e,t){return t===void 0&&(t={}),function(s,n,a){try{return Promise.resolve(function(i,l){try{var c=(e!=null&&e.context&&process.env.NODE_ENV==="development"&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(r[t.mode==="sync"?"validateSync":"validate"](s,Object.assign({abortEarly:!1},e,{context:n}))).then(function(d){return a.shouldUseNativeValidation&&hs({},a),{values:t.raw?Object.assign({},s):d,errors:{}}}))}catch(d){return l(d)}return c&&c.then?c.then(void 0,l):c}(0,function(i){if(!i.inner)throw i;return{values:{},errors:Ea((l=i,c=!a.shouldUseNativeValidation&&a.criteriaMode==="all",(l.inner||[]).reduce(function(d,f){if(d[f.path]||(d[f.path]={message:f.message,type:f.type}),c){var h=d[f.path].types,m=h&&h[f.type];d[f.path]=Yr(f.path,c,d,f.type,m?[].concat(m,f.message):f.message)}return d},{})),a)};var l,c}))}catch(i){return Promise.reject(i)}}}var kt,Nr;function Na(){if(Nr)return kt;Nr=1;function r(y){this._maxSize=y,this.clear()}r.prototype.clear=function(){this._size=0,this._values=Object.create(null)},r.prototype.get=function(y){return this._values[y]},r.prototype.set=function(y,v){return this._size>=this._maxSize&&this.clear(),y in this._values||this._size++,this._values[y]=v};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,t=/^\d+$/,s=/^\d/,n=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,a=/^\s*(['"]?)(.*?)(\1)\s*$/,i=512,l=new r(i),c=new r(i),d=new r(i);kt={Cache:r,split:h,normalizePath:f,setter:function(y){var v=f(y);return c.get(y)||c.set(y,function(A,S){for(var I=0,q=v.length,Z=A;I<q-1;){var z=v[I];if(z==="__proto__"||z==="constructor"||z==="prototype")return A;Z=Z[v[I++]]}Z[v[I]]=S})},getter:function(y,v){var k=f(y);return d.get(y)||d.set(y,function(S){for(var I=0,q=k.length;I<q;)if(S!=null||!v)S=S[k[I++]];else return;return S})},join:function(y){return y.reduce(function(v,k){return v+(g(k)||t.test(k)?"["+k+"]":(v?".":"")+k)},"")},forEach:function(y,v,k){m(Array.isArray(y)?y:h(y),v,k)}};function f(y){return l.get(y)||l.set(y,h(y).map(function(v){return v.replace(a,"$2")}))}function h(y){return y.match(e)||[""]}function m(y,v,k){var A=y.length,S,I,q,Z;for(I=0;I<A;I++)S=y[I],S&&(T(S)&&(S='"'+S+'"'),Z=g(S),q=!Z&&/^\d+$/.test(S),v.call(k,S,Z,q,I,y))}function g(y){return typeof y=="string"&&y&&["'",'"'].indexOf(y.charAt(0))!==-1}function F(y){return y.match(s)&&!y.match(t)}function j(y){return n.test(y)}function T(y){return!g(y)&&(F(y)||j(y))}return kt}var Ve=Na(),Et,Fr;function Fa(){if(Fr)return Et;Fr=1;const r=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,e=f=>f.match(r)||[],t=f=>f[0].toUpperCase()+f.slice(1),s=(f,h)=>e(f).join(h).toLowerCase(),n=f=>e(f).reduce((h,m)=>`${h}${h?m[0].toUpperCase()+m.slice(1).toLowerCase():m.toLowerCase()}`,"");return Et={words:e,upperFirst:t,camelCase:n,pascalCase:f=>t(n(f)),snakeCase:f=>s(f,"_"),kebabCase:f=>s(f,"-"),sentenceCase:f=>t(s(f," ")),titleCase:f=>e(f).map(t).join(" ")},Et}var _t=Fa(),at={exports:{}},Sr;function Sa(){if(Sr)return at.exports;Sr=1,at.exports=function(n){return r(e(n),n)},at.exports.array=r;function r(n,a){var i=n.length,l=new Array(i),c={},d=i,f=t(a),h=s(n);for(a.forEach(function(g){if(!h.has(g[0])||!h.has(g[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});d--;)c[d]||m(n[d],d,new Set);return l;function m(g,F,j){if(j.has(g)){var T;try{T=", node was:"+JSON.stringify(g)}catch{T=""}throw new Error("Cyclic dependency"+T)}if(!h.has(g))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(g));if(!c[F]){c[F]=!0;var y=f.get(g)||new Set;if(y=Array.from(y),F=y.length){j.add(g);do{var v=y[--F];m(v,h.get(v),j)}while(F);j.delete(g)}l[--i]=g}}}function e(n){for(var a=new Set,i=0,l=n.length;i<l;i++){var c=n[i];a.add(c[0]),a.add(c[1])}return Array.from(a)}function t(n){for(var a=new Map,i=0,l=n.length;i<l;i++){var c=n[i];a.has(c[0])||a.set(c[0],new Set),a.has(c[1])||a.set(c[1],new Set),a.get(c[0]).add(c[1])}return a}function s(n){for(var a=new Map,i=0,l=n.length;i<l;i++)a.set(n[i],i);return a}return at.exports}var Ta=Sa();const Oa=Bs(Ta),Ca=Object.prototype.toString,Aa=Error.prototype.toString,$a=RegExp.prototype.toString,Da=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Ra=/^Symbol\((.*)\)(.*)$/;function Va(r){return r!=+r?"NaN":r===0&&1/r<0?"-0":""+r}function Tr(r,e=!1){if(r==null||r===!0||r===!1)return""+r;const t=typeof r;if(t==="number")return Va(r);if(t==="string")return e?`"${r}"`:r;if(t==="function")return"[Function "+(r.name||"anonymous")+"]";if(t==="symbol")return Da.call(r).replace(Ra,"Symbol($1)");const s=Ca.call(r).slice(8,-1);return s==="Date"?isNaN(r.getTime())?""+r:r.toISOString(r):s==="Error"||r instanceof Error?"["+Aa.call(r)+"]":s==="RegExp"?$a.call(r):null}function $e(r,e){let t=Tr(r,e);return t!==null?t:JSON.stringify(r,function(s,n){let a=Tr(this[s],e);return a!==null?a:n},2)}function ms(r){return r==null?[]:[].concat(r)}let xs,ps,gs,Ma=/\$\{\s*(\w+)\s*\}/g;xs=Symbol.toStringTag;class Or{constructor(e,t,s,n){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[xs]="Error",this.name="ValidationError",this.value=t,this.path=s,this.type=n,this.errors=[],this.inner=[],ms(e).forEach(a=>{if(xe.isError(a)){this.errors.push(...a.errors);const i=a.inner.length?a.inner:[a];this.inner.push(...i)}else this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}ps=Symbol.hasInstance;gs=Symbol.toStringTag;class xe extends Error{static formatError(e,t){const s=t.label||t.path||"this";return t=Object.assign({},t,{path:s,originalPath:t.path}),typeof e=="string"?e.replace(Ma,(n,a)=>$e(t[a])):typeof e=="function"?e(t):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,t,s,n,a){const i=new Or(e,t,s,n);if(a)return i;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[gs]="Error",this.name=i.name,this.message=i.message,this.type=i.type,this.value=i.value,this.path=i.path,this.errors=i.errors,this.inner=i.inner,Error.captureStackTrace&&Error.captureStackTrace(this,xe)}static[ps](e){return Or[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let ke={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:r,type:e,value:t,originalValue:s})=>{const n=s!=null&&s!==t?` (cast from the value \`${$e(s,!0)}\`).`:".";return e!=="mixed"?`${r} must be a \`${e}\` type, but the final value was: \`${$e(t,!0)}\``+n:`${r} must match the configured type. The validated value was: \`${$e(t,!0)}\``+n}},me={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Ce={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},At={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},La={isValue:"${path} field must be ${value}"},lt={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Ia={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},Pa={notType:r=>{const{path:e,value:t,spec:s}=r,n=s.types.length;if(Array.isArray(t)){if(t.length<n)return`${e} tuple value has too few items, expected a length of ${n} but got ${t.length} for value: \`${$e(t,!0)}\``;if(t.length>n)return`${e} tuple value has too many items, expected a length of ${n} but got ${t.length} for value: \`${$e(t,!0)}\``}return xe.formatError(ke.notType,r)}};Object.assign(Object.create(null),{mixed:ke,string:me,number:Ce,date:At,object:lt,array:Ia,boolean:La,tuple:Pa});const Zt=r=>r&&r.__isYupSchema__;class xt{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:s,then:n,otherwise:a}=t,i=typeof s=="function"?s:(...l)=>l.every(c=>c===s);return new xt(e,(l,c)=>{var d;let f=i(...l)?n:a;return(d=f==null?void 0:f(c))!=null?d:c})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let s=this.refs.map(a=>a.getValue(t==null?void 0:t.value,t==null?void 0:t.parent,t==null?void 0:t.context)),n=this.fn(s,e,t);if(n===void 0||n===e)return e;if(!Zt(n))throw new TypeError("conditions must return a schema object");return n.resolve(t)}}const it={context:"$",value:"."};class Le{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===it.context,this.isValue=this.key[0]===it.value,this.isSibling=!this.isContext&&!this.isValue;let s=this.isContext?it.context:this.isValue?it.value:"";this.path=this.key.slice(s.length),this.getter=this.path&&Ve.getter(this.path,!0),this.map=t.map}getValue(e,t,s){let n=this.isContext?s:this.isValue?e:t;return this.getter&&(n=this.getter(n||{})),this.map&&(n=this.map(n)),n}cast(e,t){return this.getValue(e,t==null?void 0:t.parent,t==null?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Le.prototype.__isYupRef=!0;const Se=r=>r==null;function Ue(r){function e({value:t,path:s="",options:n,originalValue:a,schema:i},l,c){const{name:d,test:f,params:h,message:m,skipAbsent:g}=r;let{parent:F,context:j,abortEarly:T=i.spec.abortEarly,disableStackTrace:y=i.spec.disableStackTrace}=n;function v(R){return Le.isRef(R)?R.getValue(t,F,j):R}function k(R={}){const L=Object.assign({value:t,originalValue:a,label:i.spec.label,path:R.path||s,spec:i.spec,disableStackTrace:R.disableStackTrace||y},h,R.params);for(const W of Object.keys(L))L[W]=v(L[W]);const B=new xe(xe.formatError(R.message||m,L),t,L.path,R.type||d,L.disableStackTrace);return B.params=L,B}const A=T?l:c;let S={path:s,parent:F,type:d,from:n.from,createError:k,resolve:v,options:n,originalValue:a,schema:i};const I=R=>{xe.isError(R)?A(R):R?c(null):A(k())},q=R=>{xe.isError(R)?A(R):l(R)};if(g&&Se(t))return I(!0);let z;try{var U;if(z=f.call(S,t,S),typeof((U=z)==null?void 0:U.then)=="function"){if(n.sync)throw new Error(`Validation test of type: "${S.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(z).then(I,q)}}catch(R){q(R);return}I(z)}return e.OPTIONS=r,e}function Ua(r,e,t,s=t){let n,a,i;return e?(Ve.forEach(e,(l,c,d)=>{let f=c?l.slice(1,l.length-1):l;r=r.resolve({context:s,parent:n,value:t});let h=r.type==="tuple",m=d?parseInt(f,10):0;if(r.innerType||h){if(h&&!d)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${i}" must contain an index to the tuple element, e.g. "${i}[0]"`);if(t&&m>=t.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${l}, in the path: ${e}. because there is no value at that index. `);n=t,t=t&&t[m],r=h?r.spec.types[m]:r.innerType}if(!d){if(!r.fields||!r.fields[f])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${i} which is a type: "${r.type}")`);n=t,t=t&&t[f],r=r.fields[f]}a=f,i=c?"["+l+"]":"."+l}),{schema:r,parent:n,parentPath:a}):{parent:n,parentPath:e,schema:r}}class pt extends Set{describe(){const e=[];for(const t of this.values())e.push(Le.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const s of this.values())t.push(e(s));return t}clone(){return new pt(this.values())}merge(e,t){const s=this.clone();return e.forEach(n=>s.add(n)),t.forEach(n=>s.delete(n)),s}}function Be(r,e=new Map){if(Zt(r)||!r||typeof r!="object")return r;if(e.has(r))return e.get(r);let t;if(r instanceof Date)t=new Date(r.getTime()),e.set(r,t);else if(r instanceof RegExp)t=new RegExp(r),e.set(r,t);else if(Array.isArray(r)){t=new Array(r.length),e.set(r,t);for(let s=0;s<r.length;s++)t[s]=Be(r[s],e)}else if(r instanceof Map){t=new Map,e.set(r,t);for(const[s,n]of r.entries())t.set(s,Be(n,e))}else if(r instanceof Set){t=new Set,e.set(r,t);for(const s of r)t.add(Be(s,e))}else if(r instanceof Object){t={},e.set(r,t);for(const[s,n]of Object.entries(r))t[s]=Be(n,e)}else throw Error(`Unable to clone ${r}`);return t}class be{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new pt,this._blacklist=new pt,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(ke.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(t=>{t.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=Be(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(e.length===0)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let s=e(this);return this._mutate=t,s}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,s=e.clone();const n=Object.assign({},t.spec,s.spec);return s.spec=n,s.internalTests=Object.assign({},t.internalTests,s.internalTests),s._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),s._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),s.tests=t.tests,s.exclusiveTests=t.exclusiveTests,s.withMutation(a=>{e.tests.forEach(i=>{a.test(i.OPTIONS)})}),s.transforms=[...t.transforms,...s.transforms],s}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let s=t.conditions;t=t.clone(),t.conditions=[],t=s.reduce((n,a)=>a.resolve(n,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,s,n,a;return Object.assign({},e,{from:e.from||[],strict:(t=e.strict)!=null?t:this.spec.strict,abortEarly:(s=e.abortEarly)!=null?s:this.spec.abortEarly,recursive:(n=e.recursive)!=null?n:this.spec.recursive,disableStackTrace:(a=e.disableStackTrace)!=null?a:this.spec.disableStackTrace})}cast(e,t={}){let s=this.resolve(Object.assign({value:e},t)),n=t.assert==="ignore-optionality",a=s._cast(e,t);if(t.assert!==!1&&!s.isType(a)){if(n&&Se(a))return a;let i=$e(e),l=$e(a);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${s.type}".
27
27
 
28
28
  attempted value: ${i}
29
- `+(l!==i?`result of cast: ${l}`:""))}return a}_cast(e,t){let s=e===void 0?e:this.transforms.reduce((n,a)=>a.call(this,n,e,this),e);return s===void 0&&(s=this.getDefault(t)),s}_validate(e,t={},s,n){let{path:a,originalValue:i=e,strict:l=this.spec.strict}=t,c=e;l||(c=this._cast(c,Object.assign({assert:!1},t)));let d=[];for(let f of Object.values(this.internalTests))f&&d.push(f);this.runTests({path:a,value:c,originalValue:i,options:t,tests:d},s,f=>{if(f.length)return n(f,c);this.runTests({path:a,value:c,originalValue:i,options:t,tests:this.tests},s,n)})}runTests(e,t,s){let n=!1,{tests:a,value:i,originalValue:l,path:c,options:d}=e,f=j=>{n||(n=!0,t(j,i))},h=j=>{n||(n=!0,s(j,i))},m=a.length,g=[];if(!m)return h([]);let F={value:i,originalValue:l,path:c,options:d,schema:this};for(let j=0;j<a.length;j++){const T=a[j];T(F,f,function(v){v&&(Array.isArray(v)?g.push(...v):g.push(v)),--m<=0&&h(g)})}}asNestedTest({key:e,index:t,parent:s,parentPath:n,originalParent:a,options:i}){const l=e??t;if(l==null)throw TypeError("Must include `key` or `index` for nested validations");const c=typeof l=="number";let d=s[l];const f=Object.assign({},i,{strict:!0,parent:s,value:d,originalValue:a[l],key:void 0,[c?"index":"key"]:l,path:c||l.includes(".")?`${n||""}[${c?l:`"${l}"`}]`:(n?`${n}.`:"")+e});return(h,m,g)=>this.resolve(f)._validate(d,f,m,g)}validate(e,t){var s;let n=this.resolve(Object.assign({},t,{value:e})),a=(s=t==null?void 0:t.disableStackTrace)!=null?s:n.spec.disableStackTrace;return new Promise((i,l)=>n._validate(e,t,(c,d)=>{xe.isError(c)&&(c.value=d),l(c)},(c,d)=>{c.length?l(new xe(c,d,void 0,void 0,a)):i(d)}))}validateSync(e,t){var s;let n=this.resolve(Object.assign({},t,{value:e})),a,i=(s=t==null?void 0:t.disableStackTrace)!=null?s:n.spec.disableStackTrace;return n._validate(e,Object.assign({},t,{sync:!0}),(l,c)=>{throw xe.isError(l)&&(l.value=c),l},(l,c)=>{if(l.length)throw new xe(l,e,void 0,void 0,i);a=c}),a}isValid(e,t){return this.validate(e,t).then(()=>!0,s=>{if(xe.isError(s))return!1;throw s})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(s){if(xe.isError(s))return!1;throw s}}_getDefault(e){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this,e):Be(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const s=this.clone({nullable:e});return s.internalTests.nullable=Ue({message:t,name:"nullable",test(n){return n===null?this.schema.spec.nullable:!0}}),s}optionality(e,t){const s=this.clone({optional:e});return s.internalTests.optionality=Ue({message:t,name:"optionality",test(n){return n===void 0?this.schema.spec.optional:!0}}),s}optional(){return this.optionality(!0)}defined(e=ke.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=ke.notNull){return this.nullability(!1,e)}required(e=ke.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(e.length===1?typeof e[0]=="function"?t={test:e[0]}:t=e[0]:e.length===2?t={name:e[0],test:e[1]}:t={name:e[0],message:e[1],test:e[2]},t.message===void 0&&(t.message=ke.default),typeof t.test!="function")throw new TypeError("`test` is a required parameters");let s=this.clone(),n=Ue(t),a=t.exclusive||t.name&&s.exclusiveTests[t.name]===!0;if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(s.exclusiveTests[t.name]=!!t.exclusive),s.tests=s.tests.filter(i=>!(i.OPTIONS.name===t.name&&(a||i.OPTIONS.test===n.OPTIONS.test))),s.tests.push(n),s}when(e,t){!Array.isArray(e)&&typeof e!="string"&&(t=e,e=".");let s=this.clone(),n=ms(e).map(a=>new Le(a));return n.forEach(a=>{a.isSibling&&s.deps.push(a.key)}),s.conditions.push(typeof t=="function"?new xt(n,t):xt.fromOptions(n,t)),s}typeError(e){let t=this.clone();return t.internalTests.typeError=Ue({message:e,name:"typeError",skipAbsent:!0,test(s){return this.schema._typeCheck(s)?!0:this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=ke.oneOf){let s=this.clone();return e.forEach(n=>{s._whitelist.add(n),s._blacklist.delete(n)}),s.internalTests.whiteList=Ue({message:t,name:"oneOf",skipAbsent:!0,test(n){let a=this.schema._whitelist,i=a.resolveAll(this.resolve);return i.includes(n)?!0:this.createError({params:{values:Array.from(a).join(", "),resolved:i}})}}),s}notOneOf(e,t=ke.notOneOf){let s=this.clone();return e.forEach(n=>{s._blacklist.add(n),s._whitelist.delete(n)}),s.internalTests.blacklist=Ue({message:t,name:"notOneOf",test(n){let a=this.schema._blacklist,i=a.resolveAll(this.resolve);return i.includes(n)?this.createError({params:{values:Array.from(a).join(", "),resolved:i}}):!0}}),s}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:s,meta:n,optional:a,nullable:i}=t.spec;return{meta:n,label:s,optional:a,nullable:i,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.map(c=>({name:c.OPTIONS.name,params:c.OPTIONS.params})).filter((c,d,f)=>f.findIndex(h=>h.name===c.name)===d)}}}be.prototype.__isYupSchema__=!0;for(const r of["validate","validateSync"])be.prototype[`${r}At`]=function(e,t,s={}){const{parent:n,parentPath:a,schema:i}=Ua(this,e,t,s.context);return i[r](n&&n[a],Object.assign({},s,{parent:n,path:e}))};for(const r of["equals","is"])be.prototype[r]=be.prototype.oneOf;for(const r of["not","nope"])be.prototype[r]=be.prototype.notOneOf;const Ba=()=>!0;function $t(r){return new vs(r)}class vs extends be{constructor(e){super(typeof e=="function"?{type:"mixed",check:e}:Object.assign({type:"mixed",check:Ba},e))}}$t.prototype=vs.prototype;const Za=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function za(r){const e=Dt(r);if(!e)return Date.parse?Date.parse(r):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let t=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(t=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(t=0-t)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+t,e.second,e.millisecond)}function Dt(r){var e,t;const s=Za.exec(r);return s?{year:Fe(s[1]),month:Fe(s[2],1)-1,day:Fe(s[3],1),hour:Fe(s[4]),minute:Fe(s[5]),second:Fe(s[6]),millisecond:s[7]?Fe(s[7].substring(0,3)):0,precision:(e=(t=s[7])==null?void 0:t.length)!=null?e:void 0,z:s[8]||void 0,plusMinus:s[9]||void 0,hourOffset:Fe(s[10]),minuteOffset:Fe(s[11])}:null}function Fe(r,e=0){return Number(r)||e}let Wa=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,qa=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Ha=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Ya="^\\d{4}-\\d{2}-\\d{2}",Ga="\\d{2}:\\d{2}:\\d{2}",Xa="(([+-]\\d{2}(:?\\d{2})?)|Z)",Ja=new RegExp(`${Ya}T${Ga}(\\.\\d+)?${Xa}$`),Ka=r=>Se(r)||r===r.trim(),Qa={}.toString();function bs(){return new ys}class ys extends be{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,t,s)=>{if(!s.spec.coerce||s.isType(e)||Array.isArray(e))return e;const n=e!=null&&e.toString?e.toString():e;return n===Qa?e:n})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||ke.required,name:"required",skipAbsent:!0,test:s=>!!s.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(t=>t.OPTIONS.name!=="required"),e))}length(e,t=me.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(s){return s.length===this.resolve(e)}})}min(e,t=me.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s.length>=this.resolve(e)}})}max(e,t=me.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(s){return s.length<=this.resolve(e)}})}matches(e,t){let s=!1,n,a;return t&&(typeof t=="object"?{excludeEmptyString:s=!1,message:n,name:a}=t:n=t),this.test({name:a||"matches",message:n||me.matches,params:{regex:e},skipAbsent:!0,test:i=>i===""&&s||i.search(e)!==-1})}email(e=me.email){return this.matches(Wa,{name:"email",message:e,excludeEmptyString:!0})}url(e=me.url){return this.matches(qa,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=me.uuid){return this.matches(Ha,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t="",s,n;return e&&(typeof e=="object"?{message:t="",allowOffset:s=!1,precision:n=void 0}=e:t=e),this.matches(Ja,{name:"datetime",message:t||me.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:t||me.datetime_offset,params:{allowOffset:s},skipAbsent:!0,test:a=>{if(!a||s)return!0;const i=Dt(a);return i?!!i.z:!1}}).test({name:"datetime_precision",message:t||me.datetime_precision,params:{precision:n},skipAbsent:!0,test:a=>{if(!a||n==null)return!0;const i=Dt(a);return i?i.precision===n:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=me.trim){return this.transform(t=>t!=null?t.trim():t).test({message:e,name:"trim",test:Ka})}lowercase(e=me.lowercase){return this.transform(t=>Se(t)?t:t.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Se(t)||t===t.toLowerCase()})}uppercase(e=me.uppercase){return this.transform(t=>Se(t)?t:t.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Se(t)||t===t.toUpperCase()})}}bs.prototype=ys.prototype;let ei=r=>r!=+r;function ws(){return new js}class js extends be{constructor(){super({type:"number",check(e){return e instanceof Number&&(e=e.valueOf()),typeof e=="number"&&!ei(e)}}),this.withMutation(()=>{this.transform((e,t,s)=>{if(!s.spec.coerce)return e;let n=e;if(typeof n=="string"){if(n=n.replace(/\s/g,""),n==="")return NaN;n=+n}return s.isType(n)||n===null?n:parseFloat(n)})})}min(e,t=Ce.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s>=this.resolve(e)}})}max(e,t=Ce.max){return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(s){return s<=this.resolve(e)}})}lessThan(e,t=Ce.lessThan){return this.test({message:t,name:"max",exclusive:!0,params:{less:e},skipAbsent:!0,test(s){return s<this.resolve(e)}})}moreThan(e,t=Ce.moreThan){return this.test({message:t,name:"min",exclusive:!0,params:{more:e},skipAbsent:!0,test(s){return s>this.resolve(e)}})}positive(e=Ce.positive){return this.moreThan(0,e)}negative(e=Ce.negative){return this.lessThan(0,e)}integer(e=Ce.integer){return this.test({name:"integer",message:e,skipAbsent:!0,test:t=>Number.isInteger(t)})}truncate(){return this.transform(e=>Se(e)?e:e|0)}round(e){var t;let s=["ceil","floor","round","trunc"];if(e=((t=e)==null?void 0:t.toLowerCase())||"round",e==="trunc")return this.truncate();if(s.indexOf(e.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+s.join(", "));return this.transform(n=>Se(n)?n:Math[e](n))}}ws.prototype=js.prototype;let ks=new Date(""),ti=r=>Object.prototype.toString.call(r)==="[object Date]";function zt(){return new Qe}class Qe extends be{constructor(){super({type:"date",check(e){return ti(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,t,s)=>!s.spec.coerce||s.isType(e)||e===null?e:(e=za(e),isNaN(e)?Qe.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let s;if(Le.isRef(e))s=e;else{let n=this.cast(e);if(!this._typeCheck(n))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);s=n}return s}min(e,t=At.min){let s=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(n){return n>=this.resolve(s)}})}max(e,t=At.max){let s=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(n){return n<=this.resolve(s)}})}}Qe.INVALID_DATE=ks;zt.prototype=Qe.prototype;zt.INVALID_DATE=ks;function ri(r,e=[]){let t=[],s=new Set,n=new Set(e.map(([i,l])=>`${i}-${l}`));function a(i,l){let c=Ve.split(i)[0];s.add(c),n.has(`${l}-${c}`)||t.push([l,c])}for(const i of Object.keys(r)){let l=r[i];s.add(i),Le.isRef(l)&&l.isSibling?a(l.path,i):Zt(l)&&"deps"in l&&l.deps.forEach(c=>a(c,i))}return Oa.array(Array.from(s),t).reverse()}function Cr(r,e){let t=1/0;return r.some((s,n)=>{var a;if((a=e.path)!=null&&a.includes(s))return t=n,!0}),t}function Es(r){return(e,t)=>Cr(r,e)-Cr(r,t)}const si=(r,e,t)=>{if(typeof r!="string")return r;let s=r;try{s=JSON.parse(r)}catch{}return t.isType(s)?s:r};function ct(r){if("fields"in r){const e={};for(const[t,s]of Object.entries(r.fields))e[t]=ct(s);return r.setFields(e)}if(r.type==="array"){const e=r.optional();return e.innerType&&(e.innerType=ct(e.innerType)),e}return r.type==="tuple"?r.optional().clone({types:r.spec.types.map(ct)}):"optional"in r?r.optional():r}const ni=(r,e)=>{const t=[...Ve.normalizePath(e)];if(t.length===1)return t[0]in r;let s=t.pop(),n=Ve.getter(Ve.join(t),!0)(r);return!!(n&&s in n)};let Ar=r=>Object.prototype.toString.call(r)==="[object Object]";function $r(r,e){let t=Object.keys(r.fields);return Object.keys(e).filter(s=>t.indexOf(s)===-1)}const ai=Es([]);function _s(r){return new Ns(r)}class Ns extends be{constructor(e){super({type:"object",check(t){return Ar(t)||typeof t=="function"}}),this.fields=Object.create(null),this._sortErrors=ai,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var s;let n=super._cast(e,t);if(n===void 0)return this.getDefault(t);if(!this._typeCheck(n))return n;let a=this.fields,i=(s=t.stripUnknown)!=null?s:this.spec.noUnknown,l=[].concat(this._nodes,Object.keys(n).filter(h=>!this._nodes.includes(h))),c={},d=Object.assign({},t,{parent:c,__validating:t.__validating||!1}),f=!1;for(const h of l){let m=a[h],g=h in n;if(m){let F,j=n[h];d.path=(t.path?`${t.path}.`:"")+h,m=m.resolve({value:j,context:t.context,parent:c});let T=m instanceof be?m.spec:void 0,y=T==null?void 0:T.strict;if(T!=null&&T.strip){f=f||h in n;continue}F=!t.__validating||!y?m.cast(n[h],d):n[h],F!==void 0&&(c[h]=F)}else g&&!i&&(c[h]=n[h]);(g!==h in c||c[h]!==n[h])&&(f=!0)}return f?c:n}_validate(e,t={},s,n){let{from:a=[],originalValue:i=e,recursive:l=this.spec.recursive}=t;t.from=[{schema:this,value:i},...a],t.__validating=!0,t.originalValue=i,super._validate(e,t,s,(c,d)=>{if(!l||!Ar(d)){n(c,d);return}i=i||d;let f=[];for(let h of this._nodes){let m=this.fields[h];!m||Le.isRef(m)||f.push(m.asNestedTest({options:t,key:h,parent:d,parentPath:t.path,originalParent:i}))}this.runTests({tests:f,value:d,originalValue:i,options:t},s,h=>{n(h.sort(this._sortErrors).concat(c),d)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),s=t.fields;for(let[n,a]of Object.entries(this.fields)){const i=s[n];s[n]=i===void 0?a:i}return t.withMutation(n=>n.setFields(s,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(s=>{var n;const a=this.fields[s];let i=e;(n=i)!=null&&n.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[s]})),t[s]=a&&"getDefault"in a?a.getDefault(i):void 0}),t}setFields(e,t){let s=this.clone();return s.fields=e,s._nodes=ri(e,t),s._sortErrors=Es(Object.keys(e)),t&&(s._excludedEdges=t),s}shape(e,t=[]){return this.clone().withMutation(s=>{let n=s._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),n=[...s._excludedEdges,...t]),s.setFields(Object.assign(s.fields,e),n)})}partial(){const e={};for(const[t,s]of Object.entries(this.fields))e[t]="optional"in s&&s.optional instanceof Function?s.optional():s;return this.setFields(e)}deepPartial(){return ct(this)}pick(e){const t={};for(const s of e)this.fields[s]&&(t[s]=this.fields[s]);return this.setFields(t,this._excludedEdges.filter(([s,n])=>e.includes(s)&&e.includes(n)))}omit(e){const t=[];for(const s of Object.keys(this.fields))e.includes(s)||t.push(s);return this.pick(t)}from(e,t,s){let n=Ve.getter(e,!0);return this.transform(a=>{if(!a)return a;let i=a;return ni(a,e)&&(i=Object.assign({},a),s||delete i[e],i[t]=n(a)),i})}json(){return this.transform(si)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||lt.exact,test(t){if(t==null)return!0;const s=$r(this.schema,t);return s.length===0||this.createError({params:{properties:s.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=lt.noUnknown){typeof e!="boolean"&&(t=e,e=!0);let s=this.test({name:"noUnknown",exclusive:!0,message:t,test(n){if(n==null)return!0;const a=$r(this.schema,n);return!e||a.length===0||this.createError({params:{unknown:a.join(", ")}})}});return s.spec.noUnknown=e,s}unknown(e=!0,t=lt.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const s={};for(const n of Object.keys(t))s[e(n)]=t[n];return s})}camelCase(){return this.transformKeys(_t.camelCase)}snakeCase(){return this.transformKeys(_t.snakeCase)}constantCase(){return this.transformKeys(e=>_t.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),s=super.describe(e);s.fields={};for(const[a,i]of Object.entries(t.fields)){var n;let l=e;(n=l)!=null&&n.value&&(l=Object.assign({},l,{parent:l.value,value:l.value[a]})),s.fields[a]=i.describe(l)}return s}}_s.prototype=Ns.prototype;function ii({fields:r,explicitSchema:e}){return b.useMemo(()=>{if(e)return _r(e);const t={};r.forEach(n=>{var i,l,c,d,f,h,m;let a;switch(n.type){case"text":case"password":case"email":if(a=bs(),(i=n.validation)!=null&&i.required){const g=typeof n.validation.required=="string"?n.validation.required:"Campo obligatorio";a=a.required(g)}(l=n.validation)!=null&&l.minLength&&(a=a.min(n.validation.minLength.value,n.validation.minLength.message)),(c=n.validation)!=null&&c.maxLength&&(a=a.max(n.validation.maxLength.value,n.validation.maxLength.message)),(d=n.validation)!=null&&d.pattern&&(a=a.matches(n.validation.pattern.value,n.validation.pattern.message)),n.type==="email"&&(a=a.email("Email inválido"));break;case"number":if(a=ws(),(f=n.validation)!=null&&f.required){const g=typeof n.validation.required=="string"?n.validation.required:"Campo obligatorio";a=a.required(g)}break;case"select":case"optionGroup":if(a=$t(),(h=n.validation)!=null&&h.required){const g=typeof n.validation.required=="string"?n.validation.required:"Campo obligatorio";a=a.required(g)}break;case"date":if(a=zt(),(m=n.validation)!=null&&m.required){const g=typeof n.validation.required=="string"?n.validation.required:"Campo obligatorio";a=a.required(g)}break;default:a=$t()}t[n.name]=a});const s=_s().shape(t);return _r(s)},[r,e])}function oi(r){return b.useMemo(()=>{const e={};return r.forEach(t=>{e[t.name]=t}),e},[r])}function li(r){const e=b.useMemo(()=>r.filter(i=>i.type==="select"&&i.loadOptions),[r]),[t,s]=b.useState(e.length),[n,a]=b.useState({});return b.useEffect(()=>{e.length!==0&&e.forEach(i=>{i.loadOptions().then(l=>a(c=>({...c,[i.name]:l}))).finally(()=>s(l=>Math.max(0,l-1)))})},[e]),{loadingCount:t,optionsMap:n}}function ci(r,e){const t=b.useMemo(()=>r.filter(i=>i.disabledWhen),[r]),s=b.useMemo(()=>t.map(i=>i.disabledWhen.watchField),[t]),n=qr({control:e,name:s}),a={};return t.forEach(i=>{const l=s.indexOf(i.disabledWhen.watchField),c=n[l];a[i.name]=c===i.disabledWhen.watchValue}),a}const Dr={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},ui={sm:"px-2 py-1",md:"px-3 py-2",lg:"px-4 py-3"};function Wt({control:r,name:e,rules:t,defaultValue:s,size:n="sm",width:a="100%",label:i,labelHidden:l=!1,hasError:c=!1,errorMessage:d="",maxLength:f,showCounter:h=!1,className:m,...g}){const F=b.useId(),j=e||F,[T,y]=b.useState(s||"");if(r&&e)return o.jsx(je,{name:e,control:r,rules:t,defaultValue:s||"",render:({field:k,fieldState:A})=>{var S;return o.jsx(Wt,{...g,size:n,width:a,label:i,labelHidden:l,hasError:!!A.error,errorMessage:((S=A.error)==null?void 0:S.message)||"",maxLength:f,showCounter:h,className:m,value:k.value,onChange:k.onChange})}});b.useEffect(()=>{y(s||"")},[s]);const v=k=>{var A;f!==void 0&&k.target.value.length>f||(y(k.target.value),(A=g.onChange)==null||A.call(g,k))};return o.jsxs("div",{className:D("flex flex-col",m),style:{width:a},children:[i&&o.jsx("label",{htmlFor:j,className:D("pb-2 text-[var(--color-ds-text-primary)]",Dr[n],l&&"sr-only"),children:i}),o.jsx("textarea",{id:j,className:D("box-border bg-[var(--color-ds-background-page)] w-full resize vertical rounded-lg border outline-none transition font-[var(--font-primary)]",Dr[n],ui[n],c?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",g.disabled?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-secondary)] cursor-not-allowed":"text-[var(--color-ds-text-primary)]"),value:T,onChange:v,maxLength:f,...g}),o.jsxs("div",{className:"flex justify-between pt-1 min-h-[18px]",children:[c&&d?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:d}):o.jsx("span",{"aria-hidden":"true",children:" "}),h&&f!==void 0&&o.jsxs("span",{className:"text-xs text-[var(--color-ds-text-secondary)]",children:[T.length,"/",f]})]})]})}const di={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function Fs({control:r,name:e,rules:t,defaultValue:s=!1,label:n,labelHidden:a=!1,disabled:i=!1,size:l="sm",className:c,hasError:d=!1,errorMessage:f=""}){return o.jsx("div",{className:D("flex flex-col",c),children:o.jsx(je,{name:e,control:r,rules:t,defaultValue:s,render:({field:h,fieldState:m})=>{const g=m.error;return o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx("input",{id:e,type:"checkbox",className:D(di[l],"text-[var(--color-ds-button-primary-bg)]","border-[var(--color-ds-border-default)]",i&&"opacity-50 cursor-not-allowed"),checked:h.value,onChange:F=>h.onChange(F.target.checked),disabled:i}),o.jsx("span",{className:D("text-[var(--color-ds-text-primary)] text-ds-md",i&&"text-[var(--color-ds-text-secondary)]"),children:n}),d&&(g==null?void 0:g.message)&&o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:g.message})]})}})})}function Ss({name:r,control:e,searchFn:t,label:s,size:n="sm",width:a="100%",disabled:i=!1}){const{getValues:l,watch:c}=Ke(),[d,f]=b.useState([]),[h,m]=b.useState(!1),[g,F]=b.useState(!1),j=b.useRef(null),T=async k=>{if(k){m(!0);try{const A=await t(k,{getValues:l,watch:c});f(A),F(!0)}finally{m(!1)}}};b.useEffect(()=>{function k(A){j.current&&!j.current.contains(A.target)&&F(!1)}if(g)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[g]);const y=n==="sm"?"text-ds-sm":n==="md"?"text-ds-md":"text-ds-lg",v=n==="sm"?"h-6":n==="md"?"h-10":"h-12";return o.jsx(je,{name:r,control:e,render:({field:k,fieldState:A})=>{var S;return o.jsxs("div",{ref:j,className:"relative flex flex-col",style:{width:a},children:[s&&o.jsx("label",{className:`pb-2 text-[var(--color-ds-text-primary)] ${y}`,children:s}),o.jsx(vt,{className:"rounded-r-none",type:"text",size:n,width:"100%",value:k.value,onChange:I=>k.onChange(I.target.value),disabled:i,hasError:A.invalid,errorMessage:(S=A.error)==null?void 0:S.message,suffixButton:o.jsx(Te,{type:"button",className:"!rounded-l-none",size:n,variant:"primary",onClick:()=>T(k.value),disabled:i,children:"Buscar"})}),h&&o.jsx("div",{className:`
29
+ `+(l!==i?`result of cast: ${l}`:""))}return a}_cast(e,t){let s=e===void 0?e:this.transforms.reduce((n,a)=>a.call(this,n,e,this),e);return s===void 0&&(s=this.getDefault(t)),s}_validate(e,t={},s,n){let{path:a,originalValue:i=e,strict:l=this.spec.strict}=t,c=e;l||(c=this._cast(c,Object.assign({assert:!1},t)));let d=[];for(let f of Object.values(this.internalTests))f&&d.push(f);this.runTests({path:a,value:c,originalValue:i,options:t,tests:d},s,f=>{if(f.length)return n(f,c);this.runTests({path:a,value:c,originalValue:i,options:t,tests:this.tests},s,n)})}runTests(e,t,s){let n=!1,{tests:a,value:i,originalValue:l,path:c,options:d}=e,f=j=>{n||(n=!0,t(j,i))},h=j=>{n||(n=!0,s(j,i))},m=a.length,g=[];if(!m)return h([]);let F={value:i,originalValue:l,path:c,options:d,schema:this};for(let j=0;j<a.length;j++){const T=a[j];T(F,f,function(v){v&&(Array.isArray(v)?g.push(...v):g.push(v)),--m<=0&&h(g)})}}asNestedTest({key:e,index:t,parent:s,parentPath:n,originalParent:a,options:i}){const l=e??t;if(l==null)throw TypeError("Must include `key` or `index` for nested validations");const c=typeof l=="number";let d=s[l];const f=Object.assign({},i,{strict:!0,parent:s,value:d,originalValue:a[l],key:void 0,[c?"index":"key"]:l,path:c||l.includes(".")?`${n||""}[${c?l:`"${l}"`}]`:(n?`${n}.`:"")+e});return(h,m,g)=>this.resolve(f)._validate(d,f,m,g)}validate(e,t){var s;let n=this.resolve(Object.assign({},t,{value:e})),a=(s=t==null?void 0:t.disableStackTrace)!=null?s:n.spec.disableStackTrace;return new Promise((i,l)=>n._validate(e,t,(c,d)=>{xe.isError(c)&&(c.value=d),l(c)},(c,d)=>{c.length?l(new xe(c,d,void 0,void 0,a)):i(d)}))}validateSync(e,t){var s;let n=this.resolve(Object.assign({},t,{value:e})),a,i=(s=t==null?void 0:t.disableStackTrace)!=null?s:n.spec.disableStackTrace;return n._validate(e,Object.assign({},t,{sync:!0}),(l,c)=>{throw xe.isError(l)&&(l.value=c),l},(l,c)=>{if(l.length)throw new xe(l,e,void 0,void 0,i);a=c}),a}isValid(e,t){return this.validate(e,t).then(()=>!0,s=>{if(xe.isError(s))return!1;throw s})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(s){if(xe.isError(s))return!1;throw s}}_getDefault(e){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this,e):Be(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const s=this.clone({nullable:e});return s.internalTests.nullable=Ue({message:t,name:"nullable",test(n){return n===null?this.schema.spec.nullable:!0}}),s}optionality(e,t){const s=this.clone({optional:e});return s.internalTests.optionality=Ue({message:t,name:"optionality",test(n){return n===void 0?this.schema.spec.optional:!0}}),s}optional(){return this.optionality(!0)}defined(e=ke.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=ke.notNull){return this.nullability(!1,e)}required(e=ke.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(e.length===1?typeof e[0]=="function"?t={test:e[0]}:t=e[0]:e.length===2?t={name:e[0],test:e[1]}:t={name:e[0],message:e[1],test:e[2]},t.message===void 0&&(t.message=ke.default),typeof t.test!="function")throw new TypeError("`test` is a required parameters");let s=this.clone(),n=Ue(t),a=t.exclusive||t.name&&s.exclusiveTests[t.name]===!0;if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(s.exclusiveTests[t.name]=!!t.exclusive),s.tests=s.tests.filter(i=>!(i.OPTIONS.name===t.name&&(a||i.OPTIONS.test===n.OPTIONS.test))),s.tests.push(n),s}when(e,t){!Array.isArray(e)&&typeof e!="string"&&(t=e,e=".");let s=this.clone(),n=ms(e).map(a=>new Le(a));return n.forEach(a=>{a.isSibling&&s.deps.push(a.key)}),s.conditions.push(typeof t=="function"?new xt(n,t):xt.fromOptions(n,t)),s}typeError(e){let t=this.clone();return t.internalTests.typeError=Ue({message:e,name:"typeError",skipAbsent:!0,test(s){return this.schema._typeCheck(s)?!0:this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=ke.oneOf){let s=this.clone();return e.forEach(n=>{s._whitelist.add(n),s._blacklist.delete(n)}),s.internalTests.whiteList=Ue({message:t,name:"oneOf",skipAbsent:!0,test(n){let a=this.schema._whitelist,i=a.resolveAll(this.resolve);return i.includes(n)?!0:this.createError({params:{values:Array.from(a).join(", "),resolved:i}})}}),s}notOneOf(e,t=ke.notOneOf){let s=this.clone();return e.forEach(n=>{s._blacklist.add(n),s._whitelist.delete(n)}),s.internalTests.blacklist=Ue({message:t,name:"notOneOf",test(n){let a=this.schema._blacklist,i=a.resolveAll(this.resolve);return i.includes(n)?this.createError({params:{values:Array.from(a).join(", "),resolved:i}}):!0}}),s}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:s,meta:n,optional:a,nullable:i}=t.spec;return{meta:n,label:s,optional:a,nullable:i,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.map(c=>({name:c.OPTIONS.name,params:c.OPTIONS.params})).filter((c,d,f)=>f.findIndex(h=>h.name===c.name)===d)}}}be.prototype.__isYupSchema__=!0;for(const r of["validate","validateSync"])be.prototype[`${r}At`]=function(e,t,s={}){const{parent:n,parentPath:a,schema:i}=Ua(this,e,t,s.context);return i[r](n&&n[a],Object.assign({},s,{parent:n,path:e}))};for(const r of["equals","is"])be.prototype[r]=be.prototype.oneOf;for(const r of["not","nope"])be.prototype[r]=be.prototype.notOneOf;const Ba=()=>!0;function $t(r){return new vs(r)}class vs extends be{constructor(e){super(typeof e=="function"?{type:"mixed",check:e}:Object.assign({type:"mixed",check:Ba},e))}}$t.prototype=vs.prototype;const Za=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function za(r){const e=Dt(r);if(!e)return Date.parse?Date.parse(r):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let t=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(t=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(t=0-t)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+t,e.second,e.millisecond)}function Dt(r){var e,t;const s=Za.exec(r);return s?{year:Fe(s[1]),month:Fe(s[2],1)-1,day:Fe(s[3],1),hour:Fe(s[4]),minute:Fe(s[5]),second:Fe(s[6]),millisecond:s[7]?Fe(s[7].substring(0,3)):0,precision:(e=(t=s[7])==null?void 0:t.length)!=null?e:void 0,z:s[8]||void 0,plusMinus:s[9]||void 0,hourOffset:Fe(s[10]),minuteOffset:Fe(s[11])}:null}function Fe(r,e=0){return Number(r)||e}let Wa=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,qa=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Ha=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Ya="^\\d{4}-\\d{2}-\\d{2}",Ga="\\d{2}:\\d{2}:\\d{2}",Xa="(([+-]\\d{2}(:?\\d{2})?)|Z)",Ja=new RegExp(`${Ya}T${Ga}(\\.\\d+)?${Xa}$`),Ka=r=>Se(r)||r===r.trim(),Qa={}.toString();function bs(){return new ys}class ys extends be{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,t,s)=>{if(!s.spec.coerce||s.isType(e)||Array.isArray(e))return e;const n=e!=null&&e.toString?e.toString():e;return n===Qa?e:n})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||ke.required,name:"required",skipAbsent:!0,test:s=>!!s.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(t=>t.OPTIONS.name!=="required"),e))}length(e,t=me.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(s){return s.length===this.resolve(e)}})}min(e,t=me.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s.length>=this.resolve(e)}})}max(e,t=me.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(s){return s.length<=this.resolve(e)}})}matches(e,t){let s=!1,n,a;return t&&(typeof t=="object"?{excludeEmptyString:s=!1,message:n,name:a}=t:n=t),this.test({name:a||"matches",message:n||me.matches,params:{regex:e},skipAbsent:!0,test:i=>i===""&&s||i.search(e)!==-1})}email(e=me.email){return this.matches(Wa,{name:"email",message:e,excludeEmptyString:!0})}url(e=me.url){return this.matches(qa,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=me.uuid){return this.matches(Ha,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t="",s,n;return e&&(typeof e=="object"?{message:t="",allowOffset:s=!1,precision:n=void 0}=e:t=e),this.matches(Ja,{name:"datetime",message:t||me.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:t||me.datetime_offset,params:{allowOffset:s},skipAbsent:!0,test:a=>{if(!a||s)return!0;const i=Dt(a);return i?!!i.z:!1}}).test({name:"datetime_precision",message:t||me.datetime_precision,params:{precision:n},skipAbsent:!0,test:a=>{if(!a||n==null)return!0;const i=Dt(a);return i?i.precision===n:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=me.trim){return this.transform(t=>t!=null?t.trim():t).test({message:e,name:"trim",test:Ka})}lowercase(e=me.lowercase){return this.transform(t=>Se(t)?t:t.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Se(t)||t===t.toLowerCase()})}uppercase(e=me.uppercase){return this.transform(t=>Se(t)?t:t.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Se(t)||t===t.toUpperCase()})}}bs.prototype=ys.prototype;let ei=r=>r!=+r;function ws(){return new js}class js extends be{constructor(){super({type:"number",check(e){return e instanceof Number&&(e=e.valueOf()),typeof e=="number"&&!ei(e)}}),this.withMutation(()=>{this.transform((e,t,s)=>{if(!s.spec.coerce)return e;let n=e;if(typeof n=="string"){if(n=n.replace(/\s/g,""),n==="")return NaN;n=+n}return s.isType(n)||n===null?n:parseFloat(n)})})}min(e,t=Ce.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s>=this.resolve(e)}})}max(e,t=Ce.max){return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(s){return s<=this.resolve(e)}})}lessThan(e,t=Ce.lessThan){return this.test({message:t,name:"max",exclusive:!0,params:{less:e},skipAbsent:!0,test(s){return s<this.resolve(e)}})}moreThan(e,t=Ce.moreThan){return this.test({message:t,name:"min",exclusive:!0,params:{more:e},skipAbsent:!0,test(s){return s>this.resolve(e)}})}positive(e=Ce.positive){return this.moreThan(0,e)}negative(e=Ce.negative){return this.lessThan(0,e)}integer(e=Ce.integer){return this.test({name:"integer",message:e,skipAbsent:!0,test:t=>Number.isInteger(t)})}truncate(){return this.transform(e=>Se(e)?e:e|0)}round(e){var t;let s=["ceil","floor","round","trunc"];if(e=((t=e)==null?void 0:t.toLowerCase())||"round",e==="trunc")return this.truncate();if(s.indexOf(e.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+s.join(", "));return this.transform(n=>Se(n)?n:Math[e](n))}}ws.prototype=js.prototype;let ks=new Date(""),ti=r=>Object.prototype.toString.call(r)==="[object Date]";function zt(){return new Qe}class Qe extends be{constructor(){super({type:"date",check(e){return ti(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,t,s)=>!s.spec.coerce||s.isType(e)||e===null?e:(e=za(e),isNaN(e)?Qe.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let s;if(Le.isRef(e))s=e;else{let n=this.cast(e);if(!this._typeCheck(n))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);s=n}return s}min(e,t=At.min){let s=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(n){return n>=this.resolve(s)}})}max(e,t=At.max){let s=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(n){return n<=this.resolve(s)}})}}Qe.INVALID_DATE=ks;zt.prototype=Qe.prototype;zt.INVALID_DATE=ks;function ri(r,e=[]){let t=[],s=new Set,n=new Set(e.map(([i,l])=>`${i}-${l}`));function a(i,l){let c=Ve.split(i)[0];s.add(c),n.has(`${l}-${c}`)||t.push([l,c])}for(const i of Object.keys(r)){let l=r[i];s.add(i),Le.isRef(l)&&l.isSibling?a(l.path,i):Zt(l)&&"deps"in l&&l.deps.forEach(c=>a(c,i))}return Oa.array(Array.from(s),t).reverse()}function Cr(r,e){let t=1/0;return r.some((s,n)=>{var a;if((a=e.path)!=null&&a.includes(s))return t=n,!0}),t}function Es(r){return(e,t)=>Cr(r,e)-Cr(r,t)}const si=(r,e,t)=>{if(typeof r!="string")return r;let s=r;try{s=JSON.parse(r)}catch{}return t.isType(s)?s:r};function ct(r){if("fields"in r){const e={};for(const[t,s]of Object.entries(r.fields))e[t]=ct(s);return r.setFields(e)}if(r.type==="array"){const e=r.optional();return e.innerType&&(e.innerType=ct(e.innerType)),e}return r.type==="tuple"?r.optional().clone({types:r.spec.types.map(ct)}):"optional"in r?r.optional():r}const ni=(r,e)=>{const t=[...Ve.normalizePath(e)];if(t.length===1)return t[0]in r;let s=t.pop(),n=Ve.getter(Ve.join(t),!0)(r);return!!(n&&s in n)};let Ar=r=>Object.prototype.toString.call(r)==="[object Object]";function $r(r,e){let t=Object.keys(r.fields);return Object.keys(e).filter(s=>t.indexOf(s)===-1)}const ai=Es([]);function _s(r){return new Ns(r)}class Ns extends be{constructor(e){super({type:"object",check(t){return Ar(t)||typeof t=="function"}}),this.fields=Object.create(null),this._sortErrors=ai,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var s;let n=super._cast(e,t);if(n===void 0)return this.getDefault(t);if(!this._typeCheck(n))return n;let a=this.fields,i=(s=t.stripUnknown)!=null?s:this.spec.noUnknown,l=[].concat(this._nodes,Object.keys(n).filter(h=>!this._nodes.includes(h))),c={},d=Object.assign({},t,{parent:c,__validating:t.__validating||!1}),f=!1;for(const h of l){let m=a[h],g=h in n;if(m){let F,j=n[h];d.path=(t.path?`${t.path}.`:"")+h,m=m.resolve({value:j,context:t.context,parent:c});let T=m instanceof be?m.spec:void 0,y=T==null?void 0:T.strict;if(T!=null&&T.strip){f=f||h in n;continue}F=!t.__validating||!y?m.cast(n[h],d):n[h],F!==void 0&&(c[h]=F)}else g&&!i&&(c[h]=n[h]);(g!==h in c||c[h]!==n[h])&&(f=!0)}return f?c:n}_validate(e,t={},s,n){let{from:a=[],originalValue:i=e,recursive:l=this.spec.recursive}=t;t.from=[{schema:this,value:i},...a],t.__validating=!0,t.originalValue=i,super._validate(e,t,s,(c,d)=>{if(!l||!Ar(d)){n(c,d);return}i=i||d;let f=[];for(let h of this._nodes){let m=this.fields[h];!m||Le.isRef(m)||f.push(m.asNestedTest({options:t,key:h,parent:d,parentPath:t.path,originalParent:i}))}this.runTests({tests:f,value:d,originalValue:i,options:t},s,h=>{n(h.sort(this._sortErrors).concat(c),d)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),s=t.fields;for(let[n,a]of Object.entries(this.fields)){const i=s[n];s[n]=i===void 0?a:i}return t.withMutation(n=>n.setFields(s,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(s=>{var n;const a=this.fields[s];let i=e;(n=i)!=null&&n.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[s]})),t[s]=a&&"getDefault"in a?a.getDefault(i):void 0}),t}setFields(e,t){let s=this.clone();return s.fields=e,s._nodes=ri(e,t),s._sortErrors=Es(Object.keys(e)),t&&(s._excludedEdges=t),s}shape(e,t=[]){return this.clone().withMutation(s=>{let n=s._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),n=[...s._excludedEdges,...t]),s.setFields(Object.assign(s.fields,e),n)})}partial(){const e={};for(const[t,s]of Object.entries(this.fields))e[t]="optional"in s&&s.optional instanceof Function?s.optional():s;return this.setFields(e)}deepPartial(){return ct(this)}pick(e){const t={};for(const s of e)this.fields[s]&&(t[s]=this.fields[s]);return this.setFields(t,this._excludedEdges.filter(([s,n])=>e.includes(s)&&e.includes(n)))}omit(e){const t=[];for(const s of Object.keys(this.fields))e.includes(s)||t.push(s);return this.pick(t)}from(e,t,s){let n=Ve.getter(e,!0);return this.transform(a=>{if(!a)return a;let i=a;return ni(a,e)&&(i=Object.assign({},a),s||delete i[e],i[t]=n(a)),i})}json(){return this.transform(si)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||lt.exact,test(t){if(t==null)return!0;const s=$r(this.schema,t);return s.length===0||this.createError({params:{properties:s.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=lt.noUnknown){typeof e!="boolean"&&(t=e,e=!0);let s=this.test({name:"noUnknown",exclusive:!0,message:t,test(n){if(n==null)return!0;const a=$r(this.schema,n);return!e||a.length===0||this.createError({params:{unknown:a.join(", ")}})}});return s.spec.noUnknown=e,s}unknown(e=!0,t=lt.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const s={};for(const n of Object.keys(t))s[e(n)]=t[n];return s})}camelCase(){return this.transformKeys(_t.camelCase)}snakeCase(){return this.transformKeys(_t.snakeCase)}constantCase(){return this.transformKeys(e=>_t.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),s=super.describe(e);s.fields={};for(const[a,i]of Object.entries(t.fields)){var n;let l=e;(n=l)!=null&&n.value&&(l=Object.assign({},l,{parent:l.value,value:l.value[a]})),s.fields[a]=i.describe(l)}return s}}_s.prototype=Ns.prototype;function ii({fields:r,explicitSchema:e}){return b.useMemo(()=>{if(e)return _r(e);const t={};r.forEach(n=>{var i,l,c,d,f,h,m;let a;switch(n.type){case"text":case"password":case"email":if(a=bs(),(i=n.validation)!=null&&i.required){const g=typeof n.validation.required=="string"?n.validation.required:"Campo obligatorio";a=a.required(g)}(l=n.validation)!=null&&l.minLength&&(a=a.min(n.validation.minLength.value,n.validation.minLength.message)),(c=n.validation)!=null&&c.maxLength&&(a=a.max(n.validation.maxLength.value,n.validation.maxLength.message)),(d=n.validation)!=null&&d.pattern&&(a=a.matches(n.validation.pattern.value,n.validation.pattern.message)),n.type==="email"&&(a=a.email("Email inválido"));break;case"number":if(a=ws(),(f=n.validation)!=null&&f.required){const g=typeof n.validation.required=="string"?n.validation.required:"Campo obligatorio";a=a.required(g)}break;case"select":case"optionGroup":if(a=$t(),(h=n.validation)!=null&&h.required){const g=typeof n.validation.required=="string"?n.validation.required:"Campo obligatorio";a=a.required(g)}break;case"date":if(a=zt(),(m=n.validation)!=null&&m.required){const g=typeof n.validation.required=="string"?n.validation.required:"Campo obligatorio";a=a.required(g)}break;default:a=$t()}t[n.name]=a});const s=_s().shape(t);return _r(s)},[r,e])}function oi(r){return b.useMemo(()=>{const e={};return r.forEach(t=>{e[t.name]=t}),e},[r])}function li(r){const e=b.useMemo(()=>r.filter(i=>i.type==="select"&&i.loadOptions),[r]),[t,s]=b.useState(e.length),[n,a]=b.useState({});return b.useEffect(()=>{e.length!==0&&e.forEach(i=>{i.loadOptions().then(l=>a(c=>({...c,[i.name]:l}))).finally(()=>s(l=>Math.max(0,l-1)))})},[e]),{loadingCount:t,optionsMap:n}}function ci(r,e){const t=b.useMemo(()=>r.filter(i=>i.disabledWhen),[r]),s=b.useMemo(()=>t.map(i=>i.disabledWhen.watchField),[t]),n=qr({control:e,name:s}),a={};return t.forEach(i=>{const l=s.indexOf(i.disabledWhen.watchField),c=n[l];a[i.name]=c===i.disabledWhen.watchValue}),a}const Dr={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},ui={sm:"px-2 py-1",md:"px-3 py-2",lg:"px-4 py-3"};function Wt({control:r,name:e,rules:t,defaultValue:s,size:n="sm",width:a="100%",label:i,labelHidden:l=!1,hasError:c=!1,errorMessage:d="",maxLength:f,showCounter:h=!1,className:m,...g}){const F=b.useId(),j=e||F,[T,y]=b.useState(s||"");if(r&&e)return o.jsx(je,{name:e,control:r,rules:t,defaultValue:s||"",render:({field:k,fieldState:A})=>{var S;return o.jsx(Wt,{...g,size:n,width:a,label:i,labelHidden:l,hasError:!!A.error,errorMessage:((S=A.error)==null?void 0:S.message)||"",maxLength:f,showCounter:h,className:m,value:k.value,onChange:k.onChange})}});b.useEffect(()=>{y(s||"")},[s]);const v=k=>{var A;f!==void 0&&k.target.value.length>f||(y(k.target.value),(A=g.onChange)==null||A.call(g,k))};return o.jsxs("div",{className:D("flex flex-col",m),style:{width:a},children:[i&&o.jsx("label",{htmlFor:j,className:D("pb-2 text-[var(--color-ds-text-primary)]",Dr[n],l&&"sr-only"),children:i}),o.jsx("textarea",{id:j,className:D("box-border bg-[var(--color-ds-background-page)] w-full resize vertical rounded-lg border outline-none transition font-[var(--font-primary)]",Dr[n],ui[n],c?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",g.disabled?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-secondary)] cursor-not-allowed":"text-[var(--color-ds-text-primary)]"),value:T,onChange:v,maxLength:f,...g}),o.jsxs("div",{className:"flex justify-between pt-1 min-h-[18px]",children:[c&&d?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:d}):o.jsx("span",{"aria-hidden":"true",children:" "}),h&&f!==void 0&&o.jsxs("span",{className:"text-xs text-[var(--color-ds-text-secondary)]",children:[T.length,"/",f]})]})]})}const di={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function Fs({control:r,name:e,rules:t,defaultValue:s=!1,label:n,labelHidden:a=!1,disabled:i=!1,size:l="sm",className:c,hasError:d=!1,errorMessage:f=""}){return o.jsx("div",{className:D("flex flex-col",c),children:o.jsx(je,{name:e,control:r,rules:t,defaultValue:s,render:({field:h,fieldState:m})=>{const g=m.error;return o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx("input",{id:e,type:"checkbox",className:D(di[l],"text-[var(--color-ds-button-primary-bg)]","border-[var(--color-ds-border-default)]",i&&"opacity-50 cursor-not-allowed"),checked:h.value,onChange:F=>h.onChange(F.target.checked),disabled:i}),o.jsx("span",{className:D("text-[var(--color-ds-text-primary)] text-ds-md",i&&"text-[var(--color-ds-text-secondary)]"),children:n}),d&&(g==null?void 0:g.message)&&o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:g.message})]})}})})}function Ss({name:r,control:e,searchFn:t,label:s,size:n="sm",width:a="100%",disabled:i=!1}){const{watch:l,getValues:c}=Ke(),[d,f]=b.useState([]),[h,m]=b.useState(!1),[g,F]=b.useState(!1),j=b.useRef(null),T=async k=>{if(k){m(!0);try{const A=await t(k,{watch:l,getValues:c});f(A),F(!0)}finally{m(!1)}}};b.useEffect(()=>{function k(A){j.current&&!j.current.contains(A.target)&&F(!1)}if(g)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[g]);const y=n==="sm"?"text-ds-sm":n==="md"?"text-ds-md":"text-ds-lg",v=n==="sm"?"h-6":n==="md"?"h-10":"h-12";return o.jsx(je,{name:r,control:e,render:({field:k,fieldState:A})=>{var S;return o.jsxs("div",{ref:j,className:"relative flex flex-col",style:{width:a},children:[s&&o.jsx("label",{className:`pb-2 text-[var(--color-ds-text-primary)] ${y}`,children:s}),o.jsx(vt,{className:"rounded-r-none",type:"text",size:n,width:"100%",value:k.value,onChange:I=>k.onChange(I.target.value),disabled:i,hasError:A.invalid,errorMessage:(S=A.error)==null?void 0:S.message,suffixButton:o.jsx(Te,{type:"button",className:"!rounded-l-none",size:n,variant:"primary",onClick:()=>T(k.value),disabled:i,children:"Buscar"})}),h&&o.jsx("div",{className:`
30
30
  absolute
31
31
  top-14
32
32
  left-0
package/dist/index.es.js CHANGED
@@ -5241,11 +5241,11 @@ function fi({
5241
5241
  width: a = "100%",
5242
5242
  disabled: i = !1
5243
5243
  }) {
5244
- const { getValues: l, watch: c } = rt(), [d, f] = re([]), [h, m] = re(!1), [g, N] = re(!1), w = we(null), S = async (j) => {
5244
+ const { watch: l, getValues: c } = rt(), [d, f] = re([]), [h, m] = re(!1), [g, N] = re(!1), w = we(null), S = async (j) => {
5245
5245
  if (j) {
5246
5246
  m(!0);
5247
5247
  try {
5248
- const C = await t(j, { getValues: l, watch: c });
5248
+ const C = await t(j, { watch: l, getValues: c });
5249
5249
  f(C), N(!0);
5250
5250
  } finally {
5251
5251
  m(!1);
package/dist/index.umd.js CHANGED
@@ -27,7 +27,7 @@ React keys must be passed directly to JSX without using spread:
27
27
  text-ds-lg`,children:r}),e&&i.jsx("div",{className:"flex items-center space-x-2",children:e})]}),i.jsx("main",{className:"flex-1 overflow-auto",children:t})]})}function Ur({options:r,value:e,onChange:t,children:s}){const a=b.useRef(null),[n,o]=b.useState({left:0,width:0});return b.useLayoutEffect(()=>{const l=a.current;if(!l)return;const c=()=>{const u=r.findIndex(T=>T.value===e);if(u<0)return;const f=l.children[u],h=f.querySelector("span"),p=(h==null?void 0:h.offsetWidth)??f.offsetWidth,v=f.offsetWidth,k=f.offsetLeft+(v-p)/2;o({left:k,width:p})};return c(),window.addEventListener("resize",c),l.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),l.removeEventListener("scroll",c)}},[e,r]),i.jsxs("div",{children:[i.jsxs("div",{className:"relative",children:[i.jsx("ul",{ref:a,role:"tablist",className:"flex justify-center overflow-x-auto border-b border-[var(--color-ds-border-default-50)]",children:r.map(l=>{const c=l.value===e;return i.jsx("li",{role:"tab","aria-selected":c,onClick:()=>t(l.value),className:D("cursor-pointer whitespace-nowrap px-4 py-2 transition-colors duration-150 ease-in-out",c?"text-[var(--color-ds-background-accent)]":"text-[var(--color-ds-text-primary)]"),children:i.jsx("span",{className:"inline-block",children:l.label})},l.value)})}),i.jsx("span",{className:"absolute bottom-0 h-1 bg-[var(--color-ds-background-accent)] transition-all duration-200 ease-in-out rounded-t-full",style:{left:n.left,width:n.width}})]}),i.jsx("div",{className:"mt-4 pb-4 border-b border-[var(--color-ds-border-default-50)]",children:s[e]})]})}const Mt={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},ln={sm:"h-6",md:"h-10",lg:"h-12"},cn={sm:"px-2",md:"px-2.5",lg:"px-3"},Rr={sm:"1.5rem",md:"2.5rem",lg:"3rem"};function Br(r,e,t,s,a,n,o,l,c){return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"relative flex items-center w-full",children:[i.jsx("select",{id:r,...s,disabled:a,className:D("box-border w-full rounded-lg border bg-[var(--color-ds-background-page)] outline-none transition font-[var(--font-primary)]",Mt[t],ln[t],cn[t],n?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",a?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-primary)] cursor-not-allowed":"text-[var(--color-ds-text-primary)]",l),children:e.map(u=>i.jsx("option",{value:u.value,className:"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",children:u.label},u.value))}),c&&i.jsx("div",{className:"flex items-center h-full pr-2",children:c})]}),!o&&i.jsx("div",{className:"min-h-[18px] w-full",children:n!=null&&n.message?i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:n.message}):i.jsx("span",{"aria-hidden":"true",children:" "})})]})}function Ke(r){const{control:e,name:t,rules:s,defaultValue:a,options:n=[],loadOptions:o,reloadDeps:l=[],value:c,onChange:u,size:f="sm",width:h="100%",label:p,labelHidden:v=!1,hasError:F=!1,errorMessage:k="",disableErrorPlaceholder:T=!1,disabled:y=!1,className:x,suffixButton:j}=r,A=b.useId(),S=t||A,[z,H]=b.useState(n),[B,Z]=b.useState(!!o);if(b.useEffect(()=>{o&&(Z(!0),o().then(U=>H(U)).finally(()=>Z(!1)))},[o,...l]),b.useEffect(()=>{!e&&z.length>0&&(c===void 0||c===""||!z.some(U=>U.value===c))&&(u==null||u(z[0].value))},[z,c,u,e]),e&&t){const{field:U,fieldState:V}=ur({name:t,control:e,rules:s,defaultValue:a});return b.useEffect(()=>{if(!B&&z.length>0){const I=U.value;(I===void 0||!z.some(R=>R.value===I))&&U.onChange(z[0].value)}},[z,B,U]),i.jsxs("div",{className:D("flex flex-col",x),style:{width:h,maxWidth:"100%"},children:[p&&i.jsx("label",{htmlFor:S,className:D("pb-2 text-[var(--color-ds-text-primary)]",Mt[f],v&&"sr-only"),children:p}),B?i.jsx(Le,{width:"100%",height:Rr[f],variant:"rect",className:"rounded-lg"}):Br(S,z,f,{value:U.value,onChange:I=>U.onChange(I.target.value)},y,V.error,T,x,j)]})}return i.jsxs("div",{className:D("flex flex-col",x),style:{width:h,maxWidth:"100%"},children:[p&&i.jsx("label",{htmlFor:S,className:D("pb-2 text-[var(--color-ds-text-primary)]",Mt[f],v&&"sr-only"),children:p}),B?i.jsx(Le,{width:"100%",height:Rr[f],variant:"rect",className:"rounded-lg"}):Br(S,z,f,{value:c,onChange:U=>u==null?void 0:u(U.target.value)},y,F?{message:k}:void 0,T,x,j)]})}const Zr={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"};function Wr({groupLabel:r,inputs:e=[],separator:t=i.jsx("span",{className:"px-1 select-none",children:"/"}),useSeparator:s=!0,className:a,showVisibleLabel:n=!1,size:o="sm",width:l}){const c=e.length;return i.jsxs("div",{className:D("flex flex-col",a),style:l?{width:l}:void 0,children:[i.jsx("label",{className:D("sr-only pb-2",Zr[o]),children:r}),n&&i.jsx("label",{className:D("pb-2",Zr[o]),children:r}),i.jsx("div",{className:"flex items-center flex-nowrap",children:e.map((u,f)=>{const{width:h,className:p,options:v,loadOptions:F,...k}=u,T=Array.isArray(v)||typeof F=="function";let y="rounded-lg";!s&&c>1&&(f===0?y="rounded-l-lg rounded-r-none":f===c-1?y="rounded-r-lg rounded-l-none":y="rounded-none");const x=D("inline-flex items-center flex-shrink-0 overflow-hidden",typeof h=="string"&&h.startsWith("w-")?h:void 0),j=typeof h=="string"&&!h.startsWith("w-")?{width:h}:void 0,A=D(p,y);return i.jsxs("div",{className:x,style:j,children:[T?i.jsx(Ke,{...k,size:o,className:A,options:v,loadOptions:F}):i.jsx(ct,{...k,size:o,className:A}),s&&f<c-1&&t]},f)})})]})}const qr={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},dn={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function Hr({groupLabel:r,options:e,control:t,name:s,rules:a,defaultValue:n,multiple:o=!0,size:l="sm",vertical:c=!0,className:u,showVisibleLabel:f=!0}){return i.jsx(ke,{name:s,control:t,rules:a,defaultValue:n,render:({field:h,fieldState:p})=>{const{value:v,onChange:F}=h;p.error;const k=y=>o?Array.isArray(v)&&v.includes(y):v===y,T=y=>{if(o){const x=Array.isArray(v)?[...v]:[],j=x.indexOf(y);j>=0?x.splice(j,1):x.push(y),F(x)}else F(y)};return i.jsxs("div",{className:D("w-full",u),children:[i.jsx("label",{className:D("sr-only pb-2 text-[var(--color-ds-text-primary)]",qr[l]),children:r}),f&&i.jsx("label",{className:D("block pb-2 text-[var(--color-ds-text-primary)]",qr[l]),children:r}),i.jsx("div",{className:D(c?"flex flex-col gap-2":"flex flex-wrap gap-4"),children:e.map(y=>i.jsxs("label",{className:"inline-flex items-center space-x-2 cursor-pointer select-none",children:[i.jsx("input",{type:o?"checkbox":"radio",name:s,value:y.value,checked:k(y.value),onChange:()=>T(y.value),className:D(dn[l],"text-[var(--color-ds-button-primary-bg)]","border-[var(--color-ds-border-default)]")}),i.jsx("span",{className:"text-[var(--color-ds-text-primary)] text-ds-md",children:y.label})]},y.value))})]})}})}function un(r){function e(o){var l,c;for(const u of Object.keys(o)){if((l=o[u])!=null&&l.types||(c=o[u])!=null&&c.message)return u;if(typeof o[u]=="object"){const f=e(o[u]);if(f)return`${u}.${f}`}}return null}const t=e(r);if(!t)return;const s=`[name="${t}"]`,a=`[name^="${t}["], [name^="${t}."]`,n=document.querySelector(s)??document.querySelector(a);n&&(n.scrollIntoView({behavior:"smooth",block:"center"}),n.focus({preventScroll:!0}))}const fn={success:"bg-green-100 border-green-500 text-green-800",error:"bg-red-100 border-red-500 text-red-800",info:"bg-blue-100 border-blue-500 text-blue-800",warning:"bg-yellow-100 border-yellow-500 text-yellow-800"},Yr=({id:r,message:e,variant:t="info",duration:s=5e3,onClose:a})=>(b.useEffect(()=>{const n=setTimeout(()=>a(r),s);return()=>clearTimeout(n)},[r,s,a]),i.jsxs("div",{className:D("w-80 max-w-full border-l-4 rounded shadow-md p-4 mb-2 flex justify-between items-start",fn[t]),role:"alert","aria-live":"assertive",children:[i.jsx("span",{className:"flex-1",children:e}),i.jsx("button",{onClick:()=>a(r),className:"ml-4 text-xl font-bold leading-none focus:outline-none",children:"×"})]}));let ut;const hn=new Uint8Array(16);function pn(){if(!ut&&(ut=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ut))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ut(hn)}const fe=[];for(let r=0;r<256;++r)fe.push((r+256).toString(16).slice(1));function mn(r,e=0){return fe[r[e+0]]+fe[r[e+1]]+fe[r[e+2]]+fe[r[e+3]]+"-"+fe[r[e+4]]+fe[r[e+5]]+"-"+fe[r[e+6]]+fe[r[e+7]]+"-"+fe[r[e+8]]+fe[r[e+9]]+"-"+fe[r[e+10]]+fe[r[e+11]]+fe[r[e+12]]+fe[r[e+13]]+fe[r[e+14]]+fe[r[e+15]]}const Gr={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function gn(r,e,t){if(Gr.randomUUID&&!r)return Gr.randomUUID();r=r||{};const s=r.random||(r.rng||pn)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,mn(s)}const Xr=b.createContext(null),Jr=()=>{const r=b.useContext(Xr);if(!r)throw new Error("useToast debe usarse dentro de <ToastProvider>");return r},bn=({children:r})=>{const[e,t]=b.useState([]),s=(n,o="info",l=5e3)=>{const c=gn();t(u=>[...u,{id:c,message:n,variant:o,duration:l}])},a=n=>{t(o=>o.filter(l=>l.id!==n))};return i.jsxs(Xr.Provider,{value:{show:s},children:[r,i.jsx("div",{className:"fixed top-4 right-4 z-50 flex flex-col items-end",children:e.map(n=>i.jsx(Yr,{id:n.id,message:n.message,variant:n.variant,duration:n.duration,onClose:a},n.id))})]})},Kr=(r,e,t)=>{if(r&&"reportValidity"in r){const s=C(t,e);r.setCustomValidity(s&&s.message||""),r.reportValidity()}},Qr=(r,e)=>{for(const t in e.fields){const s=e.fields[t];s&&s.ref&&"reportValidity"in s.ref?Kr(s.ref,t,r):s&&s.refs&&s.refs.forEach(a=>Kr(a,t,r))}},vn=(r,e)=>{e.shouldUseNativeValidation&&Qr(r,e);const t={};for(const s in r){const a=C(e.fields,s),n=Object.assign(r[s]||{},{ref:a&&a.ref});if(xn(e.names||Object.keys(r),s)){const o=Object.assign({},C(t,s));ee(o,"root",n),ee(t,s,o)}else ee(t,s,n)}return t},xn=(r,e)=>{const t=es(e);return r.some(s=>es(s).match(`^${t}\\.\\d+`))};function es(r){return r.replace(/\]|\[/g,"")}function ts(r,e,t){return t===void 0&&(t={}),function(s,a,n){try{return Promise.resolve(function(o,l){try{var c=(e!=null&&e.context&&process.env.NODE_ENV==="development"&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(r[t.mode==="sync"?"validateSync":"validate"](s,Object.assign({abortEarly:!1},e,{context:a}))).then(function(u){return n.shouldUseNativeValidation&&Qr({},n),{values:t.raw?Object.assign({},s):u,errors:{}}}))}catch(u){return l(u)}return c&&c.then?c.then(void 0,l):c}(0,function(o){if(!o.inner)throw o;return{values:{},errors:vn((l=o,c=!n.shouldUseNativeValidation&&n.criteriaMode==="all",(l.inner||[]).reduce(function(u,f){if(u[f.path]||(u[f.path]={message:f.message,type:f.type}),c){var h=u[f.path].types,p=h&&h[f.type];u[f.path]=fr(f.path,c,u,f.type,p?[].concat(p,f.message):f.message)}return u},{})),n)};var l,c}))}catch(o){return Promise.reject(o)}}}var Vt,rs;function yn(){if(rs)return Vt;rs=1;function r(y){this._maxSize=y,this.clear()}r.prototype.clear=function(){this._size=0,this._values=Object.create(null)},r.prototype.get=function(y){return this._values[y]},r.prototype.set=function(y,x){return this._size>=this._maxSize&&this.clear(),y in this._values||this._size++,this._values[y]=x};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,t=/^\d+$/,s=/^\d/,a=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,n=/^\s*(['"]?)(.*?)(\1)\s*$/,o=512,l=new r(o),c=new r(o),u=new r(o);Vt={Cache:r,split:h,normalizePath:f,setter:function(y){var x=f(y);return c.get(y)||c.set(y,function(A,S){for(var z=0,H=x.length,B=A;z<H-1;){var Z=x[z];if(Z==="__proto__"||Z==="constructor"||Z==="prototype")return A;B=B[x[z++]]}B[x[z]]=S})},getter:function(y,x){var j=f(y);return u.get(y)||u.set(y,function(S){for(var z=0,H=j.length;z<H;)if(S!=null||!x)S=S[j[z++]];else return;return S})},join:function(y){return y.reduce(function(x,j){return x+(v(j)||t.test(j)?"["+j+"]":(x?".":"")+j)},"")},forEach:function(y,x,j){p(Array.isArray(y)?y:h(y),x,j)}};function f(y){return l.get(y)||l.set(y,h(y).map(function(x){return x.replace(n,"$2")}))}function h(y){return y.match(e)||[""]}function p(y,x,j){var A=y.length,S,z,H,B;for(z=0;z<A;z++)S=y[z],S&&(T(S)&&(S='"'+S+'"'),B=v(S),H=!B&&/^\d+$/.test(S),x.call(j,S,B,H,z,y))}function v(y){return typeof y=="string"&&y&&["'",'"'].indexOf(y.charAt(0))!==-1}function F(y){return y.match(s)&&!y.match(t)}function k(y){return a.test(y)}function T(y){return!v(y)&&(F(y)||k(y))}return Vt}var Ie=yn(),Lt,ss;function wn(){if(ss)return Lt;ss=1;const r=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,e=f=>f.match(r)||[],t=f=>f[0].toUpperCase()+f.slice(1),s=(f,h)=>e(f).join(h).toLowerCase(),a=f=>e(f).reduce((h,p)=>`${h}${h?p[0].toUpperCase()+p.slice(1).toLowerCase():p.toLowerCase()}`,"");return Lt={words:e,upperFirst:t,camelCase:a,pascalCase:f=>t(a(f)),snakeCase:f=>s(f,"_"),kebabCase:f=>s(f,"-"),sentenceCase:f=>t(s(f," ")),titleCase:f=>e(f).map(t).join(" ")},Lt}var It=wn(),ft={exports:{}},as;function kn(){if(as)return ft.exports;as=1,ft.exports=function(a){return r(e(a),a)},ft.exports.array=r;function r(a,n){var o=a.length,l=new Array(o),c={},u=o,f=t(n),h=s(a);for(n.forEach(function(v){if(!h.has(v[0])||!h.has(v[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});u--;)c[u]||p(a[u],u,new Set);return l;function p(v,F,k){if(k.has(v)){var T;try{T=", node was:"+JSON.stringify(v)}catch{T=""}throw new Error("Cyclic dependency"+T)}if(!h.has(v))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(v));if(!c[F]){c[F]=!0;var y=f.get(v)||new Set;if(y=Array.from(y),F=y.length){k.add(v);do{var x=y[--F];p(x,h.get(x),k)}while(F);k.delete(v)}l[--o]=v}}}function e(a){for(var n=new Set,o=0,l=a.length;o<l;o++){var c=a[o];n.add(c[0]),n.add(c[1])}return Array.from(n)}function t(a){for(var n=new Map,o=0,l=a.length;o<l;o++){var c=a[o];n.has(c[0])||n.set(c[0],new Set),n.has(c[1])||n.set(c[1],new Set),n.get(c[0]).add(c[1])}return n}function s(a){for(var n=new Map,o=0,l=a.length;o<l;o++)n.set(a[o],o);return n}return ft.exports}var jn=kn();const En=Is(jn),_n=Object.prototype.toString,Nn=Error.prototype.toString,Fn=RegExp.prototype.toString,Sn=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Tn=/^Symbol\((.*)\)(.*)$/;function Cn(r){return r!=+r?"NaN":r===0&&1/r<0?"-0":""+r}function ns(r,e=!1){if(r==null||r===!0||r===!1)return""+r;const t=typeof r;if(t==="number")return Cn(r);if(t==="string")return e?`"${r}"`:r;if(t==="function")return"[Function "+(r.name||"anonymous")+"]";if(t==="symbol")return Sn.call(r).replace(Tn,"Symbol($1)");const s=_n.call(r).slice(8,-1);return s==="Date"?isNaN(r.getTime())?""+r:r.toISOString(r):s==="Error"||r instanceof Error?"["+Nn.call(r)+"]":s==="RegExp"?Fn.call(r):null}function Ae(r,e){let t=ns(r,e);return t!==null?t:JSON.stringify(r,function(s,a){let n=ns(this[s],e);return n!==null?n:a},2)}function os(r){return r==null?[]:[].concat(r)}let is,ls,cs,On=/\$\{\s*(\w+)\s*\}/g;is=Symbol.toStringTag;class ds{constructor(e,t,s,a){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[is]="Error",this.name="ValidationError",this.value=t,this.path=s,this.type=a,this.errors=[],this.inner=[],os(e).forEach(n=>{if(me.isError(n)){this.errors.push(...n.errors);const o=n.inner.length?n.inner:[n];this.inner.push(...o)}else this.errors.push(n)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}ls=Symbol.hasInstance,cs=Symbol.toStringTag;class me extends Error{static formatError(e,t){const s=t.label||t.path||"this";return t=Object.assign({},t,{path:s,originalPath:t.path}),typeof e=="string"?e.replace(On,(a,n)=>Ae(t[n])):typeof e=="function"?e(t):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,t,s,a,n){const o=new ds(e,t,s,a);if(n)return o;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[cs]="Error",this.name=o.name,this.message=o.message,this.type=o.type,this.value=o.value,this.path=o.path,this.errors=o.errors,this.inner=o.inner,Error.captureStackTrace&&Error.captureStackTrace(this,me)}static[ls](e){return ds[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Ne={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:r,type:e,value:t,originalValue:s})=>{const a=s!=null&&s!==t?` (cast from the value \`${Ae(s,!0)}\`).`:".";return e!=="mixed"?`${r} must be a \`${e}\` type, but the final value was: \`${Ae(t,!0)}\``+a:`${r} must match the configured type. The validated value was: \`${Ae(t,!0)}\``+a}},ge={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},$e={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},zt={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},An={isValue:"${path} field must be ${value}"},ht={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:Ne,string:ge,number:$e,date:zt,object:ht,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:An,tuple:{notType:r=>{const{path:e,value:t,spec:s}=r,a=s.types.length;if(Array.isArray(t)){if(t.length<a)return`${e} tuple value has too few items, expected a length of ${a} but got ${t.length} for value: \`${Ae(t,!0)}\``;if(t.length>a)return`${e} tuple value has too many items, expected a length of ${a} but got ${t.length} for value: \`${Ae(t,!0)}\``}return me.formatError(Ne.notType,r)}}});const Pt=r=>r&&r.__isYupSchema__;class pt{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:s,then:a,otherwise:n}=t,o=typeof s=="function"?s:(...l)=>l.every(c=>c===s);return new pt(e,(l,c)=>{var u;let f=o(...l)?a:n;return(u=f==null?void 0:f(c))!=null?u:c})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let s=this.refs.map(n=>n.getValue(t==null?void 0:t.value,t==null?void 0:t.parent,t==null?void 0:t.context)),a=this.fn(s,e,t);if(a===void 0||a===e)return e;if(!Pt(a))throw new TypeError("conditions must return a schema object");return a.resolve(t)}}const mt={context:"$",value:"."};class ze{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===mt.context,this.isValue=this.key[0]===mt.value,this.isSibling=!this.isContext&&!this.isValue;let s=this.isContext?mt.context:this.isValue?mt.value:"";this.path=this.key.slice(s.length),this.getter=this.path&&Ie.getter(this.path,!0),this.map=t.map}getValue(e,t,s){let a=this.isContext?s:this.isValue?e:t;return this.getter&&(a=this.getter(a||{})),this.map&&(a=this.map(a)),a}cast(e,t){return this.getValue(e,t==null?void 0:t.parent,t==null?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}ze.prototype.__isYupRef=!0;const Te=r=>r==null;function Ue(r){function e({value:t,path:s="",options:a,originalValue:n,schema:o},l,c){const{name:u,test:f,params:h,message:p,skipAbsent:v}=r;let{parent:F,context:k,abortEarly:T=o.spec.abortEarly,disableStackTrace:y=o.spec.disableStackTrace}=a;function x(V){return ze.isRef(V)?V.getValue(t,F,k):V}function j(V={}){const I=Object.assign({value:t,originalValue:n,label:o.spec.label,path:V.path||s,spec:o.spec,disableStackTrace:V.disableStackTrace||y},h,V.params);for(const W of Object.keys(I))I[W]=x(I[W]);const R=new me(me.formatError(V.message||p,I),t,I.path,V.type||u,I.disableStackTrace);return R.params=I,R}const A=T?l:c;let S={path:s,parent:F,type:u,from:a.from,createError:j,resolve:x,options:a,originalValue:n,schema:o};const z=V=>{me.isError(V)?A(V):V?c(null):A(j())},H=V=>{me.isError(V)?A(V):l(V)};if(v&&Te(t))return z(!0);let Z;try{var U;if(Z=f.call(S,t,S),typeof((U=Z)==null?void 0:U.then)=="function"){if(a.sync)throw new Error(`Validation test of type: "${S.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(Z).then(z,H)}}catch(V){H(V);return}z(Z)}return e.OPTIONS=r,e}function $n(r,e,t,s=t){let a,n,o;return e?(Ie.forEach(e,(l,c,u)=>{let f=c?l.slice(1,l.length-1):l;r=r.resolve({context:s,parent:a,value:t});let h=r.type==="tuple",p=u?parseInt(f,10):0;if(r.innerType||h){if(h&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(t&&p>=t.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${l}, in the path: ${e}. because there is no value at that index. `);a=t,t=t&&t[p],r=h?r.spec.types[p]:r.innerType}if(!u){if(!r.fields||!r.fields[f])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${o} which is a type: "${r.type}")`);a=t,t=t&&t[f],r=r.fields[f]}n=f,o=c?"["+l+"]":"."+l}),{schema:r,parent:a,parentPath:n}):{parent:a,parentPath:e,schema:r}}class gt extends Set{describe(){const e=[];for(const t of this.values())e.push(ze.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const s of this.values())t.push(e(s));return t}clone(){return new gt(this.values())}merge(e,t){const s=this.clone();return e.forEach(a=>s.add(a)),t.forEach(a=>s.delete(a)),s}}function Re(r,e=new Map){if(Pt(r)||!r||typeof r!="object")return r;if(e.has(r))return e.get(r);let t;if(r instanceof Date)t=new Date(r.getTime()),e.set(r,t);else if(r instanceof RegExp)t=new RegExp(r),e.set(r,t);else if(Array.isArray(r)){t=new Array(r.length),e.set(r,t);for(let s=0;s<r.length;s++)t[s]=Re(r[s],e)}else if(r instanceof Map){t=new Map,e.set(r,t);for(const[s,a]of r.entries())t.set(s,Re(a,e))}else if(r instanceof Set){t=new Set,e.set(r,t);for(const s of r)t.add(Re(s,e))}else if(r instanceof Object){t={},e.set(r,t);for(const[s,a]of Object.entries(r))t[s]=Re(a,e)}else throw Error(`Unable to clone ${r}`);return t}class xe{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new gt,this._blacklist=new gt,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Ne.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(t=>{t.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=Re(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(e.length===0)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let s=e(this);return this._mutate=t,s}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,s=e.clone();const a=Object.assign({},t.spec,s.spec);return s.spec=a,s.internalTests=Object.assign({},t.internalTests,s.internalTests),s._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),s._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),s.tests=t.tests,s.exclusiveTests=t.exclusiveTests,s.withMutation(n=>{e.tests.forEach(o=>{n.test(o.OPTIONS)})}),s.transforms=[...t.transforms,...s.transforms],s}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let s=t.conditions;t=t.clone(),t.conditions=[],t=s.reduce((a,n)=>n.resolve(a,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,s,a,n;return Object.assign({},e,{from:e.from||[],strict:(t=e.strict)!=null?t:this.spec.strict,abortEarly:(s=e.abortEarly)!=null?s:this.spec.abortEarly,recursive:(a=e.recursive)!=null?a:this.spec.recursive,disableStackTrace:(n=e.disableStackTrace)!=null?n:this.spec.disableStackTrace})}cast(e,t={}){let s=this.resolve(Object.assign({value:e},t)),a=t.assert==="ignore-optionality",n=s._cast(e,t);if(t.assert!==!1&&!s.isType(n)){if(a&&Te(n))return n;let o=Ae(e),l=Ae(n);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${s.type}".
28
28
 
29
29
  attempted value: ${o}
30
- `+(l!==o?`result of cast: ${l}`:""))}return n}_cast(e,t){let s=e===void 0?e:this.transforms.reduce((a,n)=>n.call(this,a,e,this),e);return s===void 0&&(s=this.getDefault(t)),s}_validate(e,t={},s,a){let{path:n,originalValue:o=e,strict:l=this.spec.strict}=t,c=e;l||(c=this._cast(c,Object.assign({assert:!1},t)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:n,value:c,originalValue:o,options:t,tests:u},s,f=>{if(f.length)return a(f,c);this.runTests({path:n,value:c,originalValue:o,options:t,tests:this.tests},s,a)})}runTests(e,t,s){let a=!1,{tests:n,value:o,originalValue:l,path:c,options:u}=e,f=k=>{a||(a=!0,t(k,o))},h=k=>{a||(a=!0,s(k,o))},p=n.length,v=[];if(!p)return h([]);let F={value:o,originalValue:l,path:c,options:u,schema:this};for(let k=0;k<n.length;k++){const T=n[k];T(F,f,function(x){x&&(Array.isArray(x)?v.push(...x):v.push(x)),--p<=0&&h(v)})}}asNestedTest({key:e,index:t,parent:s,parentPath:a,originalParent:n,options:o}){const l=e??t;if(l==null)throw TypeError("Must include `key` or `index` for nested validations");const c=typeof l=="number";let u=s[l];const f=Object.assign({},o,{strict:!0,parent:s,value:u,originalValue:n[l],key:void 0,[c?"index":"key"]:l,path:c||l.includes(".")?`${a||""}[${c?l:`"${l}"`}]`:(a?`${a}.`:"")+e});return(h,p,v)=>this.resolve(f)._validate(u,f,p,v)}validate(e,t){var s;let a=this.resolve(Object.assign({},t,{value:e})),n=(s=t==null?void 0:t.disableStackTrace)!=null?s:a.spec.disableStackTrace;return new Promise((o,l)=>a._validate(e,t,(c,u)=>{me.isError(c)&&(c.value=u),l(c)},(c,u)=>{c.length?l(new me(c,u,void 0,void 0,n)):o(u)}))}validateSync(e,t){var s;let a=this.resolve(Object.assign({},t,{value:e})),n,o=(s=t==null?void 0:t.disableStackTrace)!=null?s:a.spec.disableStackTrace;return a._validate(e,Object.assign({},t,{sync:!0}),(l,c)=>{throw me.isError(l)&&(l.value=c),l},(l,c)=>{if(l.length)throw new me(l,e,void 0,void 0,o);n=c}),n}isValid(e,t){return this.validate(e,t).then(()=>!0,s=>{if(me.isError(s))return!1;throw s})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(s){if(me.isError(s))return!1;throw s}}_getDefault(e){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this,e):Re(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const s=this.clone({nullable:e});return s.internalTests.nullable=Ue({message:t,name:"nullable",test(a){return a===null?this.schema.spec.nullable:!0}}),s}optionality(e,t){const s=this.clone({optional:e});return s.internalTests.optionality=Ue({message:t,name:"optionality",test(a){return a===void 0?this.schema.spec.optional:!0}}),s}optional(){return this.optionality(!0)}defined(e=Ne.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Ne.notNull){return this.nullability(!1,e)}required(e=Ne.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(e.length===1?typeof e[0]=="function"?t={test:e[0]}:t=e[0]:e.length===2?t={name:e[0],test:e[1]}:t={name:e[0],message:e[1],test:e[2]},t.message===void 0&&(t.message=Ne.default),typeof t.test!="function")throw new TypeError("`test` is a required parameters");let s=this.clone(),a=Ue(t),n=t.exclusive||t.name&&s.exclusiveTests[t.name]===!0;if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(s.exclusiveTests[t.name]=!!t.exclusive),s.tests=s.tests.filter(o=>!(o.OPTIONS.name===t.name&&(n||o.OPTIONS.test===a.OPTIONS.test))),s.tests.push(a),s}when(e,t){!Array.isArray(e)&&typeof e!="string"&&(t=e,e=".");let s=this.clone(),a=os(e).map(n=>new ze(n));return a.forEach(n=>{n.isSibling&&s.deps.push(n.key)}),s.conditions.push(typeof t=="function"?new pt(a,t):pt.fromOptions(a,t)),s}typeError(e){let t=this.clone();return t.internalTests.typeError=Ue({message:e,name:"typeError",skipAbsent:!0,test(s){return this.schema._typeCheck(s)?!0:this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=Ne.oneOf){let s=this.clone();return e.forEach(a=>{s._whitelist.add(a),s._blacklist.delete(a)}),s.internalTests.whiteList=Ue({message:t,name:"oneOf",skipAbsent:!0,test(a){let n=this.schema._whitelist,o=n.resolveAll(this.resolve);return o.includes(a)?!0:this.createError({params:{values:Array.from(n).join(", "),resolved:o}})}}),s}notOneOf(e,t=Ne.notOneOf){let s=this.clone();return e.forEach(a=>{s._blacklist.add(a),s._whitelist.delete(a)}),s.internalTests.blacklist=Ue({message:t,name:"notOneOf",test(a){let n=this.schema._blacklist,o=n.resolveAll(this.resolve);return o.includes(a)?this.createError({params:{values:Array.from(n).join(", "),resolved:o}}):!0}}),s}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:s,meta:a,optional:n,nullable:o}=t.spec;return{meta:a,label:s,optional:n,nullable:o,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.map(c=>({name:c.OPTIONS.name,params:c.OPTIONS.params})).filter((c,u,f)=>f.findIndex(h=>h.name===c.name)===u)}}}xe.prototype.__isYupSchema__=!0;for(const r of["validate","validateSync"])xe.prototype[`${r}At`]=function(e,t,s={}){const{parent:a,parentPath:n,schema:o}=$n(this,e,t,s.context);return o[r](a&&a[n],Object.assign({},s,{parent:a,path:e}))};for(const r of["equals","is"])xe.prototype[r]=xe.prototype.oneOf;for(const r of["not","nope"])xe.prototype[r]=xe.prototype.notOneOf;const Dn=()=>!0;function Ut(r){return new us(r)}class us extends xe{constructor(e){super(typeof e=="function"?{type:"mixed",check:e}:Object.assign({type:"mixed",check:Dn},e))}}Ut.prototype=us.prototype;const Mn=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Vn(r){const e=Rt(r);if(!e)return Date.parse?Date.parse(r):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let t=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(t=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(t=0-t)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+t,e.second,e.millisecond)}function Rt(r){var e,t;const s=Mn.exec(r);return s?{year:Ce(s[1]),month:Ce(s[2],1)-1,day:Ce(s[3],1),hour:Ce(s[4]),minute:Ce(s[5]),second:Ce(s[6]),millisecond:s[7]?Ce(s[7].substring(0,3)):0,precision:(e=(t=s[7])==null?void 0:t.length)!=null?e:void 0,z:s[8]||void 0,plusMinus:s[9]||void 0,hourOffset:Ce(s[10]),minuteOffset:Ce(s[11])}:null}function Ce(r,e=0){return Number(r)||e}let Ln=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,In=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,zn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Pn="^\\d{4}-\\d{2}-\\d{2}",Un="\\d{2}:\\d{2}:\\d{2}",Rn="(([+-]\\d{2}(:?\\d{2})?)|Z)",Bn=new RegExp(`${Pn}T${Un}(\\.\\d+)?${Rn}$`),Zn=r=>Te(r)||r===r.trim(),Wn={}.toString();function fs(){return new hs}class hs extends xe{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,t,s)=>{if(!s.spec.coerce||s.isType(e)||Array.isArray(e))return e;const a=e!=null&&e.toString?e.toString():e;return a===Wn?e:a})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||Ne.required,name:"required",skipAbsent:!0,test:s=>!!s.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(t=>t.OPTIONS.name!=="required"),e))}length(e,t=ge.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(s){return s.length===this.resolve(e)}})}min(e,t=ge.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s.length>=this.resolve(e)}})}max(e,t=ge.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(s){return s.length<=this.resolve(e)}})}matches(e,t){let s=!1,a,n;return t&&(typeof t=="object"?{excludeEmptyString:s=!1,message:a,name:n}=t:a=t),this.test({name:n||"matches",message:a||ge.matches,params:{regex:e},skipAbsent:!0,test:o=>o===""&&s||o.search(e)!==-1})}email(e=ge.email){return this.matches(Ln,{name:"email",message:e,excludeEmptyString:!0})}url(e=ge.url){return this.matches(In,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=ge.uuid){return this.matches(zn,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t="",s,a;return e&&(typeof e=="object"?{message:t="",allowOffset:s=!1,precision:a=void 0}=e:t=e),this.matches(Bn,{name:"datetime",message:t||ge.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:t||ge.datetime_offset,params:{allowOffset:s},skipAbsent:!0,test:n=>{if(!n||s)return!0;const o=Rt(n);return o?!!o.z:!1}}).test({name:"datetime_precision",message:t||ge.datetime_precision,params:{precision:a},skipAbsent:!0,test:n=>{if(!n||a==null)return!0;const o=Rt(n);return o?o.precision===a:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=ge.trim){return this.transform(t=>t!=null?t.trim():t).test({message:e,name:"trim",test:Zn})}lowercase(e=ge.lowercase){return this.transform(t=>Te(t)?t:t.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Te(t)||t===t.toLowerCase()})}uppercase(e=ge.uppercase){return this.transform(t=>Te(t)?t:t.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Te(t)||t===t.toUpperCase()})}}fs.prototype=hs.prototype;let qn=r=>r!=+r;function ps(){return new ms}class ms extends xe{constructor(){super({type:"number",check(e){return e instanceof Number&&(e=e.valueOf()),typeof e=="number"&&!qn(e)}}),this.withMutation(()=>{this.transform((e,t,s)=>{if(!s.spec.coerce)return e;let a=e;if(typeof a=="string"){if(a=a.replace(/\s/g,""),a==="")return NaN;a=+a}return s.isType(a)||a===null?a:parseFloat(a)})})}min(e,t=$e.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s>=this.resolve(e)}})}max(e,t=$e.max){return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(s){return s<=this.resolve(e)}})}lessThan(e,t=$e.lessThan){return this.test({message:t,name:"max",exclusive:!0,params:{less:e},skipAbsent:!0,test(s){return s<this.resolve(e)}})}moreThan(e,t=$e.moreThan){return this.test({message:t,name:"min",exclusive:!0,params:{more:e},skipAbsent:!0,test(s){return s>this.resolve(e)}})}positive(e=$e.positive){return this.moreThan(0,e)}negative(e=$e.negative){return this.lessThan(0,e)}integer(e=$e.integer){return this.test({name:"integer",message:e,skipAbsent:!0,test:t=>Number.isInteger(t)})}truncate(){return this.transform(e=>Te(e)?e:e|0)}round(e){var t;let s=["ceil","floor","round","trunc"];if(e=((t=e)==null?void 0:t.toLowerCase())||"round",e==="trunc")return this.truncate();if(s.indexOf(e.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+s.join(", "));return this.transform(a=>Te(a)?a:Math[e](a))}}ps.prototype=ms.prototype;let gs=new Date(""),Hn=r=>Object.prototype.toString.call(r)==="[object Date]";function Bt(){return new Qe}class Qe extends xe{constructor(){super({type:"date",check(e){return Hn(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,t,s)=>!s.spec.coerce||s.isType(e)||e===null?e:(e=Vn(e),isNaN(e)?Qe.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let s;if(ze.isRef(e))s=e;else{let a=this.cast(e);if(!this._typeCheck(a))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);s=a}return s}min(e,t=zt.min){let s=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(a){return a>=this.resolve(s)}})}max(e,t=zt.max){let s=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(a){return a<=this.resolve(s)}})}}Qe.INVALID_DATE=gs,Bt.prototype=Qe.prototype,Bt.INVALID_DATE=gs;function Yn(r,e=[]){let t=[],s=new Set,a=new Set(e.map(([o,l])=>`${o}-${l}`));function n(o,l){let c=Ie.split(o)[0];s.add(c),a.has(`${l}-${c}`)||t.push([l,c])}for(const o of Object.keys(r)){let l=r[o];s.add(o),ze.isRef(l)&&l.isSibling?n(l.path,o):Pt(l)&&"deps"in l&&l.deps.forEach(c=>n(c,o))}return En.array(Array.from(s),t).reverse()}function bs(r,e){let t=1/0;return r.some((s,a)=>{var n;if((n=e.path)!=null&&n.includes(s))return t=a,!0}),t}function vs(r){return(e,t)=>bs(r,e)-bs(r,t)}const Gn=(r,e,t)=>{if(typeof r!="string")return r;let s=r;try{s=JSON.parse(r)}catch{}return t.isType(s)?s:r};function bt(r){if("fields"in r){const e={};for(const[t,s]of Object.entries(r.fields))e[t]=bt(s);return r.setFields(e)}if(r.type==="array"){const e=r.optional();return e.innerType&&(e.innerType=bt(e.innerType)),e}return r.type==="tuple"?r.optional().clone({types:r.spec.types.map(bt)}):"optional"in r?r.optional():r}const Xn=(r,e)=>{const t=[...Ie.normalizePath(e)];if(t.length===1)return t[0]in r;let s=t.pop(),a=Ie.getter(Ie.join(t),!0)(r);return!!(a&&s in a)};let xs=r=>Object.prototype.toString.call(r)==="[object Object]";function ys(r,e){let t=Object.keys(r.fields);return Object.keys(e).filter(s=>t.indexOf(s)===-1)}const Jn=vs([]);function ws(r){return new ks(r)}class ks extends xe{constructor(e){super({type:"object",check(t){return xs(t)||typeof t=="function"}}),this.fields=Object.create(null),this._sortErrors=Jn,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var s;let a=super._cast(e,t);if(a===void 0)return this.getDefault(t);if(!this._typeCheck(a))return a;let n=this.fields,o=(s=t.stripUnknown)!=null?s:this.spec.noUnknown,l=[].concat(this._nodes,Object.keys(a).filter(h=>!this._nodes.includes(h))),c={},u=Object.assign({},t,{parent:c,__validating:t.__validating||!1}),f=!1;for(const h of l){let p=n[h],v=h in a;if(p){let F,k=a[h];u.path=(t.path?`${t.path}.`:"")+h,p=p.resolve({value:k,context:t.context,parent:c});let T=p instanceof xe?p.spec:void 0,y=T==null?void 0:T.strict;if(T!=null&&T.strip){f=f||h in a;continue}F=!t.__validating||!y?p.cast(a[h],u):a[h],F!==void 0&&(c[h]=F)}else v&&!o&&(c[h]=a[h]);(v!==h in c||c[h]!==a[h])&&(f=!0)}return f?c:a}_validate(e,t={},s,a){let{from:n=[],originalValue:o=e,recursive:l=this.spec.recursive}=t;t.from=[{schema:this,value:o},...n],t.__validating=!0,t.originalValue=o,super._validate(e,t,s,(c,u)=>{if(!l||!xs(u)){a(c,u);return}o=o||u;let f=[];for(let h of this._nodes){let p=this.fields[h];!p||ze.isRef(p)||f.push(p.asNestedTest({options:t,key:h,parent:u,parentPath:t.path,originalParent:o}))}this.runTests({tests:f,value:u,originalValue:o,options:t},s,h=>{a(h.sort(this._sortErrors).concat(c),u)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),s=t.fields;for(let[a,n]of Object.entries(this.fields)){const o=s[a];s[a]=o===void 0?n:o}return t.withMutation(a=>a.setFields(s,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(s=>{var a;const n=this.fields[s];let o=e;(a=o)!=null&&a.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[s]})),t[s]=n&&"getDefault"in n?n.getDefault(o):void 0}),t}setFields(e,t){let s=this.clone();return s.fields=e,s._nodes=Yn(e,t),s._sortErrors=vs(Object.keys(e)),t&&(s._excludedEdges=t),s}shape(e,t=[]){return this.clone().withMutation(s=>{let a=s._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),a=[...s._excludedEdges,...t]),s.setFields(Object.assign(s.fields,e),a)})}partial(){const e={};for(const[t,s]of Object.entries(this.fields))e[t]="optional"in s&&s.optional instanceof Function?s.optional():s;return this.setFields(e)}deepPartial(){return bt(this)}pick(e){const t={};for(const s of e)this.fields[s]&&(t[s]=this.fields[s]);return this.setFields(t,this._excludedEdges.filter(([s,a])=>e.includes(s)&&e.includes(a)))}omit(e){const t=[];for(const s of Object.keys(this.fields))e.includes(s)||t.push(s);return this.pick(t)}from(e,t,s){let a=Ie.getter(e,!0);return this.transform(n=>{if(!n)return n;let o=n;return Xn(n,e)&&(o=Object.assign({},n),s||delete o[e],o[t]=a(n)),o})}json(){return this.transform(Gn)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||ht.exact,test(t){if(t==null)return!0;const s=ys(this.schema,t);return s.length===0||this.createError({params:{properties:s.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=ht.noUnknown){typeof e!="boolean"&&(t=e,e=!0);let s=this.test({name:"noUnknown",exclusive:!0,message:t,test(a){if(a==null)return!0;const n=ys(this.schema,a);return!e||n.length===0||this.createError({params:{unknown:n.join(", ")}})}});return s.spec.noUnknown=e,s}unknown(e=!0,t=ht.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const s={};for(const a of Object.keys(t))s[e(a)]=t[a];return s})}camelCase(){return this.transformKeys(It.camelCase)}snakeCase(){return this.transformKeys(It.snakeCase)}constantCase(){return this.transformKeys(e=>It.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),s=super.describe(e);s.fields={};for(const[n,o]of Object.entries(t.fields)){var a;let l=e;(a=l)!=null&&a.value&&(l=Object.assign({},l,{parent:l.value,value:l.value[n]})),s.fields[n]=o.describe(l)}return s}}ws.prototype=ks.prototype;function Kn({fields:r,explicitSchema:e}){return b.useMemo(()=>{if(e)return ts(e);const t={};r.forEach(a=>{var o,l,c,u,f,h,p;let n;switch(a.type){case"text":case"password":case"email":if(n=fs(),(o=a.validation)!=null&&o.required){const v=typeof a.validation.required=="string"?a.validation.required:"Campo obligatorio";n=n.required(v)}(l=a.validation)!=null&&l.minLength&&(n=n.min(a.validation.minLength.value,a.validation.minLength.message)),(c=a.validation)!=null&&c.maxLength&&(n=n.max(a.validation.maxLength.value,a.validation.maxLength.message)),(u=a.validation)!=null&&u.pattern&&(n=n.matches(a.validation.pattern.value,a.validation.pattern.message)),a.type==="email"&&(n=n.email("Email inválido"));break;case"number":if(n=ps(),(f=a.validation)!=null&&f.required){const v=typeof a.validation.required=="string"?a.validation.required:"Campo obligatorio";n=n.required(v)}break;case"select":case"optionGroup":if(n=Ut(),(h=a.validation)!=null&&h.required){const v=typeof a.validation.required=="string"?a.validation.required:"Campo obligatorio";n=n.required(v)}break;case"date":if(n=Bt(),(p=a.validation)!=null&&p.required){const v=typeof a.validation.required=="string"?a.validation.required:"Campo obligatorio";n=n.required(v)}break;default:n=Ut()}t[a.name]=n});const s=ws().shape(t);return ts(s)},[r,e])}function Qn(r){return b.useMemo(()=>{const e={};return r.forEach(t=>{e[t.name]=t}),e},[r])}function eo(r){const e=b.useMemo(()=>r.filter(o=>o.type==="select"&&o.loadOptions),[r]),[t,s]=b.useState(e.length),[a,n]=b.useState({});return b.useEffect(()=>{e.length!==0&&e.forEach(o=>{o.loadOptions().then(l=>n(c=>({...c,[o.name]:l}))).finally(()=>s(l=>Math.max(0,l-1)))})},[e]),{loadingCount:t,optionsMap:a}}function to(r,e){const t=b.useMemo(()=>r.filter(o=>o.disabledWhen),[r]),s=b.useMemo(()=>t.map(o=>o.disabledWhen.watchField),[t]),a=dr({control:e,name:s}),n={};return t.forEach(o=>{const l=s.indexOf(o.disabledWhen.watchField),c=a[l];n[o.name]=c===o.disabledWhen.watchValue}),n}const js={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},ro={sm:"px-2 py-1",md:"px-3 py-2",lg:"px-4 py-3"};function Zt({control:r,name:e,rules:t,defaultValue:s,size:a="sm",width:n="100%",label:o,labelHidden:l=!1,hasError:c=!1,errorMessage:u="",maxLength:f,showCounter:h=!1,className:p,...v}){const F=b.useId(),k=e||F,[T,y]=b.useState(s||"");if(r&&e)return i.jsx(ke,{name:e,control:r,rules:t,defaultValue:s||"",render:({field:j,fieldState:A})=>{var S;return i.jsx(Zt,{...v,size:a,width:n,label:o,labelHidden:l,hasError:!!A.error,errorMessage:((S=A.error)==null?void 0:S.message)||"",maxLength:f,showCounter:h,className:p,value:j.value,onChange:j.onChange})}});b.useEffect(()=>{y(s||"")},[s]);const x=j=>{var A;f!==void 0&&j.target.value.length>f||(y(j.target.value),(A=v.onChange)==null||A.call(v,j))};return i.jsxs("div",{className:D("flex flex-col",p),style:{width:n},children:[o&&i.jsx("label",{htmlFor:k,className:D("pb-2 text-[var(--color-ds-text-primary)]",js[a],l&&"sr-only"),children:o}),i.jsx("textarea",{id:k,className:D("box-border bg-[var(--color-ds-background-page)] w-full resize vertical rounded-lg border outline-none transition font-[var(--font-primary)]",js[a],ro[a],c?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",v.disabled?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-secondary)] cursor-not-allowed":"text-[var(--color-ds-text-primary)]"),value:T,onChange:x,maxLength:f,...v}),i.jsxs("div",{className:"flex justify-between pt-1 min-h-[18px]",children:[c&&u?i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:u}):i.jsx("span",{"aria-hidden":"true",children:" "}),h&&f!==void 0&&i.jsxs("span",{className:"text-xs text-[var(--color-ds-text-secondary)]",children:[T.length,"/",f]})]})]})}const so={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function Es({control:r,name:e,rules:t,defaultValue:s=!1,label:a,labelHidden:n=!1,disabled:o=!1,size:l="sm",className:c,hasError:u=!1,errorMessage:f=""}){return i.jsx("div",{className:D("flex flex-col",c),children:i.jsx(ke,{name:e,control:r,rules:t,defaultValue:s,render:({field:h,fieldState:p})=>{const v=p.error;return i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("input",{id:e,type:"checkbox",className:D(so[l],"text-[var(--color-ds-button-primary-bg)]","border-[var(--color-ds-border-default)]",o&&"opacity-50 cursor-not-allowed"),checked:h.value,onChange:F=>h.onChange(F.target.checked),disabled:o}),i.jsx("span",{className:D("text-[var(--color-ds-text-primary)] text-ds-md",o&&"text-[var(--color-ds-text-secondary)]"),children:a}),u&&(v==null?void 0:v.message)&&i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:v.message})]})}})})}function _s({name:r,control:e,searchFn:t,label:s,size:a="sm",width:n="100%",disabled:o=!1}){const{getValues:l,watch:c}=He(),[u,f]=b.useState([]),[h,p]=b.useState(!1),[v,F]=b.useState(!1),k=b.useRef(null),T=async j=>{if(j){p(!0);try{const A=await t(j,{getValues:l,watch:c});f(A),F(!0)}finally{p(!1)}}};b.useEffect(()=>{function j(A){k.current&&!k.current.contains(A.target)&&F(!1)}if(v)return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[v]);const y=a==="sm"?"text-ds-sm":a==="md"?"text-ds-md":"text-ds-lg",x=a==="sm"?"h-6":a==="md"?"h-10":"h-12";return i.jsx(ke,{name:r,control:e,render:({field:j,fieldState:A})=>{var S;return i.jsxs("div",{ref:k,className:"relative flex flex-col",style:{width:n},children:[s&&i.jsx("label",{className:`pb-2 text-[var(--color-ds-text-primary)] ${y}`,children:s}),i.jsx(ct,{className:"rounded-r-none",type:"text",size:a,width:"100%",value:j.value,onChange:z=>j.onChange(z.target.value),disabled:o,hasError:A.invalid,errorMessage:(S=A.error)==null?void 0:S.message,suffixButton:i.jsx(Fe,{type:"button",className:"!rounded-l-none",size:a,variant:"primary",onClick:()=>T(j.value),disabled:o,children:"Buscar"})}),h&&i.jsx("div",{className:`
30
+ `+(l!==o?`result of cast: ${l}`:""))}return n}_cast(e,t){let s=e===void 0?e:this.transforms.reduce((a,n)=>n.call(this,a,e,this),e);return s===void 0&&(s=this.getDefault(t)),s}_validate(e,t={},s,a){let{path:n,originalValue:o=e,strict:l=this.spec.strict}=t,c=e;l||(c=this._cast(c,Object.assign({assert:!1},t)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:n,value:c,originalValue:o,options:t,tests:u},s,f=>{if(f.length)return a(f,c);this.runTests({path:n,value:c,originalValue:o,options:t,tests:this.tests},s,a)})}runTests(e,t,s){let a=!1,{tests:n,value:o,originalValue:l,path:c,options:u}=e,f=k=>{a||(a=!0,t(k,o))},h=k=>{a||(a=!0,s(k,o))},p=n.length,v=[];if(!p)return h([]);let F={value:o,originalValue:l,path:c,options:u,schema:this};for(let k=0;k<n.length;k++){const T=n[k];T(F,f,function(x){x&&(Array.isArray(x)?v.push(...x):v.push(x)),--p<=0&&h(v)})}}asNestedTest({key:e,index:t,parent:s,parentPath:a,originalParent:n,options:o}){const l=e??t;if(l==null)throw TypeError("Must include `key` or `index` for nested validations");const c=typeof l=="number";let u=s[l];const f=Object.assign({},o,{strict:!0,parent:s,value:u,originalValue:n[l],key:void 0,[c?"index":"key"]:l,path:c||l.includes(".")?`${a||""}[${c?l:`"${l}"`}]`:(a?`${a}.`:"")+e});return(h,p,v)=>this.resolve(f)._validate(u,f,p,v)}validate(e,t){var s;let a=this.resolve(Object.assign({},t,{value:e})),n=(s=t==null?void 0:t.disableStackTrace)!=null?s:a.spec.disableStackTrace;return new Promise((o,l)=>a._validate(e,t,(c,u)=>{me.isError(c)&&(c.value=u),l(c)},(c,u)=>{c.length?l(new me(c,u,void 0,void 0,n)):o(u)}))}validateSync(e,t){var s;let a=this.resolve(Object.assign({},t,{value:e})),n,o=(s=t==null?void 0:t.disableStackTrace)!=null?s:a.spec.disableStackTrace;return a._validate(e,Object.assign({},t,{sync:!0}),(l,c)=>{throw me.isError(l)&&(l.value=c),l},(l,c)=>{if(l.length)throw new me(l,e,void 0,void 0,o);n=c}),n}isValid(e,t){return this.validate(e,t).then(()=>!0,s=>{if(me.isError(s))return!1;throw s})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(s){if(me.isError(s))return!1;throw s}}_getDefault(e){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this,e):Re(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const s=this.clone({nullable:e});return s.internalTests.nullable=Ue({message:t,name:"nullable",test(a){return a===null?this.schema.spec.nullable:!0}}),s}optionality(e,t){const s=this.clone({optional:e});return s.internalTests.optionality=Ue({message:t,name:"optionality",test(a){return a===void 0?this.schema.spec.optional:!0}}),s}optional(){return this.optionality(!0)}defined(e=Ne.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Ne.notNull){return this.nullability(!1,e)}required(e=Ne.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(e.length===1?typeof e[0]=="function"?t={test:e[0]}:t=e[0]:e.length===2?t={name:e[0],test:e[1]}:t={name:e[0],message:e[1],test:e[2]},t.message===void 0&&(t.message=Ne.default),typeof t.test!="function")throw new TypeError("`test` is a required parameters");let s=this.clone(),a=Ue(t),n=t.exclusive||t.name&&s.exclusiveTests[t.name]===!0;if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(s.exclusiveTests[t.name]=!!t.exclusive),s.tests=s.tests.filter(o=>!(o.OPTIONS.name===t.name&&(n||o.OPTIONS.test===a.OPTIONS.test))),s.tests.push(a),s}when(e,t){!Array.isArray(e)&&typeof e!="string"&&(t=e,e=".");let s=this.clone(),a=os(e).map(n=>new ze(n));return a.forEach(n=>{n.isSibling&&s.deps.push(n.key)}),s.conditions.push(typeof t=="function"?new pt(a,t):pt.fromOptions(a,t)),s}typeError(e){let t=this.clone();return t.internalTests.typeError=Ue({message:e,name:"typeError",skipAbsent:!0,test(s){return this.schema._typeCheck(s)?!0:this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=Ne.oneOf){let s=this.clone();return e.forEach(a=>{s._whitelist.add(a),s._blacklist.delete(a)}),s.internalTests.whiteList=Ue({message:t,name:"oneOf",skipAbsent:!0,test(a){let n=this.schema._whitelist,o=n.resolveAll(this.resolve);return o.includes(a)?!0:this.createError({params:{values:Array.from(n).join(", "),resolved:o}})}}),s}notOneOf(e,t=Ne.notOneOf){let s=this.clone();return e.forEach(a=>{s._blacklist.add(a),s._whitelist.delete(a)}),s.internalTests.blacklist=Ue({message:t,name:"notOneOf",test(a){let n=this.schema._blacklist,o=n.resolveAll(this.resolve);return o.includes(a)?this.createError({params:{values:Array.from(n).join(", "),resolved:o}}):!0}}),s}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:s,meta:a,optional:n,nullable:o}=t.spec;return{meta:a,label:s,optional:n,nullable:o,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.map(c=>({name:c.OPTIONS.name,params:c.OPTIONS.params})).filter((c,u,f)=>f.findIndex(h=>h.name===c.name)===u)}}}xe.prototype.__isYupSchema__=!0;for(const r of["validate","validateSync"])xe.prototype[`${r}At`]=function(e,t,s={}){const{parent:a,parentPath:n,schema:o}=$n(this,e,t,s.context);return o[r](a&&a[n],Object.assign({},s,{parent:a,path:e}))};for(const r of["equals","is"])xe.prototype[r]=xe.prototype.oneOf;for(const r of["not","nope"])xe.prototype[r]=xe.prototype.notOneOf;const Dn=()=>!0;function Ut(r){return new us(r)}class us extends xe{constructor(e){super(typeof e=="function"?{type:"mixed",check:e}:Object.assign({type:"mixed",check:Dn},e))}}Ut.prototype=us.prototype;const Mn=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Vn(r){const e=Rt(r);if(!e)return Date.parse?Date.parse(r):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let t=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(t=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(t=0-t)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+t,e.second,e.millisecond)}function Rt(r){var e,t;const s=Mn.exec(r);return s?{year:Ce(s[1]),month:Ce(s[2],1)-1,day:Ce(s[3],1),hour:Ce(s[4]),minute:Ce(s[5]),second:Ce(s[6]),millisecond:s[7]?Ce(s[7].substring(0,3)):0,precision:(e=(t=s[7])==null?void 0:t.length)!=null?e:void 0,z:s[8]||void 0,plusMinus:s[9]||void 0,hourOffset:Ce(s[10]),minuteOffset:Ce(s[11])}:null}function Ce(r,e=0){return Number(r)||e}let Ln=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,In=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,zn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Pn="^\\d{4}-\\d{2}-\\d{2}",Un="\\d{2}:\\d{2}:\\d{2}",Rn="(([+-]\\d{2}(:?\\d{2})?)|Z)",Bn=new RegExp(`${Pn}T${Un}(\\.\\d+)?${Rn}$`),Zn=r=>Te(r)||r===r.trim(),Wn={}.toString();function fs(){return new hs}class hs extends xe{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,t,s)=>{if(!s.spec.coerce||s.isType(e)||Array.isArray(e))return e;const a=e!=null&&e.toString?e.toString():e;return a===Wn?e:a})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||Ne.required,name:"required",skipAbsent:!0,test:s=>!!s.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(t=>t.OPTIONS.name!=="required"),e))}length(e,t=ge.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(s){return s.length===this.resolve(e)}})}min(e,t=ge.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s.length>=this.resolve(e)}})}max(e,t=ge.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(s){return s.length<=this.resolve(e)}})}matches(e,t){let s=!1,a,n;return t&&(typeof t=="object"?{excludeEmptyString:s=!1,message:a,name:n}=t:a=t),this.test({name:n||"matches",message:a||ge.matches,params:{regex:e},skipAbsent:!0,test:o=>o===""&&s||o.search(e)!==-1})}email(e=ge.email){return this.matches(Ln,{name:"email",message:e,excludeEmptyString:!0})}url(e=ge.url){return this.matches(In,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=ge.uuid){return this.matches(zn,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t="",s,a;return e&&(typeof e=="object"?{message:t="",allowOffset:s=!1,precision:a=void 0}=e:t=e),this.matches(Bn,{name:"datetime",message:t||ge.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:t||ge.datetime_offset,params:{allowOffset:s},skipAbsent:!0,test:n=>{if(!n||s)return!0;const o=Rt(n);return o?!!o.z:!1}}).test({name:"datetime_precision",message:t||ge.datetime_precision,params:{precision:a},skipAbsent:!0,test:n=>{if(!n||a==null)return!0;const o=Rt(n);return o?o.precision===a:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=ge.trim){return this.transform(t=>t!=null?t.trim():t).test({message:e,name:"trim",test:Zn})}lowercase(e=ge.lowercase){return this.transform(t=>Te(t)?t:t.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Te(t)||t===t.toLowerCase()})}uppercase(e=ge.uppercase){return this.transform(t=>Te(t)?t:t.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Te(t)||t===t.toUpperCase()})}}fs.prototype=hs.prototype;let qn=r=>r!=+r;function ps(){return new ms}class ms extends xe{constructor(){super({type:"number",check(e){return e instanceof Number&&(e=e.valueOf()),typeof e=="number"&&!qn(e)}}),this.withMutation(()=>{this.transform((e,t,s)=>{if(!s.spec.coerce)return e;let a=e;if(typeof a=="string"){if(a=a.replace(/\s/g,""),a==="")return NaN;a=+a}return s.isType(a)||a===null?a:parseFloat(a)})})}min(e,t=$e.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s>=this.resolve(e)}})}max(e,t=$e.max){return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(s){return s<=this.resolve(e)}})}lessThan(e,t=$e.lessThan){return this.test({message:t,name:"max",exclusive:!0,params:{less:e},skipAbsent:!0,test(s){return s<this.resolve(e)}})}moreThan(e,t=$e.moreThan){return this.test({message:t,name:"min",exclusive:!0,params:{more:e},skipAbsent:!0,test(s){return s>this.resolve(e)}})}positive(e=$e.positive){return this.moreThan(0,e)}negative(e=$e.negative){return this.lessThan(0,e)}integer(e=$e.integer){return this.test({name:"integer",message:e,skipAbsent:!0,test:t=>Number.isInteger(t)})}truncate(){return this.transform(e=>Te(e)?e:e|0)}round(e){var t;let s=["ceil","floor","round","trunc"];if(e=((t=e)==null?void 0:t.toLowerCase())||"round",e==="trunc")return this.truncate();if(s.indexOf(e.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+s.join(", "));return this.transform(a=>Te(a)?a:Math[e](a))}}ps.prototype=ms.prototype;let gs=new Date(""),Hn=r=>Object.prototype.toString.call(r)==="[object Date]";function Bt(){return new Qe}class Qe extends xe{constructor(){super({type:"date",check(e){return Hn(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,t,s)=>!s.spec.coerce||s.isType(e)||e===null?e:(e=Vn(e),isNaN(e)?Qe.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let s;if(ze.isRef(e))s=e;else{let a=this.cast(e);if(!this._typeCheck(a))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);s=a}return s}min(e,t=zt.min){let s=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(a){return a>=this.resolve(s)}})}max(e,t=zt.max){let s=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(a){return a<=this.resolve(s)}})}}Qe.INVALID_DATE=gs,Bt.prototype=Qe.prototype,Bt.INVALID_DATE=gs;function Yn(r,e=[]){let t=[],s=new Set,a=new Set(e.map(([o,l])=>`${o}-${l}`));function n(o,l){let c=Ie.split(o)[0];s.add(c),a.has(`${l}-${c}`)||t.push([l,c])}for(const o of Object.keys(r)){let l=r[o];s.add(o),ze.isRef(l)&&l.isSibling?n(l.path,o):Pt(l)&&"deps"in l&&l.deps.forEach(c=>n(c,o))}return En.array(Array.from(s),t).reverse()}function bs(r,e){let t=1/0;return r.some((s,a)=>{var n;if((n=e.path)!=null&&n.includes(s))return t=a,!0}),t}function vs(r){return(e,t)=>bs(r,e)-bs(r,t)}const Gn=(r,e,t)=>{if(typeof r!="string")return r;let s=r;try{s=JSON.parse(r)}catch{}return t.isType(s)?s:r};function bt(r){if("fields"in r){const e={};for(const[t,s]of Object.entries(r.fields))e[t]=bt(s);return r.setFields(e)}if(r.type==="array"){const e=r.optional();return e.innerType&&(e.innerType=bt(e.innerType)),e}return r.type==="tuple"?r.optional().clone({types:r.spec.types.map(bt)}):"optional"in r?r.optional():r}const Xn=(r,e)=>{const t=[...Ie.normalizePath(e)];if(t.length===1)return t[0]in r;let s=t.pop(),a=Ie.getter(Ie.join(t),!0)(r);return!!(a&&s in a)};let xs=r=>Object.prototype.toString.call(r)==="[object Object]";function ys(r,e){let t=Object.keys(r.fields);return Object.keys(e).filter(s=>t.indexOf(s)===-1)}const Jn=vs([]);function ws(r){return new ks(r)}class ks extends xe{constructor(e){super({type:"object",check(t){return xs(t)||typeof t=="function"}}),this.fields=Object.create(null),this._sortErrors=Jn,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var s;let a=super._cast(e,t);if(a===void 0)return this.getDefault(t);if(!this._typeCheck(a))return a;let n=this.fields,o=(s=t.stripUnknown)!=null?s:this.spec.noUnknown,l=[].concat(this._nodes,Object.keys(a).filter(h=>!this._nodes.includes(h))),c={},u=Object.assign({},t,{parent:c,__validating:t.__validating||!1}),f=!1;for(const h of l){let p=n[h],v=h in a;if(p){let F,k=a[h];u.path=(t.path?`${t.path}.`:"")+h,p=p.resolve({value:k,context:t.context,parent:c});let T=p instanceof xe?p.spec:void 0,y=T==null?void 0:T.strict;if(T!=null&&T.strip){f=f||h in a;continue}F=!t.__validating||!y?p.cast(a[h],u):a[h],F!==void 0&&(c[h]=F)}else v&&!o&&(c[h]=a[h]);(v!==h in c||c[h]!==a[h])&&(f=!0)}return f?c:a}_validate(e,t={},s,a){let{from:n=[],originalValue:o=e,recursive:l=this.spec.recursive}=t;t.from=[{schema:this,value:o},...n],t.__validating=!0,t.originalValue=o,super._validate(e,t,s,(c,u)=>{if(!l||!xs(u)){a(c,u);return}o=o||u;let f=[];for(let h of this._nodes){let p=this.fields[h];!p||ze.isRef(p)||f.push(p.asNestedTest({options:t,key:h,parent:u,parentPath:t.path,originalParent:o}))}this.runTests({tests:f,value:u,originalValue:o,options:t},s,h=>{a(h.sort(this._sortErrors).concat(c),u)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),s=t.fields;for(let[a,n]of Object.entries(this.fields)){const o=s[a];s[a]=o===void 0?n:o}return t.withMutation(a=>a.setFields(s,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(s=>{var a;const n=this.fields[s];let o=e;(a=o)!=null&&a.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[s]})),t[s]=n&&"getDefault"in n?n.getDefault(o):void 0}),t}setFields(e,t){let s=this.clone();return s.fields=e,s._nodes=Yn(e,t),s._sortErrors=vs(Object.keys(e)),t&&(s._excludedEdges=t),s}shape(e,t=[]){return this.clone().withMutation(s=>{let a=s._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),a=[...s._excludedEdges,...t]),s.setFields(Object.assign(s.fields,e),a)})}partial(){const e={};for(const[t,s]of Object.entries(this.fields))e[t]="optional"in s&&s.optional instanceof Function?s.optional():s;return this.setFields(e)}deepPartial(){return bt(this)}pick(e){const t={};for(const s of e)this.fields[s]&&(t[s]=this.fields[s]);return this.setFields(t,this._excludedEdges.filter(([s,a])=>e.includes(s)&&e.includes(a)))}omit(e){const t=[];for(const s of Object.keys(this.fields))e.includes(s)||t.push(s);return this.pick(t)}from(e,t,s){let a=Ie.getter(e,!0);return this.transform(n=>{if(!n)return n;let o=n;return Xn(n,e)&&(o=Object.assign({},n),s||delete o[e],o[t]=a(n)),o})}json(){return this.transform(Gn)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||ht.exact,test(t){if(t==null)return!0;const s=ys(this.schema,t);return s.length===0||this.createError({params:{properties:s.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=ht.noUnknown){typeof e!="boolean"&&(t=e,e=!0);let s=this.test({name:"noUnknown",exclusive:!0,message:t,test(a){if(a==null)return!0;const n=ys(this.schema,a);return!e||n.length===0||this.createError({params:{unknown:n.join(", ")}})}});return s.spec.noUnknown=e,s}unknown(e=!0,t=ht.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const s={};for(const a of Object.keys(t))s[e(a)]=t[a];return s})}camelCase(){return this.transformKeys(It.camelCase)}snakeCase(){return this.transformKeys(It.snakeCase)}constantCase(){return this.transformKeys(e=>It.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),s=super.describe(e);s.fields={};for(const[n,o]of Object.entries(t.fields)){var a;let l=e;(a=l)!=null&&a.value&&(l=Object.assign({},l,{parent:l.value,value:l.value[n]})),s.fields[n]=o.describe(l)}return s}}ws.prototype=ks.prototype;function Kn({fields:r,explicitSchema:e}){return b.useMemo(()=>{if(e)return ts(e);const t={};r.forEach(a=>{var o,l,c,u,f,h,p;let n;switch(a.type){case"text":case"password":case"email":if(n=fs(),(o=a.validation)!=null&&o.required){const v=typeof a.validation.required=="string"?a.validation.required:"Campo obligatorio";n=n.required(v)}(l=a.validation)!=null&&l.minLength&&(n=n.min(a.validation.minLength.value,a.validation.minLength.message)),(c=a.validation)!=null&&c.maxLength&&(n=n.max(a.validation.maxLength.value,a.validation.maxLength.message)),(u=a.validation)!=null&&u.pattern&&(n=n.matches(a.validation.pattern.value,a.validation.pattern.message)),a.type==="email"&&(n=n.email("Email inválido"));break;case"number":if(n=ps(),(f=a.validation)!=null&&f.required){const v=typeof a.validation.required=="string"?a.validation.required:"Campo obligatorio";n=n.required(v)}break;case"select":case"optionGroup":if(n=Ut(),(h=a.validation)!=null&&h.required){const v=typeof a.validation.required=="string"?a.validation.required:"Campo obligatorio";n=n.required(v)}break;case"date":if(n=Bt(),(p=a.validation)!=null&&p.required){const v=typeof a.validation.required=="string"?a.validation.required:"Campo obligatorio";n=n.required(v)}break;default:n=Ut()}t[a.name]=n});const s=ws().shape(t);return ts(s)},[r,e])}function Qn(r){return b.useMemo(()=>{const e={};return r.forEach(t=>{e[t.name]=t}),e},[r])}function eo(r){const e=b.useMemo(()=>r.filter(o=>o.type==="select"&&o.loadOptions),[r]),[t,s]=b.useState(e.length),[a,n]=b.useState({});return b.useEffect(()=>{e.length!==0&&e.forEach(o=>{o.loadOptions().then(l=>n(c=>({...c,[o.name]:l}))).finally(()=>s(l=>Math.max(0,l-1)))})},[e]),{loadingCount:t,optionsMap:a}}function to(r,e){const t=b.useMemo(()=>r.filter(o=>o.disabledWhen),[r]),s=b.useMemo(()=>t.map(o=>o.disabledWhen.watchField),[t]),a=dr({control:e,name:s}),n={};return t.forEach(o=>{const l=s.indexOf(o.disabledWhen.watchField),c=a[l];n[o.name]=c===o.disabledWhen.watchValue}),n}const js={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},ro={sm:"px-2 py-1",md:"px-3 py-2",lg:"px-4 py-3"};function Zt({control:r,name:e,rules:t,defaultValue:s,size:a="sm",width:n="100%",label:o,labelHidden:l=!1,hasError:c=!1,errorMessage:u="",maxLength:f,showCounter:h=!1,className:p,...v}){const F=b.useId(),k=e||F,[T,y]=b.useState(s||"");if(r&&e)return i.jsx(ke,{name:e,control:r,rules:t,defaultValue:s||"",render:({field:j,fieldState:A})=>{var S;return i.jsx(Zt,{...v,size:a,width:n,label:o,labelHidden:l,hasError:!!A.error,errorMessage:((S=A.error)==null?void 0:S.message)||"",maxLength:f,showCounter:h,className:p,value:j.value,onChange:j.onChange})}});b.useEffect(()=>{y(s||"")},[s]);const x=j=>{var A;f!==void 0&&j.target.value.length>f||(y(j.target.value),(A=v.onChange)==null||A.call(v,j))};return i.jsxs("div",{className:D("flex flex-col",p),style:{width:n},children:[o&&i.jsx("label",{htmlFor:k,className:D("pb-2 text-[var(--color-ds-text-primary)]",js[a],l&&"sr-only"),children:o}),i.jsx("textarea",{id:k,className:D("box-border bg-[var(--color-ds-background-page)] w-full resize vertical rounded-lg border outline-none transition font-[var(--font-primary)]",js[a],ro[a],c?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",v.disabled?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-secondary)] cursor-not-allowed":"text-[var(--color-ds-text-primary)]"),value:T,onChange:x,maxLength:f,...v}),i.jsxs("div",{className:"flex justify-between pt-1 min-h-[18px]",children:[c&&u?i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:u}):i.jsx("span",{"aria-hidden":"true",children:" "}),h&&f!==void 0&&i.jsxs("span",{className:"text-xs text-[var(--color-ds-text-secondary)]",children:[T.length,"/",f]})]})]})}const so={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function Es({control:r,name:e,rules:t,defaultValue:s=!1,label:a,labelHidden:n=!1,disabled:o=!1,size:l="sm",className:c,hasError:u=!1,errorMessage:f=""}){return i.jsx("div",{className:D("flex flex-col",c),children:i.jsx(ke,{name:e,control:r,rules:t,defaultValue:s,render:({field:h,fieldState:p})=>{const v=p.error;return i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("input",{id:e,type:"checkbox",className:D(so[l],"text-[var(--color-ds-button-primary-bg)]","border-[var(--color-ds-border-default)]",o&&"opacity-50 cursor-not-allowed"),checked:h.value,onChange:F=>h.onChange(F.target.checked),disabled:o}),i.jsx("span",{className:D("text-[var(--color-ds-text-primary)] text-ds-md",o&&"text-[var(--color-ds-text-secondary)]"),children:a}),u&&(v==null?void 0:v.message)&&i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:v.message})]})}})})}function _s({name:r,control:e,searchFn:t,label:s,size:a="sm",width:n="100%",disabled:o=!1}){const{watch:l,getValues:c}=He(),[u,f]=b.useState([]),[h,p]=b.useState(!1),[v,F]=b.useState(!1),k=b.useRef(null),T=async j=>{if(j){p(!0);try{const A=await t(j,{watch:l,getValues:c});f(A),F(!0)}finally{p(!1)}}};b.useEffect(()=>{function j(A){k.current&&!k.current.contains(A.target)&&F(!1)}if(v)return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[v]);const y=a==="sm"?"text-ds-sm":a==="md"?"text-ds-md":"text-ds-lg",x=a==="sm"?"h-6":a==="md"?"h-10":"h-12";return i.jsx(ke,{name:r,control:e,render:({field:j,fieldState:A})=>{var S;return i.jsxs("div",{ref:k,className:"relative flex flex-col",style:{width:n},children:[s&&i.jsx("label",{className:`pb-2 text-[var(--color-ds-text-primary)] ${y}`,children:s}),i.jsx(ct,{className:"rounded-r-none",type:"text",size:a,width:"100%",value:j.value,onChange:z=>j.onChange(z.target.value),disabled:o,hasError:A.invalid,errorMessage:(S=A.error)==null?void 0:S.message,suffixButton:i.jsx(Fe,{type:"button",className:"!rounded-l-none",size:a,variant:"primary",onClick:()=>T(j.value),disabled:o,children:"Buscar"})}),h&&i.jsx("div",{className:`
31
31
  absolute
32
32
  top-14
33
33
  left-0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dipusevilla/componentes-iu",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "Librería de componentes React de Dipusevilla",
5
5
  "keywords": [
6
6
  "react",