@dipusevilla/componentes-iu 1.0.45 → 1.0.46

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
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react"),Jt=require("react-dom");function Nl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const H=Nl(b);function Sl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zr={exports:{}},vr={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react"),Jt=require("react-dom");function Sl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const H=Sl(b);function El(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yr={exports:{}},vr={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var ua;function El(){if(ua)return vr;ua=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,n,a){var i=null;if(a!==void 0&&(i=""+a),n.key!==void 0&&(i=""+n.key),"key"in n){a={};for(var l in n)l!=="key"&&(a[l]=n[l])}else a=n;return n=a.ref,{$$typeof:e,type:s,key:i,ref:n!==void 0?n:null,props:a}}return vr.Fragment=t,vr.jsx=r,vr.jsxs=r,vr}var yr={};/**
9
+ */var fa;function Cl(){if(fa)return vr;fa=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,n,a){var i=null;if(a!==void 0&&(i=""+a),n.key!==void 0&&(i=""+n.key),"key"in n){a={};for(var l in n)l!=="key"&&(a[l]=n[l])}else a=n;return n=a.ref,{$$typeof:e,type:s,key:i,ref:n!==void 0?n:null,props:a}}return vr.Fragment=t,vr.jsx=r,vr.jsxs=r,vr}var yr={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,26 +14,26 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var fa;function Cl(){return fa||(fa=1,process.env.NODE_ENV!=="production"&&function(){function e(C){if(C==null)return null;if(typeof C=="function")return C.$$typeof===V?null:C.displayName||C.name||null;if(typeof C=="string")return C;switch(C){case g:return"Fragment";case m:return"Profiler";case x:return"StrictMode";case N:return"Suspense";case _:return"SuspenseList";case $:return"Activity"}if(typeof C=="object")switch(typeof C.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),C.$$typeof){case v:return"Portal";case y:return(C.displayName||"Context")+".Provider";case w:return(C._context.displayName||"Context")+".Consumer";case T:var k=C.render;return C=C.displayName,C||(C=k.displayName||k.name||"",C=C!==""?"ForwardRef("+C+")":"ForwardRef"),C;case A:return k=C.displayName||null,k!==null?k:e(C.type)||"Memo";case S:k=C._payload,C=C._init;try{return e(C(k))}catch{}}return null}function t(C){return""+C}function r(C){try{t(C);var k=!1}catch{k=!0}if(k){k=console;var I=k.error,U=typeof Symbol=="function"&&Symbol.toStringTag&&C[Symbol.toStringTag]||C.constructor.name||"Object";return I.call(k,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",U),t(C)}}function s(C){if(C===g)return"<>";if(typeof C=="object"&&C!==null&&C.$$typeof===S)return"<...>";try{var k=e(C);return k?"<"+k+">":"<...>"}catch{return"<...>"}}function n(){var C=z.A;return C===null?null:C.getOwner()}function a(){return Error("react-stack-top-frame")}function i(C){if(q.call(C,"key")){var k=Object.getOwnPropertyDescriptor(C,"key").get;if(k&&k.isReactWarning)return!1}return C.key!==void 0}function l(C,k){function I(){E||(E=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",k))}I.isReactWarning=!0,Object.defineProperty(C,"key",{get:I,configurable:!0})}function c(){var C=e(this.type);return te[C]||(te[C]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),C=this.props.ref,C!==void 0?C:null}function d(C,k,I,U,G,ee,M,W){return I=ee.ref,C={$$typeof:p,type:C,key:k,props:ee,_owner:G},(I!==void 0?I:null)!==null?Object.defineProperty(C,"ref",{enumerable:!1,get:c}):Object.defineProperty(C,"ref",{enumerable:!1,value:null}),C._store={},Object.defineProperty(C._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(C,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(C,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.defineProperty(C,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:W}),Object.freeze&&(Object.freeze(C.props),Object.freeze(C)),C}function u(C,k,I,U,G,ee,M,W){var me=k.children;if(me!==void 0)if(U)if(D(me)){for(U=0;U<me.length;U++)f(me[U]);Object.freeze&&Object.freeze(me)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(me);if(q.call(k,"key")){me=e(C);var be=Object.keys(k).filter(function(ke){return ke!=="key"});U=0<be.length?"{key: someKey, "+be.join(": ..., ")+": ...}":"{key: someKey}",le[me+U]||(be=0<be.length?"{"+be.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var ma;function Al(){return ma||(ma=1,process.env.NODE_ENV!=="production"&&function(){function e(C){if(C==null)return null;if(typeof C=="function")return C.$$typeof===V?null:C.displayName||C.name||null;if(typeof C=="string")return C;switch(C){case x:return"Fragment";case m:return"Profiler";case g:return"StrictMode";case N:return"Suspense";case _:return"SuspenseList";case $:return"Activity"}if(typeof C=="object")switch(typeof C.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),C.$$typeof){case v:return"Portal";case y:return(C.displayName||"Context")+".Provider";case w:return(C._context.displayName||"Context")+".Consumer";case T:var k=C.render;return C=C.displayName,C||(C=k.displayName||k.name||"",C=C!==""?"ForwardRef("+C+")":"ForwardRef"),C;case A:return k=C.displayName||null,k!==null?k:e(C.type)||"Memo";case S:k=C._payload,C=C._init;try{return e(C(k))}catch{}}return null}function t(C){return""+C}function r(C){try{t(C);var k=!1}catch{k=!0}if(k){k=console;var I=k.error,U=typeof Symbol=="function"&&Symbol.toStringTag&&C[Symbol.toStringTag]||C.constructor.name||"Object";return I.call(k,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",U),t(C)}}function s(C){if(C===x)return"<>";if(typeof C=="object"&&C!==null&&C.$$typeof===S)return"<...>";try{var k=e(C);return k?"<"+k+">":"<...>"}catch{return"<...>"}}function n(){var C=z.A;return C===null?null:C.getOwner()}function a(){return Error("react-stack-top-frame")}function i(C){if(q.call(C,"key")){var k=Object.getOwnPropertyDescriptor(C,"key").get;if(k&&k.isReactWarning)return!1}return C.key!==void 0}function l(C,k){function I(){E||(E=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",k))}I.isReactWarning=!0,Object.defineProperty(C,"key",{get:I,configurable:!0})}function c(){var C=e(this.type);return te[C]||(te[C]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),C=this.props.ref,C!==void 0?C:null}function d(C,k,I,U,G,ee,M,W){return I=ee.ref,C={$$typeof:h,type:C,key:k,props:ee,_owner:G},(I!==void 0?I:null)!==null?Object.defineProperty(C,"ref",{enumerable:!1,get:c}):Object.defineProperty(C,"ref",{enumerable:!1,value:null}),C._store={},Object.defineProperty(C._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(C,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(C,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.defineProperty(C,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:W}),Object.freeze&&(Object.freeze(C.props),Object.freeze(C)),C}function u(C,k,I,U,G,ee,M,W){var me=k.children;if(me!==void 0)if(U)if(D(me)){for(U=0;U<me.length;U++)f(me[U]);Object.freeze&&Object.freeze(me)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(me);if(q.call(k,"key")){me=e(C);var be=Object.keys(k).filter(function(ke){return ke!=="key"});U=0<be.length?"{key: someKey, "+be.join(": ..., ")+": ...}":"{key: someKey}",le[me+U]||(be=0<be.length?"{"+be.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,U,me,be,me),le[me+U]=!0)}if(me=null,I!==void 0&&(r(I),me=""+I),i(k)&&(r(k.key),me=""+k.key),"key"in k){I={};for(var de in k)de!=="key"&&(I[de]=k[de])}else I=k;return me&&l(I,typeof C=="function"?C.displayName||C.name||"Unknown":C),d(C,me,ee,G,n(),I,M,W)}function f(C){typeof C=="object"&&C!==null&&C.$$typeof===p&&C._store&&(C._store.validated=1)}var h=b,p=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),y=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),z=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,D=Array.isArray,P=console.createTask?console.createTask:function(){return null};h={"react-stack-bottom-frame":function(C){return C()}};var E,te={},ne=h["react-stack-bottom-frame"].bind(h,a)(),K=P(s(a)),le={};yr.Fragment=g,yr.jsx=function(C,k,I,U,G){var ee=1e4>z.recentlyCreatedOwnerStacks++;return u(C,k,I,!1,U,G,ee?Error("react-stack-top-frame"):ne,ee?P(s(C)):K)},yr.jsxs=function(C,k,I,U,G){var ee=1e4>z.recentlyCreatedOwnerStacks++;return u(C,k,I,!0,U,G,ee?Error("react-stack-top-frame"):ne,ee?P(s(C)):K)}}()),yr}var ma;function Al(){return ma||(ma=1,process.env.NODE_ENV==="production"?Zr.exports=El():Zr.exports=Cl()),Zr.exports}var o=Al();function Do(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=Do(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function se(){for(var e,t,r=0,s="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=Do(e))&&(s&&(s+=" "),s+=t);return s}const Tl={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6",xl:"w-10 h-10",full:"w-full h-full"};function kt({component:e,size:t="sm",className:r,...s}){return o.jsx(e,{className:se(Tl[t],r),"aria-hidden":s["aria-label"]?void 0:!0,...s})}const _l="inline-flex items-center justify-center box-border font-[var(--font-primary)] font-medium rounded-lg transition focus:outline-none",Fl={primary:"bg-[var(--color-ds-button-primary-bg)] text-[var(--color-ds-button-primary-text)] hover:animate-pulse",outline:"bg-transparent text-[var(--color-ds-text-primary)] ring-1 ring-inset ring-[var(--color-ds-border-default)] hover:bg-[var(--color-ds-background-accent)] hover:text-[var(--color-ds-text-on-accent)]",ghost:"bg-transparent text-[var(--color-ds-text-primary)] hover:animate-pulse",subtle:"bg-[var(--color-ds-background-surface)] text-[var(--color-ds-text-primary)] ring-1 ring-inset ring-[var(--color-ds-border-default-50)] hover:text-[var(--color-ds-text-on-accent)] hover:bg-[var(--color-ds-background-accent)]",danger:"bg-[var(--color-ds-background-danger)] text-[var(--color-ds-text-danger)] hover:brightness-105"},Ol={xs:"text-[10px] leading-none h-5 px-1.5",sm:"text-ds-sm h-6 px-2",md:"text-ds-md h-10 px-2.5",lg:"text-ds-lg h-12 px-3"},Rl={xs:"h-5 w-5 p-0",sm:"h-6 w-6 p-0",md:"h-10 w-10 p-0",lg:"h-12 w-12 p-0"},Dl="disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-[var(--color-ds-background-disabled)] disabled:text-[var(--color-ds-text-primary)] disabled:ring-1 disabled:ring-inset disabled:ring-[var(--color-ds-border-muted)]";function ie({type:e="button",variant:t="primary",size:r="sm",width:s,disabled:n=!1,icon:a,iconPosition:i="left",ariaLabel:l,children:c,onClick:d,className:u,...f}){const h=!!a,p=h&&!c,v=p?Rl[r]:Ol[r];return o.jsxs("button",{type:e,onClick:d,disabled:n,"aria-label":p?l:void 0,style:s?{width:s}:void 0,className:se(_l,Fl[t],v,Dl,u,h&&c&&"gap-2"),...f,children:[a&&i==="left"&&o.jsx(kt,{component:a,size:r==="xs"?"sm":r}),c,a&&i==="right"&&o.jsx(kt,{component:a,size:r==="xs"?"sm":r})]})}function Ml({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 13.5 12 21m0 0-7.5-7.5M12 21V3"}))}const $l=H.forwardRef(Ml);function Ll({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"}))}const Pl=H.forwardRef(Ll);function zl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"}))}const Il=H.forwardRef(zl);function Vl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18"}))}const Bl=H.forwardRef(Vl);function Ul({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"}))}const ql=H.forwardRef(Ul);function Wl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))}const Os=H.forwardRef(Wl);function Kl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"}))}const Gl=H.forwardRef(Kl);function Jl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))}const Mo=H.forwardRef(Jl);function Zl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))}const Yl=H.forwardRef(Zl);function Hl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 16.5V9.75m0 0 3 3m-3-3-3 3M6.75 19.5a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z"}))}const Xl=H.forwardRef(Hl);function Ql({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672 13.684 16.6m0 0-2.51 2.225.569-9.47 5.227 7.917-3.286-.672ZM12 2.25V4.5m5.834.166-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243-1.59-1.59"}))}const ec=H.forwardRef(Ql);function tc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))}const ha=H.forwardRef(tc);function rc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"}))}const sc=H.forwardRef(rc);function nc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const $o=H.forwardRef(nc);function ac({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5"}))}const oc=H.forwardRef(ac);function ic({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const Lo=H.forwardRef(ic);function lc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"}))}const cc=H.forwardRef(lc);function dc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 0 0 2.25-2.25V6a2.25 2.25 0 0 0-2.25-2.25H6A2.25 2.25 0 0 0 3.75 6v2.25A2.25 2.25 0 0 0 6 10.5Zm0 9.75h2.25A2.25 2.25 0 0 0 10.5 18v-2.25a2.25 2.25 0 0 0-2.25-2.25H6a2.25 2.25 0 0 0-2.25 2.25V18A2.25 2.25 0 0 0 6 20.25Zm9.75-9.75H18a2.25 2.25 0 0 0 2.25-2.25V6A2.25 2.25 0 0 0 18 3.75h-2.25A2.25 2.25 0 0 0 13.5 6v2.25a2.25 2.25 0 0 0 2.25 2.25Z"}))}const uc=H.forwardRef(dc);function fc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"}))}const mc=H.forwardRef(fc);function hc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}const pc=H.forwardRef(hc);function bc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const In=H.forwardRef(bc),gc={default:{wrapper:"box-border w-full rounded-lg bg-[var(--color-ds-background-surface)] overflow-hidden",padX:"px-6",padY:"py-4"},plain:{wrapper:"box-border w-full overflow-hidden",padX:"px-0",padY:"py-2"},soft:{wrapper:"box-border w-full rounded-lg bg-[color-mix(in srgb,var(--color-ds-background-surface) 60%, transparent 40%)] overflow-hidden",padX:"px-4",padY:"py-3"},ghost:{wrapper:"box-border w-full overflow-hidden",padX:"px-6",padY:"py-3"}};function it({title:e,children:t,defaultOpen:r=!0,className:s,type:n="default",contentClassName:a,headerClassName:i}){const[l,c]=b.useState(r),d=b.useRef(null),[u,f]=b.useState(0),h=()=>{d.current&&f(d.current.scrollHeight)};b.useLayoutEffect(()=>{h()},[l]),b.useEffect(()=>{const v=d.current;if(!v)return;const g=new ResizeObserver(()=>h());return g.observe(v),()=>g.disconnect()},[]);const p=gc[n];return o.jsxs("div",{className:se("flex flex-col w-full gap-3",s),children:[o.jsxs("button",{type:"button",onClick:()=>c(v=>!v),"aria-expanded":l,className:se("flex items-center justify-between w-full transition-colors","hover:bg-[var(--color-ds-surface-hover)]",i),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"block w-1 h-5 bg-[var(--color-ds-background-accent)] rounded-sm"}),o.jsx("span",{className:"font-semibold text-[var(--color-ds-text-primary)]",children:e})]}),l?o.jsx(Yl,{className:"w-5 h-5 text-[var(--color-ds-text-primary)]"}):o.jsx(Os,{className:"w-5 h-5 text-[var(--color-ds-text-primary)]"})]}),o.jsx("div",{className:p.wrapper,children:o.jsx("div",{className:p.padX,children:o.jsx("div",{className:se("overflow-hidden transition-all duration-300 ease-in-out",l?"opacity-100":"opacity-0"),style:{maxHeight:l?`${u}px`:"0px"},children:o.jsx("div",{ref:d,className:se(p.padY,a),children:t})})})})]})}const Vn="-",xc=e=>{const t=yc(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:i=>{const l=i.split(Vn);return l[0]===""&&l.length!==1&&l.shift(),Po(l,t)||vc(i)},getConflictingClassGroupIds:(i,l)=>{const c=r[i]||[];return l&&s[i]?[...c,...s[i]]:c}}},Po=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const r=e[0],s=t.nextPart.get(r),n=s?Po(e.slice(1),s):void 0;if(n)return n;if(t.validators.length===0)return;const a=e.join(Vn);return(i=t.validators.find(({validator:l})=>l(a)))==null?void 0:i.classGroupId},pa=/^\[(.+)\]$/,vc=e=>{if(pa.test(e)){const t=pa.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},yc=e=>{const{theme:t,classGroups:r}=e,s={nextPart:new Map,validators:[]};for(const n in r)gn(r[n],s,n,t);return s},gn=(e,t,r,s)=>{e.forEach(n=>{if(typeof n=="string"){const a=n===""?t:ba(t,n);a.classGroupId=r;return}if(typeof n=="function"){if(wc(n)){gn(n(s),t,r,s);return}t.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([a,i])=>{gn(i,ba(t,a),r,s)})})},ba=(e,t)=>{let r=e;return t.split(Vn).forEach(s=>{r.nextPart.has(s)||r.nextPart.set(s,{nextPart:new Map,validators:[]}),r=r.nextPart.get(s)}),r},wc=e=>e.isThemeGetter,jc=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,s=new Map;const n=(a,i)=>{r.set(a,i),t++,t>e&&(t=0,s=r,r=new Map)};return{get(a){let i=r.get(a);if(i!==void 0)return i;if((i=s.get(a))!==void 0)return n(a,i),i},set(a,i){r.has(a)?r.set(a,i):n(a,i)}}},xn="!",vn=":",kc=vn.length,Nc=e=>{const{prefix:t,experimentalParseClassName:r}=e;let s=n=>{const a=[];let i=0,l=0,c=0,d;for(let v=0;v<n.length;v++){let g=n[v];if(i===0&&l===0){if(g===vn){a.push(n.slice(c,v)),c=v+kc;continue}if(g==="/"){d=v;continue}}g==="["?i++:g==="]"?i--:g==="("?l++:g===")"&&l--}const u=a.length===0?n:n.substring(c),f=Sc(u),h=f!==u,p=d&&d>c?d-c:void 0;return{modifiers:a,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:p}};if(t){const n=t+vn,a=s;s=i=>i.startsWith(n)?a(i.substring(n.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(r){const n=s;s=a=>r({className:a,parseClassName:n})}return s},Sc=e=>e.endsWith(xn)?e.substring(0,e.length-1):e.startsWith(xn)?e.substring(1):e,Ec=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const n=[];let a=[];return s.forEach(i=>{i[0]==="["||t[i]?(n.push(...a.sort(),i),a=[]):a.push(i)}),n.push(...a.sort()),n}},Cc=e=>({cache:jc(e.cacheSize),parseClassName:Nc(e),sortModifiers:Ec(e),...xc(e)}),Ac=/\s+/,Tc=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:n,sortModifiers:a}=t,i=[],l=e.trim().split(Ac);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:v,maybePostfixModifierPosition:g}=r(u);if(f){c=u+(c.length>0?" "+c:c);continue}let x=!!g,m=s(x?v.substring(0,g):v);if(!m){if(!x){c=u+(c.length>0?" "+c:c);continue}if(m=s(v),!m){c=u+(c.length>0?" "+c:c);continue}x=!1}const w=a(h).join(":"),y=p?w+xn:w,T=y+m;if(i.includes(T))continue;i.push(T);const N=n(m,x);for(let _=0;_<N.length;++_){const A=N[_];i.push(y+A)}c=u+(c.length>0?" "+c:c)}return c};function _c(){let e=0,t,r,s="";for(;e<arguments.length;)(t=arguments[e++])&&(r=zo(t))&&(s&&(s+=" "),s+=r);return s}const zo=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=zo(e[s]))&&(r&&(r+=" "),r+=t);return r};function Fc(e,...t){let r,s,n,a=i;function i(c){const d=t.reduce((u,f)=>f(u),e());return r=Cc(d),s=r.cache.get,n=r.cache.set,a=l,l(c)}function l(c){const d=s(c);if(d)return d;const u=Tc(c,r);return n(c,u),u}return function(){return a(_c.apply(null,arguments))}}const ze=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},Io=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Vo=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Oc=/^\d+\/\d+$/,Rc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Dc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Mc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$c=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Lc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,nr=e=>Oc.test(e),ve=e=>!!e&&!Number.isNaN(Number(e)),$t=e=>!!e&&Number.isInteger(Number(e)),Ws=e=>e.endsWith("%")&&ve(e.slice(0,-1)),St=e=>Rc.test(e),Pc=()=>!0,zc=e=>Dc.test(e)&&!Mc.test(e),Bo=()=>!1,Ic=e=>$c.test(e),Vc=e=>Lc.test(e),Bc=e=>!ae(e)&&!oe(e),Uc=e=>hr(e,Wo,Bo),ae=e=>Io.test(e),Kt=e=>hr(e,Ko,zc),Ks=e=>hr(e,Jc,ve),ga=e=>hr(e,Uo,Bo),qc=e=>hr(e,qo,Vc),Yr=e=>hr(e,Go,Ic),oe=e=>Vo.test(e),wr=e=>pr(e,Ko),Wc=e=>pr(e,Zc),xa=e=>pr(e,Uo),Kc=e=>pr(e,Wo),Gc=e=>pr(e,qo),Hr=e=>pr(e,Go,!0),hr=(e,t,r)=>{const s=Io.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},pr=(e,t,r=!1)=>{const s=Vo.exec(e);return s?s[1]?t(s[1]):r:!1},Uo=e=>e==="position"||e==="percentage",qo=e=>e==="image"||e==="url",Wo=e=>e==="length"||e==="size"||e==="bg-size",Ko=e=>e==="length",Jc=e=>e==="number",Zc=e=>e==="family-name",Go=e=>e==="shadow",Yc=()=>{const e=ze("color"),t=ze("font"),r=ze("text"),s=ze("font-weight"),n=ze("tracking"),a=ze("leading"),i=ze("breakpoint"),l=ze("container"),c=ze("spacing"),d=ze("radius"),u=ze("shadow"),f=ze("inset-shadow"),h=ze("text-shadow"),p=ze("drop-shadow"),v=ze("blur"),g=ze("perspective"),x=ze("aspect"),m=ze("ease"),w=ze("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...T(),oe,ae],_=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],S=()=>[oe,ae,c],$=()=>[nr,"full","auto",...S()],V=()=>[$t,"none","subgrid",oe,ae],z=()=>["auto",{span:["full",$t,oe,ae]},$t,oe,ae],q=()=>[$t,"auto",oe,ae],D=()=>["auto","min","max","fr",oe,ae],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],E=()=>["start","end","center","stretch","center-safe","end-safe"],te=()=>["auto",...S()],ne=()=>[nr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],K=()=>[e,oe,ae],le=()=>[...T(),xa,ga,{position:[oe,ae]}],C=()=>["no-repeat",{repeat:["","x","y","space","round"]}],k=()=>["auto","cover","contain",Kc,Uc,{size:[oe,ae]}],I=()=>[Ws,wr,Kt],U=()=>["","none","full",d,oe,ae],G=()=>["",ve,wr,Kt],ee=()=>["solid","dashed","dotted","double"],M=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[ve,Ws,xa,ga],me=()=>["","none",v,oe,ae],be=()=>["none",ve,oe,ae],de=()=>["none",ve,oe,ae],ke=()=>[ve,oe,ae],ge=()=>[nr,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[St],breakpoint:[St],color:[Pc],container:[St],"drop-shadow":[St],ease:["in","out","in-out"],font:[Bc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[St],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[St],shadow:[St],spacing:["px",ve],text:[St],"text-shadow":[St],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",nr,ae,oe,x]}],container:["container"],columns:[{columns:[ve,ae,oe,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:N()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:$()}],"inset-x":[{"inset-x":$()}],"inset-y":[{"inset-y":$()}],start:[{start:$()}],end:[{end:$()}],top:[{top:$()}],right:[{right:$()}],bottom:[{bottom:$()}],left:[{left:$()}],visibility:["visible","invisible","collapse"],z:[{z:[$t,"auto",oe,ae]}],basis:[{basis:[nr,"full","auto",l,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ve,nr,"auto","initial","none",ae]}],grow:[{grow:["",ve,oe,ae]}],shrink:[{shrink:["",ve,oe,ae]}],order:[{order:[$t,"first","last","none",oe,ae]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:z()}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:z()}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...E(),"normal"]}],"justify-self":[{"justify-self":["auto",...E()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...E(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...E(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...E(),"baseline"]}],"place-self":[{"place-self":["auto",...E()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:te()}],mx:[{mx:te()}],my:[{my:te()}],ms:[{ms:te()}],me:[{me:te()}],mt:[{mt:te()}],mr:[{mr:te()}],mb:[{mb:te()}],ml:[{ml:te()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:ne()}],w:[{w:[l,"screen",...ne()]}],"min-w":[{"min-w":[l,"screen","none",...ne()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...ne()]}],h:[{h:["screen","lh",...ne()]}],"min-h":[{"min-h":["screen","lh","none",...ne()]}],"max-h":[{"max-h":["screen","lh",...ne()]}],"font-size":[{text:["base",r,wr,Kt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,oe,Ks]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ws,ae]}],"font-family":[{font:[Wc,ae,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,oe,ae]}],"line-clamp":[{"line-clamp":[ve,"none",oe,Ks]}],leading:[{leading:[a,...S()]}],"list-image":[{"list-image":["none",oe,ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",oe,ae]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[ve,"from-font","auto",oe,Kt]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[ve,"auto",oe,ae]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",oe,ae]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",oe,ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:le()}],"bg-repeat":[{bg:C()}],"bg-size":[{bg:k()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$t,oe,ae],radial:["",oe,ae],conic:[$t,oe,ae]},Gc,qc]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ve,oe,ae]}],"outline-w":[{outline:["",ve,wr,Kt]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",u,Hr,Yr]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",f,Hr,Yr]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[ve,Kt]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",h,Hr,Yr]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[ve,oe,ae]}],"mix-blend":[{"mix-blend":[...M(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":M()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ve]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":K()}],"mask-image-linear-to-color":[{"mask-linear-to":K()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":K()}],"mask-image-t-to-color":[{"mask-t-to":K()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":K()}],"mask-image-r-to-color":[{"mask-r-to":K()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":K()}],"mask-image-b-to-color":[{"mask-b-to":K()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":K()}],"mask-image-l-to-color":[{"mask-l-to":K()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":K()}],"mask-image-x-to-color":[{"mask-x-to":K()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[oe,ae]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":K()}],"mask-image-radial-to-color":[{"mask-radial-to":K()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[ve]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":K()}],"mask-image-conic-to-color":[{"mask-conic-to":K()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:le()}],"mask-repeat":[{mask:C()}],"mask-size":[{mask:k()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",oe,ae]}],filter:[{filter:["","none",oe,ae]}],blur:[{blur:me()}],brightness:[{brightness:[ve,oe,ae]}],contrast:[{contrast:[ve,oe,ae]}],"drop-shadow":[{"drop-shadow":["","none",p,Hr,Yr]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",ve,oe,ae]}],"hue-rotate":[{"hue-rotate":[ve,oe,ae]}],invert:[{invert:["",ve,oe,ae]}],saturate:[{saturate:[ve,oe,ae]}],sepia:[{sepia:["",ve,oe,ae]}],"backdrop-filter":[{"backdrop-filter":["","none",oe,ae]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[ve,oe,ae]}],"backdrop-contrast":[{"backdrop-contrast":[ve,oe,ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ve,oe,ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ve,oe,ae]}],"backdrop-invert":[{"backdrop-invert":["",ve,oe,ae]}],"backdrop-opacity":[{"backdrop-opacity":[ve,oe,ae]}],"backdrop-saturate":[{"backdrop-saturate":[ve,oe,ae]}],"backdrop-sepia":[{"backdrop-sepia":["",ve,oe,ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",oe,ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ve,"initial",oe,ae]}],ease:[{ease:["linear","initial",m,oe,ae]}],delay:[{delay:[ve,oe,ae]}],animate:[{animate:["none",w,oe,ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,oe,ae]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":["scale-3d"],skew:[{skew:ke()}],"skew-x":[{"skew-x":ke()}],"skew-y":[{"skew-y":ke()}],transform:[{transform:[oe,ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ge()}],"translate-x":[{"translate-x":ge()}],"translate-y":[{"translate-y":ge()}],"translate-z":[{"translate-z":ge()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",oe,ae]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",oe,ae]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[ve,wr,Kt,Ks]}],stroke:[{stroke:["none",...K()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Hc=Fc(Yc);var $r=e=>e.type==="checkbox",Zt=e=>e instanceof Date,Ze=e=>e==null;const Jo=e=>typeof e=="object";var De=e=>!Ze(e)&&!Array.isArray(e)&&Jo(e)&&!Zt(e),Zo=e=>De(e)&&e.target?$r(e.target)?e.target.checked:e.target.value:e,Xc=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Yo=(e,t)=>e.has(Xc(t)),Qc=e=>{const t=e.constructor&&e.constructor.prototype;return De(t)&&t.hasOwnProperty("isPrototypeOf")},Bn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function qe(e){let t;const r=Array.isArray(e),s=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Bn&&(e instanceof Blob||s))&&(r||De(e)))if(t=r?[]:{},!r&&!Qc(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=qe(e[n]));else return e;return t}var Rs=e=>Array.isArray(e)?e.filter(Boolean):[],Re=e=>e===void 0,re=(e,t,r)=>{if(!t||!De(e))return r;const s=Rs(t.split(/[,[\].]+?/)).reduce((n,a)=>Ze(n)?n:n[a],e);return Re(s)||s===e?Re(e[t])?r:e[t]:s},lt=e=>typeof e=="boolean",Un=e=>/^\w*$/.test(e),Ho=e=>Rs(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ce=(e,t,r)=>{let s=-1;const n=Un(t)?[t]:Ho(t),a=n.length,i=a-1;for(;++s<a;){const l=n[s];let c=r;if(s!==i){const d=e[l];c=De(d)||Array.isArray(d)?d:isNaN(+n[s+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=c,e=e[l]}};const bs={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ht={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Et={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Xo=b.createContext(null),Lr=()=>b.useContext(Xo),ed=e=>{const{children:t,...r}=e;return b.createElement(Xo.Provider,{value:r},t)};var Qo=(e,t,r,s=!0)=>{const n={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(n,a,{get:()=>{const i=a;return t._proxyFormState[i]!==ht.all&&(t._proxyFormState[i]=!s||ht.all),r&&(r[i]=!0),e[i]}});return n};const qn=typeof window<"u"?H.useLayoutEffect:H.useEffect;function td(e){const t=Lr(),{control:r=t.control,disabled:s,name:n,exact:a}=e||{},[i,l]=b.useState(r._formState),c=b.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return qn(()=>r._subscribe({name:n,formState:c.current,exact:a,callback:d=>{!s&&l({...r._formState,...d})}}),[n,s,a]),b.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),b.useMemo(()=>Qo(i,r,c.current,!1),[i,r])}var Nt=e=>typeof e=="string",ei=(e,t,r,s,n)=>Nt(e)?(s&&t.watch.add(e),re(r,e,n)):Array.isArray(e)?e.map(a=>(s&&t.watch.add(a),re(r,a))):(s&&(t.watchAll=!0),r);function Wn(e){const t=Lr(),{control:r=t.control,name:s,defaultValue:n,disabled:a,exact:i}=e||{},l=b.useRef(n),[c,d]=b.useState(r._getWatch(s,l.current));return qn(()=>r._subscribe({name:s,formState:{values:!0},exact:i,callback:u=>!a&&d(ei(s,r._names,u.values||r._formValues,!1,l.current))}),[s,r,a,i]),b.useEffect(()=>r._removeUnmounted()),c}function ti(e){const t=Lr(),{name:r,disabled:s,control:n=t.control,shouldUnregister:a}=e,i=Yo(n._names.array,r),l=Wn({control:n,name:r,defaultValue:re(n._formValues,r,re(n._defaultValues,r,e.defaultValue)),exact:!0}),c=td({control:n,name:r,exact:!0}),d=b.useRef(e),u=b.useRef(n.register(r,{...e.rules,value:l,...lt(e.disabled)?{disabled:e.disabled}:{}})),f=b.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!re(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!re(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!re(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!re(c.validatingFields,r)},error:{enumerable:!0,get:()=>re(c.errors,r)}}),[c,r]),h=b.useCallback(x=>u.current.onChange({target:{value:Zo(x),name:r},type:bs.CHANGE}),[r]),p=b.useCallback(()=>u.current.onBlur({target:{value:re(n._formValues,r),name:r},type:bs.BLUR}),[r,n._formValues]),v=b.useCallback(x=>{const m=re(n._fields,r);m&&x&&(m._f.ref={focus:()=>x.focus(),select:()=>x.select(),setCustomValidity:w=>x.setCustomValidity(w),reportValidity:()=>x.reportValidity()})},[n._fields,r]),g=b.useMemo(()=>({name:r,value:l,...lt(s)||c.disabled?{disabled:c.disabled||s}:{},onChange:h,onBlur:p,ref:v}),[r,s,c.disabled,h,p,v,l]);return b.useEffect(()=>{const x=n._options.shouldUnregister||a;n.register(r,{...d.current.rules,...lt(d.current.disabled)?{disabled:d.current.disabled}:{}});const m=(w,y)=>{const T=re(n._fields,w);T&&T._f&&(T._f.mount=y)};if(m(r,!0),x){const w=qe(re(n._options.defaultValues,r));Ce(n._defaultValues,r,w),Re(re(n._formValues,r))&&Ce(n._formValues,r,w)}return!i&&n.register(r),()=>{(i?x&&!n._state.action:x)?n.unregister(r):m(r,!1)}},[r,n,i,a]),b.useEffect(()=>{n._setDisabledField({disabled:s,name:r})},[s,r,n]),b.useMemo(()=>({field:g,formState:c,fieldState:f}),[g,c,f])}const gt=e=>e.render(ti(e));var ri=(e,t,r,s,n)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:n||!0}}:{},Sr=e=>Array.isArray(e)?e:[e],va=()=>{let e=[];return{get observers(){return e},next:n=>{for(const a of e)a.next&&a.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(a=>a!==n)}}),unsubscribe:()=>{e=[]}}},yn=e=>Ze(e)||!Jo(e);function It(e,t){if(yn(e)||yn(t))return e===t;if(Zt(e)&&Zt(t))return e.getTime()===t.getTime();const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(const n of r){const a=e[n];if(!s.includes(n))return!1;if(n!=="ref"){const i=t[n];if(Zt(a)&&Zt(i)||De(a)&&De(i)||Array.isArray(a)&&Array.isArray(i)?!It(a,i):a!==i)return!1}}return!0}var Je=e=>De(e)&&!Object.keys(e).length,Kn=e=>e.type==="file",pt=e=>typeof e=="function",gs=e=>{if(!Bn)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},si=e=>e.type==="select-multiple",Gn=e=>e.type==="radio",rd=e=>Gn(e)||$r(e),Gs=e=>gs(e)&&e.isConnected;function sd(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=Re(e)?s++:e[t[s++]];return e}function nd(e){for(const t in e)if(e.hasOwnProperty(t)&&!Re(e[t]))return!1;return!0}function Ie(e,t){const r=Array.isArray(t)?t:Un(t)?[t]:Ho(t),s=r.length===1?e:sd(e,r),n=r.length-1,a=r[n];return s&&delete s[a],n!==0&&(De(s)&&Je(s)||Array.isArray(s)&&nd(s))&&Ie(e,r.slice(0,-1)),e}var ni=e=>{for(const t in e)if(pt(e[t]))return!0;return!1};function xs(e,t={}){const r=Array.isArray(e);if(De(e)||r)for(const s in e)Array.isArray(e[s])||De(e[s])&&!ni(e[s])?(t[s]=Array.isArray(e[s])?[]:{},xs(e[s],t[s])):Ze(e[s])||(t[s]=!0);return t}function ai(e,t,r){const s=Array.isArray(e);if(De(e)||s)for(const n in e)Array.isArray(e[n])||De(e[n])&&!ni(e[n])?Re(t)||yn(r[n])?r[n]=Array.isArray(e[n])?xs(e[n],[]):{...xs(e[n])}:ai(e[n],Ze(t)?{}:t[n],r[n]):r[n]=!It(e[n],t[n]);return r}var jr=(e,t)=>ai(e,t,xs(t));const ya={value:!1,isValid:!1},wa={value:!0,isValid:!0};var oi=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Re(e[0].attributes.value)?Re(e[0].value)||e[0].value===""?wa:{value:e[0].value,isValid:!0}:wa:ya}return ya},ii=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:s})=>Re(e)?e:t?e===""?NaN:e&&+e:r&&Nt(e)?new Date(e):s?s(e):e;const ja={isValid:!1,value:null};var li=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,ja):ja;function ka(e){const t=e.ref;return Kn(t)?t.files:Gn(t)?li(e.refs).value:si(t)?[...t.selectedOptions].map(({value:r})=>r):$r(t)?oi(e.refs).value:ii(Re(t.value)?e.ref.value:t.value,e)}var ad=(e,t,r,s)=>{const n={};for(const a of e){const i=re(t,a);i&&Ce(n,a,i._f)}return{criteriaMode:r,names:[...e],fields:n,shouldUseNativeValidation:s}},vs=e=>e instanceof RegExp,kr=e=>Re(e)?e:vs(e)?e.source:De(e)?vs(e.value)?e.value.source:e.value:e,Na=e=>({isOnSubmit:!e||e===ht.onSubmit,isOnBlur:e===ht.onBlur,isOnChange:e===ht.onChange,isOnAll:e===ht.all,isOnTouch:e===ht.onTouched});const Sa="AsyncFunction";var od=e=>!!e&&!!e.validate&&!!(pt(e.validate)&&e.validate.constructor.name===Sa||De(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Sa)),id=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ea=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const Er=(e,t,r,s)=>{for(const n of r||Object.keys(e)){const a=re(e,n);if(a){const{_f:i,...l}=a;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],n)&&!s)return!0;if(i.ref&&t(i.ref,i.name)&&!s)return!0;if(Er(l,t))break}else if(De(l)&&Er(l,t))break}}};function Ca(e,t,r){const s=re(e,r);if(s||Un(r))return{error:s,name:r};const n=r.split(".");for(;n.length;){const a=n.join("."),i=re(t,a),l=re(e,a);if(i&&!Array.isArray(i)&&r!==a)return{name:r};if(l&&l.type)return{name:a,error:l};n.pop()}return{name:r}}var ld=(e,t,r,s)=>{r(e);const{name:n,...a}=e;return Je(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(i=>t[i]===(!s||ht.all))},cd=(e,t,r)=>!e||!t||e===t||Sr(e).some(s=>s&&(r?s===t:s.startsWith(t)||t.startsWith(s))),dd=(e,t,r,s,n)=>n.isOnAll?!1:!r&&n.isOnTouch?!(t||e):(r?s.isOnBlur:n.isOnBlur)?!e:(r?s.isOnChange:n.isOnChange)?e:!0,ud=(e,t)=>!Rs(re(e,t)).length&&Ie(e,t),fd=(e,t,r)=>{const s=Sr(re(e,r));return Ce(s,"root",t[r]),Ce(e,r,s),e},us=e=>Nt(e);function Aa(e,t,r="validate"){if(us(e)||Array.isArray(e)&&e.every(us)||lt(e)&&!e)return{type:r,message:us(e)?e:"",ref:t}}var ar=e=>De(e)&&!vs(e)?e:{value:e,message:""},Ta=async(e,t,r,s,n,a)=>{const{ref:i,refs:l,required:c,maxLength:d,minLength:u,min:f,max:h,pattern:p,validate:v,name:g,valueAsNumber:x,mount:m}=e._f,w=re(r,g);if(!m||t.has(g))return{};const y=l?l[0]:i,T=q=>{n&&y.reportValidity&&(y.setCustomValidity(lt(q)?"":q||""),y.reportValidity())},N={},_=Gn(i),A=$r(i),S=_||A,$=(x||Kn(i))&&Re(i.value)&&Re(w)||gs(i)&&i.value===""||w===""||Array.isArray(w)&&!w.length,V=ri.bind(null,g,s,N),z=(q,D,P,E=Et.maxLength,te=Et.minLength)=>{const ne=q?D:P;N[g]={type:q?E:te,message:ne,ref:i,...V(q?E:te,ne)}};if(a?!Array.isArray(w)||!w.length:c&&(!S&&($||Ze(w))||lt(w)&&!w||A&&!oi(l).isValid||_&&!li(l).isValid)){const{value:q,message:D}=us(c)?{value:!!c,message:c}:ar(c);if(q&&(N[g]={type:Et.required,message:D,ref:y,...V(Et.required,D)},!s))return T(D),N}if(!$&&(!Ze(f)||!Ze(h))){let q,D;const P=ar(h),E=ar(f);if(!Ze(w)&&!isNaN(w)){const te=i.valueAsNumber||w&&+w;Ze(P.value)||(q=te>P.value),Ze(E.value)||(D=te<E.value)}else{const te=i.valueAsDate||new Date(w),ne=C=>new Date(new Date().toDateString()+" "+C),K=i.type=="time",le=i.type=="week";Nt(P.value)&&w&&(q=K?ne(w)>ne(P.value):le?w>P.value:te>new Date(P.value)),Nt(E.value)&&w&&(D=K?ne(w)<ne(E.value):le?w<E.value:te<new Date(E.value))}if((q||D)&&(z(!!q,P.message,E.message,Et.max,Et.min),!s))return T(N[g].message),N}if((d||u)&&!$&&(Nt(w)||a&&Array.isArray(w))){const q=ar(d),D=ar(u),P=!Ze(q.value)&&w.length>+q.value,E=!Ze(D.value)&&w.length<+D.value;if((P||E)&&(z(P,q.message,D.message),!s))return T(N[g].message),N}if(p&&!$&&Nt(w)){const{value:q,message:D}=ar(p);if(vs(q)&&!w.match(q)&&(N[g]={type:Et.pattern,message:D,ref:i,...V(Et.pattern,D)},!s))return T(D),N}if(v){if(pt(v)){const q=await v(w,r),D=Aa(q,y);if(D&&(N[g]={...D,...V(Et.validate,D.message)},!s))return T(D.message),N}else if(De(v)){let q={};for(const D in v){if(!Je(q)&&!s)break;const P=Aa(await v[D](w,r),y,D);P&&(q={...P,...V(D,P.message)},T(P.message),s&&(N[g]=q))}if(!Je(q)&&(N[g]={ref:y,...q},!s))return N}}return T(!0),N};const md={mode:ht.onSubmit,reValidateMode:ht.onChange,shouldFocusError:!0};function hd(e={}){let t={...md,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:pt(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1};const s={};let n=De(t.defaultValues)||De(t.values)?qe(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:qe(n),i={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...u};const h={array:va(),state:va()},p=t.criteriaMode===ht.all,v=j=>F=>{clearTimeout(d),d=setTimeout(j,F)},g=async j=>{if(!t.disabled&&(u.isValid||f.isValid||j)){const F=t.resolver?Je((await A()).errors):await $(s,!0);F!==r.isValid&&h.state.next({isValid:F})}},x=(j,F)=>{!t.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((j||Array.from(l.mount)).forEach(R=>{R&&(F?Ce(r.validatingFields,R,F):Ie(r.validatingFields,R))}),h.state.next({validatingFields:r.validatingFields,isValidating:!Je(r.validatingFields)}))},m=(j,F=[],R,X,Y=!0,Z=!0)=>{if(X&&R&&!t.disabled){if(i.action=!0,Z&&Array.isArray(re(s,j))){const ue=R(re(s,j),X.argA,X.argB);Y&&Ce(s,j,ue)}if(Z&&Array.isArray(re(r.errors,j))){const ue=R(re(r.errors,j),X.argA,X.argB);Y&&Ce(r.errors,j,ue),ud(r.errors,j)}if((u.touchedFields||f.touchedFields)&&Z&&Array.isArray(re(r.touchedFields,j))){const ue=R(re(r.touchedFields,j),X.argA,X.argB);Y&&Ce(r.touchedFields,j,ue)}(u.dirtyFields||f.dirtyFields)&&(r.dirtyFields=jr(n,a)),h.state.next({name:j,isDirty:z(j,F),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Ce(a,j,F)},w=(j,F)=>{Ce(r.errors,j,F),h.state.next({errors:r.errors})},y=j=>{r.errors=j,h.state.next({errors:r.errors,isValid:!1})},T=(j,F,R,X)=>{const Y=re(s,j);if(Y){const Z=re(a,j,Re(R)?re(n,j):R);Re(Z)||X&&X.defaultChecked||F?Ce(a,j,F?Z:ka(Y._f)):P(j,Z),i.mount&&g()}},N=(j,F,R,X,Y)=>{let Z=!1,ue=!1;const xe={name:j};if(!t.disabled){if(!R||X){(u.isDirty||f.isDirty)&&(ue=r.isDirty,r.isDirty=xe.isDirty=z(),Z=ue!==xe.isDirty);const je=It(re(n,j),F);ue=!!re(r.dirtyFields,j),je?Ie(r.dirtyFields,j):Ce(r.dirtyFields,j,!0),xe.dirtyFields=r.dirtyFields,Z=Z||(u.dirtyFields||f.dirtyFields)&&ue!==!je}if(R){const je=re(r.touchedFields,j);je||(Ce(r.touchedFields,j,R),xe.touchedFields=r.touchedFields,Z=Z||(u.touchedFields||f.touchedFields)&&je!==R)}Z&&Y&&h.state.next(xe)}return Z?xe:{}},_=(j,F,R,X)=>{const Y=re(r.errors,j),Z=(u.isValid||f.isValid)&&lt(F)&&r.isValid!==F;if(t.delayError&&R?(c=v(()=>w(j,R)),c(t.delayError)):(clearTimeout(d),c=null,R?Ce(r.errors,j,R):Ie(r.errors,j)),(R?!It(Y,R):Y)||!Je(X)||Z){const ue={...X,...Z&&lt(F)?{isValid:F}:{},errors:r.errors,name:j};r={...r,...ue},h.state.next(ue)}},A=async j=>{x(j,!0);const F=await t.resolver(a,t.context,ad(j||l.mount,s,t.criteriaMode,t.shouldUseNativeValidation));return x(j),F},S=async j=>{const{errors:F}=await A(j);if(j)for(const R of j){const X=re(F,R);X?Ce(r.errors,R,X):Ie(r.errors,R)}else r.errors=F;return F},$=async(j,F,R={valid:!0})=>{for(const X in j){const Y=j[X];if(Y){const{_f:Z,...ue}=Y;if(Z){const xe=l.array.has(Z.name),je=Y._f&&od(Y._f);je&&u.validatingFields&&x([X],!0);const Fe=await Ta(Y,l.disabled,a,p,t.shouldUseNativeValidation&&!F,xe);if(je&&u.validatingFields&&x([X]),Fe[Z.name]&&(R.valid=!1,F))break;!F&&(re(Fe,Z.name)?xe?fd(r.errors,Fe,Z.name):Ce(r.errors,Z.name,Fe[Z.name]):Ie(r.errors,Z.name))}!Je(ue)&&await $(ue,F,R)}}return R.valid},V=()=>{for(const j of l.unMount){const F=re(s,j);F&&(F._f.refs?F._f.refs.every(R=>!Gs(R)):!Gs(F._f.ref))&&W(j)}l.unMount=new Set},z=(j,F)=>!t.disabled&&(j&&F&&Ce(a,j,F),!It(C(),n)),q=(j,F,R)=>ei(j,l,{...i.mount?a:Re(F)?n:Nt(j)?{[j]:F}:F},R,F),D=j=>Rs(re(i.mount?a:n,j,t.shouldUnregister?re(n,j,[]):[])),P=(j,F,R={})=>{const X=re(s,j);let Y=F;if(X){const Z=X._f;Z&&(!Z.disabled&&Ce(a,j,ii(F,Z)),Y=gs(Z.ref)&&Ze(F)?"":F,si(Z.ref)?[...Z.ref.options].forEach(ue=>ue.selected=Y.includes(ue.value)):Z.refs?$r(Z.ref)?Z.refs.forEach(ue=>{(!ue.defaultChecked||!ue.disabled)&&(Array.isArray(Y)?ue.checked=!!Y.find(xe=>xe===ue.value):ue.checked=Y===ue.value||!!Y)}):Z.refs.forEach(ue=>ue.checked=ue.value===Y):Kn(Z.ref)?Z.ref.value="":(Z.ref.value=Y,Z.ref.type||h.state.next({name:j,values:qe(a)})))}(R.shouldDirty||R.shouldTouch)&&N(j,Y,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&le(j)},E=(j,F,R)=>{for(const X in F){if(!F.hasOwnProperty(X))return;const Y=F[X],Z=`${j}.${X}`,ue=re(s,Z);(l.array.has(j)||De(Y)||ue&&!ue._f)&&!Zt(Y)?E(Z,Y,R):P(Z,Y,R)}},te=(j,F,R={})=>{const X=re(s,j),Y=l.array.has(j),Z=qe(F);Ce(a,j,Z),Y?(h.array.next({name:j,values:qe(a)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&R.shouldDirty&&h.state.next({name:j,dirtyFields:jr(n,a),isDirty:z(j,Z)})):X&&!X._f&&!Ze(Z)?E(j,Z,R):P(j,Z,R),Ea(j,l)&&h.state.next({...r}),h.state.next({name:i.mount?j:void 0,values:qe(a)})},ne=async j=>{i.mount=!0;const F=j.target;let R=F.name,X=!0;const Y=re(s,R),Z=je=>{X=Number.isNaN(je)||Zt(je)&&isNaN(je.getTime())||It(je,re(a,R,je))},ue=Na(t.mode),xe=Na(t.reValidateMode);if(Y){let je,Fe;const vt=F.type?ka(Y._f):Zo(j),Me=j.type===bs.BLUR||j.type===bs.FOCUS_OUT,Vt=!id(Y._f)&&!t.resolver&&!re(r.errors,R)&&!Y._f.deps||dd(Me,re(r.touchedFields,R),r.isSubmitted,xe,ue),Ft=Ea(R,l,Me);Ce(a,R,vt),Me?(Y._f.onBlur&&Y._f.onBlur(j),c&&c(0)):Y._f.onChange&&Y._f.onChange(j);const Ot=N(R,vt,Me),Rt=!Je(Ot)||Ft;if(!Me&&h.state.next({name:R,type:j.type,values:qe(a)}),Vt)return(u.isValid||f.isValid)&&(t.mode==="onBlur"?Me&&g():Me||g()),Rt&&h.state.next({name:R,...Ft?{}:Ot});if(!Me&&Ft&&h.state.next({...r}),t.resolver){const{errors:Dt}=await A([R]);if(Z(vt),X){const rr=Ca(r.errors,s,R),Mt=Ca(Dt,s,rr.name||R);je=Mt.error,R=Mt.name,Fe=Je(Dt)}}else x([R],!0),je=(await Ta(Y,l.disabled,a,p,t.shouldUseNativeValidation))[R],x([R]),Z(vt),X&&(je?Fe=!1:(u.isValid||f.isValid)&&(Fe=await $(s,!0)));X&&(Y._f.deps&&le(Y._f.deps),_(R,Fe,je,Ot))}},K=(j,F)=>{if(re(r.errors,F)&&j.focus)return j.focus(),1},le=async(j,F={})=>{let R,X;const Y=Sr(j);if(t.resolver){const Z=await S(Re(j)?j:Y);R=Je(Z),X=j?!Y.some(ue=>re(Z,ue)):R}else j?(X=(await Promise.all(Y.map(async Z=>{const ue=re(s,Z);return await $(ue&&ue._f?{[Z]:ue}:ue)}))).every(Boolean),!(!X&&!r.isValid)&&g()):X=R=await $(s);return h.state.next({...!Nt(j)||(u.isValid||f.isValid)&&R!==r.isValid?{}:{name:j},...t.resolver||!j?{isValid:R}:{},errors:r.errors}),F.shouldFocus&&!X&&Er(s,K,j?Y:l.mount),X},C=j=>{const F={...i.mount?a:n};return Re(j)?F:Nt(j)?re(F,j):j.map(R=>re(F,R))},k=(j,F)=>({invalid:!!re((F||r).errors,j),isDirty:!!re((F||r).dirtyFields,j),error:re((F||r).errors,j),isValidating:!!re(r.validatingFields,j),isTouched:!!re((F||r).touchedFields,j)}),I=j=>{j&&Sr(j).forEach(F=>Ie(r.errors,F)),h.state.next({errors:j?r.errors:{}})},U=(j,F,R)=>{const X=(re(s,j,{_f:{}})._f||{}).ref,Y=re(r.errors,j)||{},{ref:Z,message:ue,type:xe,...je}=Y;Ce(r.errors,j,{...je,...F,ref:X}),h.state.next({name:j,errors:r.errors,isValid:!1}),R&&R.shouldFocus&&X&&X.focus&&X.focus()},G=(j,F)=>pt(j)?h.state.subscribe({next:R=>j(q(void 0,F),R)}):q(j,F,!0),ee=j=>h.state.subscribe({next:F=>{cd(j.name,F.name,j.exact)&&ld(F,j.formState||u,ce,j.reRenderRoot)&&j.callback({values:{...a},...r,...F})}}).unsubscribe,M=j=>(i.mount=!0,f={...f,...j.formState},ee({...j,formState:f})),W=(j,F={})=>{for(const R of j?Sr(j):l.mount)l.mount.delete(R),l.array.delete(R),F.keepValue||(Ie(s,R),Ie(a,R)),!F.keepError&&Ie(r.errors,R),!F.keepDirty&&Ie(r.dirtyFields,R),!F.keepTouched&&Ie(r.touchedFields,R),!F.keepIsValidating&&Ie(r.validatingFields,R),!t.shouldUnregister&&!F.keepDefaultValue&&Ie(n,R);h.state.next({values:qe(a)}),h.state.next({...r,...F.keepDirty?{isDirty:z()}:{}}),!F.keepIsValid&&g()},me=({disabled:j,name:F})=>{(lt(j)&&i.mount||j||l.disabled.has(F))&&(j?l.disabled.add(F):l.disabled.delete(F))},be=(j,F={})=>{let R=re(s,j);const X=lt(F.disabled)||lt(t.disabled);return Ce(s,j,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:j}},name:j,mount:!0,...F}}),l.mount.add(j),R?me({disabled:lt(F.disabled)?F.disabled:t.disabled,name:j}):T(j,!0,F.value),{...X?{disabled:F.disabled||t.disabled}:{},...t.progressive?{required:!!F.required,min:kr(F.min),max:kr(F.max),minLength:kr(F.minLength),maxLength:kr(F.maxLength),pattern:kr(F.pattern)}:{},name:j,onChange:ne,onBlur:ne,ref:Y=>{if(Y){be(j,F),R=re(s,j);const Z=Re(Y.value)&&Y.querySelectorAll&&Y.querySelectorAll("input,select,textarea")[0]||Y,ue=rd(Z),xe=R._f.refs||[];if(ue?xe.find(je=>je===Z):Z===R._f.ref)return;Ce(s,j,{_f:{...R._f,...ue?{refs:[...xe.filter(Gs),Z,...Array.isArray(re(n,j))?[{}]:[]],ref:{type:Z.type,name:j}}:{ref:Z}}}),T(j,!1,void 0,Z)}else R=re(s,j,{}),R._f&&(R._f.mount=!1),(t.shouldUnregister||F.shouldUnregister)&&!(Yo(l.array,j)&&i.action)&&l.unMount.add(j)}}},de=()=>t.shouldFocusError&&Er(s,K,l.mount),ke=j=>{lt(j)&&(h.state.next({disabled:j}),Er(s,(F,R)=>{const X=re(s,R);X&&(F.disabled=X._f.disabled||j,Array.isArray(X._f.refs)&&X._f.refs.forEach(Y=>{Y.disabled=X._f.disabled||j}))},0,!1))},ge=(j,F)=>async R=>{let X;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let Y=qe(a);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:Z,values:ue}=await A();r.errors=Z,Y=ue}else await $(s);if(l.disabled.size)for(const Z of l.disabled)Ce(Y,Z,void 0);if(Ie(r.errors,"root"),Je(r.errors)){h.state.next({errors:{}});try{await j(Y,R)}catch(Z){X=Z}}else F&&await F({...r.errors},R),de(),setTimeout(de);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Je(r.errors)&&!X,submitCount:r.submitCount+1,errors:r.errors}),X)throw X},he=(j,F={})=>{re(s,j)&&(Re(F.defaultValue)?te(j,qe(re(n,j))):(te(j,F.defaultValue),Ce(n,j,qe(F.defaultValue))),F.keepTouched||Ie(r.touchedFields,j),F.keepDirty||(Ie(r.dirtyFields,j),r.isDirty=F.defaultValue?z(j,qe(re(n,j))):z()),F.keepError||(Ie(r.errors,j),u.isValid&&g()),h.state.next({...r}))},fe=(j,F={})=>{const R=j?qe(j):n,X=qe(R),Y=Je(j),Z=Y?n:X;if(F.keepDefaultValues||(n=R),!F.keepValues){if(F.keepDirtyValues){const ue=new Set([...l.mount,...Object.keys(jr(n,a))]);for(const xe of Array.from(ue))re(r.dirtyFields,xe)?Ce(Z,xe,re(a,xe)):te(xe,re(Z,xe))}else{if(Bn&&Re(j))for(const ue of l.mount){const xe=re(s,ue);if(xe&&xe._f){const je=Array.isArray(xe._f.refs)?xe._f.refs[0]:xe._f.ref;if(gs(je)){const Fe=je.closest("form");if(Fe){Fe.reset();break}}}}for(const ue of l.mount)te(ue,re(Z,ue))}a=qe(Z),h.array.next({values:{...Z}}),h.state.next({values:{...Z}})}l={mount:F.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!u.isValid||!!F.keepIsValid||!!F.keepDirtyValues,i.watch=!!t.shouldUnregister,h.state.next({submitCount:F.keepSubmitCount?r.submitCount:0,isDirty:Y?!1:F.keepDirty?r.isDirty:!!(F.keepDefaultValues&&!It(j,n)),isSubmitted:F.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:Y?{}:F.keepDirtyValues?F.keepDefaultValues&&a?jr(n,a):r.dirtyFields:F.keepDefaultValues&&j?jr(n,j):F.keepDirty?r.dirtyFields:{},touchedFields:F.keepTouched?r.touchedFields:{},errors:F.keepErrors?r.errors:{},isSubmitSuccessful:F.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},pe=(j,F)=>fe(pt(j)?j(a):j,F),ye=(j,F={})=>{const R=re(s,j),X=R&&R._f;if(X){const Y=X.refs?X.refs[0]:X.ref;Y.focus&&(Y.focus(),F.shouldSelect&&pt(Y.select)&&Y.select())}},ce=j=>{r={...r,...j}},Te={control:{register:be,unregister:W,getFieldState:k,handleSubmit:ge,setError:U,_subscribe:ee,_runSchema:A,_getWatch:q,_getDirty:z,_setValid:g,_setFieldArray:m,_setDisabledField:me,_setErrors:y,_getFieldArray:D,_reset:fe,_resetDefaultValues:()=>pt(t.defaultValues)&&t.defaultValues().then(j=>{pe(j,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:V,_disableForm:ke,_subjects:h,_proxyFormState:u,get _fields(){return s},get _formValues(){return a},get _state(){return i},set _state(j){i=j},get _defaultValues(){return n},get _names(){return l},set _names(j){l=j},get _formState(){return r},get _options(){return t},set _options(j){t={...t,...j}}},subscribe:M,trigger:le,register:be,handleSubmit:ge,watch:G,setValue:te,getValues:C,reset:pe,resetField:he,clearErrors:I,unregister:W,setError:U,setFocus:ye,getFieldState:k};return{...Te,formControl:Te}}function pd(e={}){const t=b.useRef(void 0),r=b.useRef(void 0),[s,n]=b.useState({isDirty:!1,isValidating:!1,isLoading:pt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:pt(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:hd(e),formState:s},e.formControl&&e.defaultValues&&!pt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const a=t.current.control;return a._options=e,qn(()=>{const i=a._subscribe({formState:a._proxyFormState,callback:()=>n({...a._formState}),reRenderRoot:!0});return n(l=>({...l,isReady:!0})),a._formState.isReady=!0,i},[a]),b.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),b.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode),e.errors&&!Je(e.errors)&&a._setErrors(e.errors)},[a,e.errors,e.mode,e.reValidateMode]),b.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),b.useEffect(()=>{if(a._proxyFormState.isDirty){const i=a._getDirty();i!==s.isDirty&&a._subjects.state.next({isDirty:i})}},[a,s.isDirty]),b.useEffect(()=>{e.values&&!It(e.values,r.current)?(a._reset(e.values,a._options.resetOptions),r.current=e.values,n(i=>({...i}))):a._resetDefaultValues()},[a,e.values]),b.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=Qo(s,a),t.current}const ci={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},bd={sm:"h-6",md:"h-10",lg:"h-12"},gd={sm:"px-2",md:"px-2.5",lg:"px-3"};function _a(e,t,r,s,n,a,i){const l=t?"datetime-local":"date",c=se("box-border w-full rounded-lg border outline-none transition font-[var(--font-primary)]",ci[r],bd[r],gd[r],a?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]"),f=Hc(c,n?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-disabled)] cursor-not-allowed opacity-60":"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",i);return o.jsxs(o.Fragment,{children:[o.jsx("input",{id:e,type:l,disabled:n,"aria-disabled":n,"data-disabled":n?"true":"false",...s,className:f}),o.jsx("div",{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 _r(e){const{control:t,name:r,rules:s,defaultValue:n,showTime:a=!1,size:i="sm",width:l="100%",label:c,labelHidden:d=!1,hasError:u=!1,errorMessage:f="",disabled:h=!1,className:p,onChange:v}=e,g=b.useId(),x=r||g;return o.jsxs("div",{className:se("flex flex-col",p),style:{width:l,maxWidth:"100%"},children:[c&&o.jsx("label",{htmlFor:x,className:se("pb-2 text-[var(--color-ds-text-primary)]",ci[i],d&&"sr-only"),children:c}),t&&r?o.jsx(gt,{name:r,control:t,rules:s,defaultValue:n,render:({field:m,fieldState:w})=>_a(x,a,i,{value:m.value,onChange:m.onChange,onBlur:m.onBlur},h,w.error,p)}):_a(x,a,i,{defaultValue:n,onChange:v},h,u?{message:f}:void 0,p)]})}const xd=({trigger:e,items:t,align:r="left",className:s})=>{const[n,a]=b.useState(!1),i=b.useRef(null),l=b.useRef([]);b.useEffect(()=>{const d=u=>{i.current&&!i.current.contains(u.target)&&a(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[]);const c=d=>{var f,h;const u=l.current.findIndex(p=>p===document.activeElement);if(d.key==="Escape")a(!1);else if(d.key==="ArrowDown"){d.preventDefault();const p=(u+1)%t.length;(f=l.current[p])==null||f.focus()}else if(d.key==="ArrowUp"){d.preventDefault();const p=(u-1+t.length)%t.length;(h=l.current[p])==null||h.focus()}};return o.jsxs("div",{className:se("relative inline-block",s),ref:i,children:[o.jsx("button",{type:"button",onClick:()=>a(d=>!d),className:"inline-flex items-center focus:outline-none","aria-haspopup":"menu","aria-expanded":n,children:e}),n&&o.jsx("div",{role:"menu","aria-orientation":"vertical",className:se("absolute mt-2 min-w-[160px] bg-[var(--color-ds-background-page)]","border border-[var(--color-ds-border-muted)] rounded shadow-lg z-10",r==="right"?"right-0":"left-0"),onKeyDown:c,children:t.map((d,u)=>{const{label:f,onSelect:h,disabled:p,icon:v}=d;return o.jsxs("button",{role:"menuitem",type:"button",disabled:p,ref:g=>{l.current[u]=g},className:se("w-full flex items-center px-4 py-2 text-[var(--color-ds-text-primary)] text-ds-md transition-colors",p?"opacity-50 cursor-not-allowed":"hover:bg-[var(--color-ds-background-surface)]"),onClick:()=>{p||(h(),a(!1))},children:[v&&o.jsx(v,{className:"w-5 h-5 mr-2 text-[var(--color-ds-text-secondary)]"}),f]},u)})})]})},vd=(e,t,r,s)=>{var a,i,l,c;const n=[r,{code:t,...s||{}}];if((i=(a=e==null?void 0:e.services)==null?void 0:a.logger)!=null&&i.forward)return e.services.logger.forward(n,"warn","react-i18next::",!0);Yt(n[0])&&(n[0]=`react-i18next:: ${n[0]}`),(c=(l=e==null?void 0:e.services)==null?void 0:l.logger)!=null&&c.warn?e.services.logger.warn(...n):console!=null&&console.warn&&console.warn(...n)},Fa={},wn=(e,t,r,s)=>{Yt(r)&&Fa[r]||(Yt(r)&&(Fa[r]=new Date),vd(e,t,r,s))},di=(e,t)=>()=>{if(e.isInitialized)t();else{const r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}},jn=(e,t,r)=>{e.loadNamespaces(t,di(e,r))},Oa=(e,t,r,s)=>{if(Yt(r)&&(r=[r]),e.options.preload&&e.options.preload.indexOf(t)>-1)return jn(e,r,s);r.forEach(n=>{e.options.ns.indexOf(n)<0&&e.options.ns.push(n)}),e.loadLanguages(t,di(e,s))},yd=(e,t,r={})=>!t.languages||!t.languages.length?(wn(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:r.lng,precheck:(s,n)=>{var a;if(((a=r.bindI18n)==null?void 0:a.indexOf("languageChanging"))>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!n(s.isLanguageChangingTo,e))return!1}}),Yt=e=>typeof e=="string",wd=e=>typeof e=="object"&&e!==null,jd=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,kd={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Nd=e=>kd[e],Sd=e=>e.replace(jd,Nd);let Ed={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Sd};const Cd=()=>Ed;let Ad;const Td=()=>Ad,_d=b.createContext();class Fd{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Od=(e,t)=>{const r=b.useRef();return b.useEffect(()=>{r.current=e},[e,t]),r.current},ui=(e,t,r,s)=>e.getFixedT(t,r,s),Rd=(e,t,r,s)=>b.useCallback(ui(e,t,r,s),[e,t,r,s]),Jn=(e,t={})=>{var T,N,_,A;const{i18n:r}=t,{i18n:s,defaultNS:n}=b.useContext(_d)||{},a=r||s||Td();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new Fd),!a){wn(a,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const S=(V,z)=>Yt(z)?z:wd(z)&&Yt(z.defaultValue)?z.defaultValue:Array.isArray(V)?V[V.length-1]:V,$=[S,{},!1];return $.t=S,$.i18n={},$.ready=!1,$}(T=a.options.react)!=null&&T.wait&&wn(a,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const i={...Cd(),...a.options.react,...t},{useSuspense:l,keyPrefix:c}=i;let d=n||((N=a.options)==null?void 0:N.defaultNS);d=Yt(d)?[d]:d||["translation"],(A=(_=a.reportNamespaces).addUsedNamespaces)==null||A.call(_,d);const u=(a.isInitialized||a.initializedStoreOnce)&&d.every(S=>yd(S,a,i)),f=Rd(a,t.lng||null,i.nsMode==="fallback"?d:d[0],c),h=()=>f,p=()=>ui(a,t.lng||null,i.nsMode==="fallback"?d:d[0],c),[v,g]=b.useState(h);let x=d.join();t.lng&&(x=`${t.lng}${x}`);const m=Od(x),w=b.useRef(!0);b.useEffect(()=>{const{bindI18n:S,bindI18nStore:$}=i;w.current=!0,!u&&!l&&(t.lng?Oa(a,t.lng,d,()=>{w.current&&g(p)}):jn(a,d,()=>{w.current&&g(p)})),u&&m&&m!==x&&w.current&&g(p);const V=()=>{w.current&&g(p)};return S&&(a==null||a.on(S,V)),$&&(a==null||a.store.on($,V)),()=>{w.current=!1,a&&(S==null||S.split(" ").forEach(z=>a.off(z,V))),$&&a&&$.split(" ").forEach(z=>a.store.off(z,V))}},[a,x]),b.useEffect(()=>{w.current&&u&&g(h)},[a,c,u]);const y=[v,a,u];if(y.t=v,y.i18n=a,y.ready=u,u||!u&&!l)return y;throw new Promise(S=>{t.lng?Oa(a,t.lng,d,()=>S()):jn(a,d,()=>S())})},kn={sm:"text-sm",md:"text-base",lg:"text-lg"};function Ra(e,t,r,s,n,a,i,l,c){const{t:d}=Jn(),u=b.useRef(null),f=typeof s=="number"&&t.length>=s,h=()=>{var w;!i&&!f&&((w=u.current)==null||w.click())},p=w=>{const y=w.target.files;if(!y)return;const T=Array.from(y);let N=t.concat(T);s&&(N=N.slice(0,s)),r(N),w.target.value=""},v=w=>{if(w.preventDefault(),i||f)return;const y=Array.from(w.dataTransfer.files);let T=t.concat(y);s&&(T=T.slice(0,s)),r(T)},g=w=>{w.preventDefault()},x=w=>{const y=URL.createObjectURL(w);window.open(y)},m=w=>{const y=t.filter((T,N)=>N!==w);r(y)};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"self-start mb-4 w-auto",children:o.jsx(ie,{type:"button",variant:"outline",size:a,icon:ha,onClick:h,disabled:i||f,children:d("ds.fileUploader.browse","Browse files")})}),!f&&o.jsxs("div",{className:se("relative flex bg-[var(--color-ds-background-page)] flex-col items-center justify-center border-2 border-dashed border-[var(--color-ds-border-muted)] rounded-lg p-4",i?"opacity-50 cursor-not-allowed":"hover:border-[var(--color-ds-border-default)]",kn[a],c),onDrop:v,onDragOver:g,children:[o.jsx("input",{id:e,type:"file",ref:u,className:"hidden",multiple:s!==1,accept:n,onChange:p,disabled:i}),o.jsx(kt,{component:Xl,size:"md",className:"w-8 h-8 text-[var(--color-ds-text-secondary)]"}),o.jsx("p",{className:"mt-3 text-[var(--color-ds-text-secondary)] text-center",children:d("ds.fileUploader.dragDrop","Drag & drop your files here or click to browse")})]}),t.length>0&&o.jsx("ul",{className:"mt-4 space-y-1",children:t.map((w,y)=>o.jsxs("li",{className:"flex items-center justify-between text-[var(--color-ds-text-secondary)] text-sm",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx(ha,{className:"w-4 h-4 mr-2","aria-hidden":"true"}),o.jsx("span",{className:"truncate pr-2",children:w.name})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ie,{variant:"ghost",size:"sm",icon:$o,ariaLabel:d("ds.fileUploader.view","View"),onClick:()=>x(w)}),o.jsx(ie,{variant:"ghost",size:"sm",icon:In,ariaLabel:d("ds.fileUploader.remove","Remove"),onClick:()=>m(y)})]})]},y))}),o.jsx("div",{className:"pt-[5px] min-h-[18px] w-full",children:l!=null&&l.message?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:l.message}):o.jsx("span",{"aria-hidden":"true",children:" "})})]})}function fi(e){const{control:t,name:r,rules:s,defaultValue:n,maxFiles:a,accept:i,size:l="sm",width:c="100%",label:d,labelHidden:u=!1,disabled:f=!1,hasError:h=!1,errorMessage:p="",className:v}=e,g=b.useId(),x=r||g;if(t&&r)return o.jsxs("div",{className:se("flex flex-col",v),style:{width:c},children:[d&&o.jsx("label",{htmlFor:x,className:se("pb-[10px] text-[var(--color-ds-text-primary)]",kn[l],u&&"sr-only"),children:d}),o.jsx(gt,{name:r,control:t,rules:s,defaultValue:n instanceof FileList?Array.from(n):n||[],render:({field:y,fieldState:T})=>Ra(x,y.value,N=>y.onChange(N),a,i,l,f,T.error,v)})]});const[m,w]=b.useState(n instanceof FileList?Array.from(n):n||[]);return o.jsxs("div",{className:se("flex flex-col",v),style:{width:c},children:[d&&o.jsx("label",{htmlFor:x,className:se("pb-[10px] text-[var(--color-ds-text-primary)]",kn[l],u&&"sr-only"),children:d}),Ra(x,m,w,a,i,l,f,h?{message:p}:void 0,v)]})}const Xt=({count:e=1,width:t,height:r="1em",variant:s="rect",className:n})=>{const a=Array.from({length:e});return o.jsx(o.Fragment,{children:a.map((i,l)=>o.jsx("span",{role:"status","aria-label":"Cargando...",className:se("bg-[var(--color-ds-border-muted)] animate-pulse inline-block",s==="circle"?"rounded-full":"rounded",n),style:{width:t??"auto",height:r}},l))})},Xr={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},Dd={sm:"h-6",md:"h-10",lg:"h-12"},Md={sm:"px-2",md:"px-2.5",lg:"px-3"},Da={sm:"pl-2",md:"pl-2.5",lg:"pl-3"},$d={sm:"1.5rem",md:"2.5rem",lg:"3rem"};function we({id:e,type:t="text",size:r="sm",width:s="100%",label:n,labelHidden:a=!1,hasError:i=!1,errorMessage:l="",prefixIcon:c,suffixIcon:d,separator:u,suffixButton:f,disabled:h=!1,control:p,name:v,rules:g,defaultValue:x,reserveErrorSpace:m,disableErrorPlaceholder:w,loading:y=!1,className:T,...N}){const _=b.useId(),[A,S]=b.useState(!1),$=e||_,V=t==="password",q=c??(t==="number"?oc:void 0),D=V?A?sc:$o:d,P=typeof m=="boolean"?m:typeof w=="boolean"?!w:!!p,E=se("box-border w-full rounded-lg border placeholder-[var(--color-ds-text-secondary)] outline-none transition font-[var(--font-primary)] appearance-none",Xr[r],Dd[r],Md[r],i?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]","bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]","disabled:bg-[var(--color-ds-background-disabled)]","disabled:border-[var(--color-ds-border-muted)]","disabled:text-[var(--color-ds-text-disabled)]","disabled:cursor-not-allowed");return y?o.jsxs("div",{className:"flex flex-col",style:{width:s,maxWidth:"100%"},children:[!a&&n&&o.jsx("label",{htmlFor:$,className:se("pb-2",Xr[r]),children:n}),o.jsx(Xt,{width:"100%",height:$d[r],variant:"rect",className:"rounded-lg"}),o.jsx("div",{className:"min-h-[18px] w-full",children:o.jsx("span",{"aria-hidden":"true",children:" "})})]}):p&&v?o.jsx(gt,{name:v,control:p,rules:g,defaultValue:x,render:({field:te,fieldState:ne})=>o.jsxs("div",{className:"flex flex-col",style:{width:s},children:[!a&&n&&o.jsx("label",{htmlFor:$,className:se("pb-2 text-[var(--color-ds-text-primary)]",Xr[r]),children:n}),o.jsxs("div",{className:"relative flex items-center w-full",children:[q&&o.jsx("div",{className:se("absolute left-0 flex items-center h-full",Da[r]),children:o.jsx(kt,{component:q,size:r,className:"text-[var(--color-ds-text-secondary)]"})}),o.jsx("input",{...te,id:$,type:V?A?"text":"password":t,disabled:h,"aria-invalid":!!ne.error,className:se(E,q&&"pl-9",D&&"pr-9",T),onInvalid:K=>K.preventDefault(),style:V&&!A?{WebkitTextSecurity:"disc",MozTextSecurity:"disc"}:void 0}),u&&o.jsx("div",{className:"flex items-center h-full",children:u}),f&&o.jsx("div",{className:"flex items-center h-full pr-2",children:f}),D&&o.jsx("button",{type:"button",onClick:()=>S(K=>!K),className:"absolute right-0 flex items-center h-full pr-2",tabIndex:-1,children:o.jsx(kt,{component:D,size:r,className:"text-[var(--color-ds-text-secondary)]"})})]}),P?o.jsx("div",{className:"min-h-[18px]",children:ne.error?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:ne.error.message}):o.jsx("span",{"aria-hidden":"true",children:" "})}):ne.error?o.jsx("div",{className:"pt-1",children:o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:ne.error.message})}):null]})}):o.jsxs("div",{className:"flex flex-col",style:{width:s},children:[!a&&n&&o.jsx("label",{htmlFor:$,className:se("pb-2 text-[var(--color-ds-text-primary)]",Xr[r]),children:n}),o.jsxs("div",{className:"relative flex items-center w-full",children:[q&&o.jsx("div",{className:se("absolute left-0 flex items-center h-full",Da[r]),children:o.jsx(kt,{component:q,size:r,className:"text-[var(--color-ds-text-secondary)]"})}),o.jsx("input",{...N,id:$,type:V?A?"text":"password":t,disabled:h,"aria-invalid":i,className:se(E,q&&"pl-9",D&&"pr-9",T),onInvalid:te=>te.preventDefault(),style:V&&!A?{WebkitTextSecurity:"disc",MozTextSecurity:"disc"}:void 0}),u&&o.jsx("div",{className:"flex items-center h-full",children:u}),f&&o.jsx("div",{className:"flex items-center h-full",children:f}),D&&o.jsx("button",{type:"button",onClick:()=>S(te=>!te),className:"absolute right-0 flex items-center h-full pr-2",tabIndex:-1,children:o.jsx(kt,{component:D,size:r,className:"text-[var(--color-ds-text-secondary)]"})})]}),P?o.jsx("div",{className:"min-h-[18px]",children:i&&l?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:l}):o.jsx("span",{"aria-hidden":"true",children:" "})}):i&&l?o.jsx("div",{className:"pt-1",children:o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:l})}):null]})}const Ld={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},Js=400,Qr=8,Zn=({children:e,size:t="sm",position:r="top",className:s,onClick:n,ariaLabel:a="Más información"})=>{const[i,l]=b.useState(!1),[c,d]=b.useState({x:0,y:0}),u=b.useRef(null),f=b.useId();b.useEffect(()=>{if(i&&u.current){const v=u.current.getBoundingClientRect();let g=0,x=0;switch(r){case"top":g=v.left+v.width/2-Js/2,x=v.top-Qr;break;case"bottom":g=v.left+v.width/2-Js/2,x=v.bottom+Qr;break;case"left":g=v.left-Js-Qr,x=v.top+v.height/2;break;case"right":g=v.right+Qr,x=v.top+v.height/2;break}d({x:g,y:x})}},[i,r]);const h=()=>typeof e=="string"?o.jsx("div",{dangerouslySetInnerHTML:{__html:e}}):o.jsx(o.Fragment,{children:e}),p=i?o.jsx("div",{id:f,role:"tooltip",className:se("fixed z-50 w-[250px] bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)] text-ds-sm rounded p-2 shadow-lg","pointer-events-none"),style:{top:`${c.y}px`,left:`${c.x}px`,transform:r==="left"||r==="right"?"translateY(-50%)":r==="top"?"translateY(-100%)":void 0},children:h()}):null;return o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button","aria-describedby":f,ref:u,"aria-label":a,className:se("inline-flex items-center justify-center focus:outline-none",Ld[t],"text-[var(--color-ds-text-secondary)] hover:text-[var(--color-ds-text-primary)]",s),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onFocus:()=>l(!0),onBlur:()=>l(!1),onClick:n,children:o.jsx(Lo,{className:"w-full h-full"})}),Jt.createPortal(p,document.body)]})};function Pd({name:e,label:t,type:r="text",size:s="sm",width:n,placeholder:a,validation:i,loadingDefaults:l,disabled:c,info:d}){var x;const{control:u,formState:{errors:f}}=Lr(),h=!!f[e],p=((x=f[e])==null?void 0:x.message)||"",v="relative",g=n??"w-full";return o.jsxs("div",{className:v,children:[o.jsx(gt,{name:e,control:u,rules:i,render:({field:m})=>o.jsx(we,{label:t,size:s,width:g,placeholder:a,hasError:h,errorMessage:p,loading:l,type:r,...m,disabled:c,reserveErrorSpace:!0})}),d&&o.jsx(Zn,{size:s,position:"left",className:"absolute top-1/2 right-2 -translate-y-1/2",children:d})]})}const Yn=b.memo(Pd);Yn.displayName="FormFieldInput";function zd({title:e,headerButtons:t,children:r,className:s}){return o.jsxs("div",{className:se("flex flex-col h-full",s),children:[o.jsxs("div",{className:"flex items-center justify-between py-4",children:[o.jsx("div",{className:`bg-[var(--color-ds-background-accent)] \r
22
+ <%s key={someKey} {...props} />`,U,me,be,me),le[me+U]=!0)}if(me=null,I!==void 0&&(r(I),me=""+I),i(k)&&(r(k.key),me=""+k.key),"key"in k){I={};for(var de in k)de!=="key"&&(I[de]=k[de])}else I=k;return me&&l(I,typeof C=="function"?C.displayName||C.name||"Unknown":C),d(C,me,ee,G,n(),I,M,W)}function f(C){typeof C=="object"&&C!==null&&C.$$typeof===h&&C._store&&(C._store.validated=1)}var p=b,h=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),y=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),V=Symbol.for("react.client.reference"),z=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,D=Array.isArray,P=console.createTask?console.createTask:function(){return null};p={"react-stack-bottom-frame":function(C){return C()}};var E,te={},ne=p["react-stack-bottom-frame"].bind(p,a)(),K=P(s(a)),le={};yr.Fragment=x,yr.jsx=function(C,k,I,U,G){var ee=1e4>z.recentlyCreatedOwnerStacks++;return u(C,k,I,!1,U,G,ee?Error("react-stack-top-frame"):ne,ee?P(s(C)):K)},yr.jsxs=function(C,k,I,U,G){var ee=1e4>z.recentlyCreatedOwnerStacks++;return u(C,k,I,!0,U,G,ee?Error("react-stack-top-frame"):ne,ee?P(s(C)):K)}}()),yr}var ha;function Tl(){return ha||(ha=1,process.env.NODE_ENV==="production"?Yr.exports=Cl():Yr.exports=Al()),Yr.exports}var o=Tl();function Mo(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=Mo(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function se(){for(var e,t,r=0,s="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=Mo(e))&&(s&&(s+=" "),s+=t);return s}const _l={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6",xl:"w-10 h-10",full:"w-full h-full"};function kt({component:e,size:t="sm",className:r,...s}){return o.jsx(e,{className:se(_l[t],r),"aria-hidden":s["aria-label"]?void 0:!0,...s})}const Fl="inline-flex items-center justify-center box-border font-[var(--font-primary)] font-medium rounded-lg transition focus:outline-none",Ol={primary:"bg-[var(--color-ds-button-primary-bg)] text-[var(--color-ds-button-primary-text)] hover:animate-pulse",outline:"bg-transparent text-[var(--color-ds-text-primary)] ring-1 ring-inset ring-[var(--color-ds-border-default)] hover:bg-[var(--color-ds-background-accent)] hover:text-[var(--color-ds-text-on-accent)]",ghost:"bg-transparent text-[var(--color-ds-text-primary)] hover:animate-pulse",subtle:"bg-[var(--color-ds-background-surface)] text-[var(--color-ds-text-primary)] ring-1 ring-inset ring-[var(--color-ds-border-default-50)] hover:text-[var(--color-ds-text-on-accent)] hover:bg-[var(--color-ds-background-accent)]",danger:"bg-[var(--color-ds-background-danger)] text-[var(--color-ds-text-danger)] hover:brightness-105"},Rl={xs:"text-[10px] leading-none h-5 px-1.5",sm:"text-ds-sm h-6 px-2",md:"text-ds-md h-10 px-2.5",lg:"text-ds-lg h-12 px-3"},Dl={xs:"h-5 w-5 p-0",sm:"h-6 w-6 p-0",md:"h-10 w-10 p-0",lg:"h-12 w-12 p-0"},Ml="disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-[var(--color-ds-background-disabled)] disabled:text-[var(--color-ds-text-primary)] disabled:ring-1 disabled:ring-inset disabled:ring-[var(--color-ds-border-muted)]";function ie({type:e="button",variant:t="primary",size:r="sm",width:s,disabled:n=!1,icon:a,iconPosition:i="left",ariaLabel:l,children:c,onClick:d,className:u,...f}){const p=!!a,h=p&&!c,v=h?Dl[r]:Rl[r];return o.jsxs("button",{type:e,onClick:d,disabled:n,"aria-label":h?l:void 0,style:s?{width:s}:void 0,className:se(Fl,Ol[t],v,Ml,u,p&&c&&"gap-2"),...f,children:[a&&i==="left"&&o.jsx(kt,{component:a,size:r==="xs"?"sm":r}),c,a&&i==="right"&&o.jsx(kt,{component:a,size:r==="xs"?"sm":r})]})}function $l({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 13.5 12 21m0 0-7.5-7.5M12 21V3"}))}const Ll=H.forwardRef($l);function Pl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"}))}const zl=H.forwardRef(Pl);function Il({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"}))}const Vl=H.forwardRef(Il);function Bl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18"}))}const Ul=H.forwardRef(Bl);function ql({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"}))}const Wl=H.forwardRef(ql);function Kl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))}const Rs=H.forwardRef(Kl);function Gl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"}))}const Jl=H.forwardRef(Gl);function Zl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))}const $o=H.forwardRef(Zl);function Yl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))}const Hl=H.forwardRef(Yl);function Xl({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 16.5V9.75m0 0 3 3m-3-3-3 3M6.75 19.5a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z"}))}const Ql=H.forwardRef(Xl);function ec({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.042 21.672 13.684 16.6m0 0-2.51 2.225.569-9.47 5.227 7.917-3.286-.672ZM12 2.25V4.5m5.834.166-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243-1.59-1.59"}))}const tc=H.forwardRef(ec);function rc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))}const pa=H.forwardRef(rc);function sc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"}))}const nc=H.forwardRef(sc);function ac({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const Lo=H.forwardRef(ac);function oc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5"}))}const ic=H.forwardRef(oc);function lc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const Po=H.forwardRef(lc);function cc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"}))}const dc=H.forwardRef(cc);function uc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 0 0 2.25-2.25V6a2.25 2.25 0 0 0-2.25-2.25H6A2.25 2.25 0 0 0 3.75 6v2.25A2.25 2.25 0 0 0 6 10.5Zm0 9.75h2.25A2.25 2.25 0 0 0 10.5 18v-2.25a2.25 2.25 0 0 0-2.25-2.25H6a2.25 2.25 0 0 0-2.25 2.25V18A2.25 2.25 0 0 0 6 20.25Zm9.75-9.75H18a2.25 2.25 0 0 0 2.25-2.25V6A2.25 2.25 0 0 0 18 3.75h-2.25A2.25 2.25 0 0 0 13.5 6v2.25a2.25 2.25 0 0 0 2.25 2.25Z"}))}const fc=H.forwardRef(uc);function mc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"}))}const hc=H.forwardRef(mc);function pc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}const bc=H.forwardRef(pc);function gc({title:e,titleId:t,...r},s){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?H.createElement("title",{id:t},e):null,H.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const Vn=H.forwardRef(gc),xc={default:{wrapper:"box-border w-full rounded-lg bg-[var(--color-ds-background-surface)] overflow-hidden",padX:"px-6",padY:"py-4"},plain:{wrapper:"box-border w-full overflow-hidden",padX:"px-0",padY:"py-2"},soft:{wrapper:"box-border w-full rounded-lg bg-[color-mix(in srgb,var(--color-ds-background-surface) 60%, transparent 40%)] overflow-hidden",padX:"px-4",padY:"py-3"},ghost:{wrapper:"box-border w-full overflow-hidden",padX:"px-6",padY:"py-3"}};function it({title:e,children:t,defaultOpen:r=!0,className:s,type:n="default",contentClassName:a,headerClassName:i}){const[l,c]=b.useState(r),d=b.useRef(null),[u,f]=b.useState(0),p=()=>{d.current&&f(d.current.scrollHeight)};b.useLayoutEffect(()=>{p()},[l]),b.useEffect(()=>{const v=d.current;if(!v)return;const x=new ResizeObserver(()=>p());return x.observe(v),()=>x.disconnect()},[]);const h=xc[n];return o.jsxs("div",{className:se("flex flex-col w-full gap-3",s),children:[o.jsxs("button",{type:"button",onClick:()=>c(v=>!v),"aria-expanded":l,className:se("flex items-center justify-between w-full transition-colors","hover:bg-[var(--color-ds-surface-hover)]",i),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"block w-1 h-5 bg-[var(--color-ds-background-accent)] rounded-sm"}),o.jsx("span",{className:"font-semibold text-[var(--color-ds-text-primary)]",children:e})]}),l?o.jsx(Hl,{className:"w-5 h-5 text-[var(--color-ds-text-primary)]"}):o.jsx(Rs,{className:"w-5 h-5 text-[var(--color-ds-text-primary)]"})]}),o.jsx("div",{className:h.wrapper,children:o.jsx("div",{className:h.padX,children:o.jsx("div",{className:se("overflow-hidden transition-all duration-300 ease-in-out",l?"opacity-100":"opacity-0"),style:{maxHeight:l?`${u}px`:"0px"},children:o.jsx("div",{ref:d,className:se(h.padY,a),children:t})})})})]})}const Bn="-",vc=e=>{const t=wc(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:i=>{const l=i.split(Bn);return l[0]===""&&l.length!==1&&l.shift(),zo(l,t)||yc(i)},getConflictingClassGroupIds:(i,l)=>{const c=r[i]||[];return l&&s[i]?[...c,...s[i]]:c}}},zo=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const r=e[0],s=t.nextPart.get(r),n=s?zo(e.slice(1),s):void 0;if(n)return n;if(t.validators.length===0)return;const a=e.join(Bn);return(i=t.validators.find(({validator:l})=>l(a)))==null?void 0:i.classGroupId},ba=/^\[(.+)\]$/,yc=e=>{if(ba.test(e)){const t=ba.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},wc=e=>{const{theme:t,classGroups:r}=e,s={nextPart:new Map,validators:[]};for(const n in r)xn(r[n],s,n,t);return s},xn=(e,t,r,s)=>{e.forEach(n=>{if(typeof n=="string"){const a=n===""?t:ga(t,n);a.classGroupId=r;return}if(typeof n=="function"){if(jc(n)){xn(n(s),t,r,s);return}t.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([a,i])=>{xn(i,ga(t,a),r,s)})})},ga=(e,t)=>{let r=e;return t.split(Bn).forEach(s=>{r.nextPart.has(s)||r.nextPart.set(s,{nextPart:new Map,validators:[]}),r=r.nextPart.get(s)}),r},jc=e=>e.isThemeGetter,kc=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,s=new Map;const n=(a,i)=>{r.set(a,i),t++,t>e&&(t=0,s=r,r=new Map)};return{get(a){let i=r.get(a);if(i!==void 0)return i;if((i=s.get(a))!==void 0)return n(a,i),i},set(a,i){r.has(a)?r.set(a,i):n(a,i)}}},vn="!",yn=":",Nc=yn.length,Sc=e=>{const{prefix:t,experimentalParseClassName:r}=e;let s=n=>{const a=[];let i=0,l=0,c=0,d;for(let v=0;v<n.length;v++){let x=n[v];if(i===0&&l===0){if(x===yn){a.push(n.slice(c,v)),c=v+Nc;continue}if(x==="/"){d=v;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const u=a.length===0?n:n.substring(c),f=Ec(u),p=f!==u,h=d&&d>c?d-c:void 0;return{modifiers:a,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:h}};if(t){const n=t+yn,a=s;s=i=>i.startsWith(n)?a(i.substring(n.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(r){const n=s;s=a=>r({className:a,parseClassName:n})}return s},Ec=e=>e.endsWith(vn)?e.substring(0,e.length-1):e.startsWith(vn)?e.substring(1):e,Cc=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const n=[];let a=[];return s.forEach(i=>{i[0]==="["||t[i]?(n.push(...a.sort(),i),a=[]):a.push(i)}),n.push(...a.sort()),n}},Ac=e=>({cache:kc(e.cacheSize),parseClassName:Sc(e),sortModifiers:Cc(e),...vc(e)}),Tc=/\s+/,_c=(e,t)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:n,sortModifiers:a}=t,i=[],l=e.trim().split(Tc);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:f,modifiers:p,hasImportantModifier:h,baseClassName:v,maybePostfixModifierPosition:x}=r(u);if(f){c=u+(c.length>0?" "+c:c);continue}let g=!!x,m=s(g?v.substring(0,x):v);if(!m){if(!g){c=u+(c.length>0?" "+c:c);continue}if(m=s(v),!m){c=u+(c.length>0?" "+c:c);continue}g=!1}const w=a(p).join(":"),y=h?w+vn:w,T=y+m;if(i.includes(T))continue;i.push(T);const N=n(m,g);for(let _=0;_<N.length;++_){const A=N[_];i.push(y+A)}c=u+(c.length>0?" "+c:c)}return c};function Fc(){let e=0,t,r,s="";for(;e<arguments.length;)(t=arguments[e++])&&(r=Io(t))&&(s&&(s+=" "),s+=r);return s}const Io=e=>{if(typeof e=="string")return e;let t,r="";for(let s=0;s<e.length;s++)e[s]&&(t=Io(e[s]))&&(r&&(r+=" "),r+=t);return r};function Oc(e,...t){let r,s,n,a=i;function i(c){const d=t.reduce((u,f)=>f(u),e());return r=Ac(d),s=r.cache.get,n=r.cache.set,a=l,l(c)}function l(c){const d=s(c);if(d)return d;const u=_c(c,r);return n(c,u),u}return function(){return a(Fc.apply(null,arguments))}}const ze=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},Vo=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Bo=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Rc=/^\d+\/\d+$/,Dc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Mc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,$c=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Lc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Pc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,nr=e=>Rc.test(e),ve=e=>!!e&&!Number.isNaN(Number(e)),$t=e=>!!e&&Number.isInteger(Number(e)),Ks=e=>e.endsWith("%")&&ve(e.slice(0,-1)),St=e=>Dc.test(e),zc=()=>!0,Ic=e=>Mc.test(e)&&!$c.test(e),Uo=()=>!1,Vc=e=>Lc.test(e),Bc=e=>Pc.test(e),Uc=e=>!ae(e)&&!oe(e),qc=e=>hr(e,Ko,Uo),ae=e=>Vo.test(e),Kt=e=>hr(e,Go,Ic),Gs=e=>hr(e,Zc,ve),xa=e=>hr(e,qo,Uo),Wc=e=>hr(e,Wo,Bc),Hr=e=>hr(e,Jo,Vc),oe=e=>Bo.test(e),wr=e=>pr(e,Go),Kc=e=>pr(e,Yc),va=e=>pr(e,qo),Gc=e=>pr(e,Ko),Jc=e=>pr(e,Wo),Xr=e=>pr(e,Jo,!0),hr=(e,t,r)=>{const s=Vo.exec(e);return s?s[1]?t(s[1]):r(s[2]):!1},pr=(e,t,r=!1)=>{const s=Bo.exec(e);return s?s[1]?t(s[1]):r:!1},qo=e=>e==="position"||e==="percentage",Wo=e=>e==="image"||e==="url",Ko=e=>e==="length"||e==="size"||e==="bg-size",Go=e=>e==="length",Zc=e=>e==="number",Yc=e=>e==="family-name",Jo=e=>e==="shadow",Hc=()=>{const e=ze("color"),t=ze("font"),r=ze("text"),s=ze("font-weight"),n=ze("tracking"),a=ze("leading"),i=ze("breakpoint"),l=ze("container"),c=ze("spacing"),d=ze("radius"),u=ze("shadow"),f=ze("inset-shadow"),p=ze("text-shadow"),h=ze("drop-shadow"),v=ze("blur"),x=ze("perspective"),g=ze("aspect"),m=ze("ease"),w=ze("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...T(),oe,ae],_=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto","contain","none"],S=()=>[oe,ae,c],$=()=>[nr,"full","auto",...S()],V=()=>[$t,"none","subgrid",oe,ae],z=()=>["auto",{span:["full",$t,oe,ae]},$t,oe,ae],q=()=>[$t,"auto",oe,ae],D=()=>["auto","min","max","fr",oe,ae],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],E=()=>["start","end","center","stretch","center-safe","end-safe"],te=()=>["auto",...S()],ne=()=>[nr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],K=()=>[e,oe,ae],le=()=>[...T(),va,xa,{position:[oe,ae]}],C=()=>["no-repeat",{repeat:["","x","y","space","round"]}],k=()=>["auto","cover","contain",Gc,qc,{size:[oe,ae]}],I=()=>[Ks,wr,Kt],U=()=>["","none","full",d,oe,ae],G=()=>["",ve,wr,Kt],ee=()=>["solid","dashed","dotted","double"],M=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[ve,Ks,va,xa],me=()=>["","none",v,oe,ae],be=()=>["none",ve,oe,ae],de=()=>["none",ve,oe,ae],ke=()=>[ve,oe,ae],ge=()=>[nr,"full",...S()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[St],breakpoint:[St],color:[zc],container:[St],"drop-shadow":[St],ease:["in","out","in-out"],font:[Uc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[St],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[St],shadow:[St],spacing:["px",ve],text:[St],"text-shadow":[St],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",nr,ae,oe,g]}],container:["container"],columns:[{columns:[ve,ae,oe,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:N()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:$()}],"inset-x":[{"inset-x":$()}],"inset-y":[{"inset-y":$()}],start:[{start:$()}],end:[{end:$()}],top:[{top:$()}],right:[{right:$()}],bottom:[{bottom:$()}],left:[{left:$()}],visibility:["visible","invisible","collapse"],z:[{z:[$t,"auto",oe,ae]}],basis:[{basis:[nr,"full","auto",l,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ve,nr,"auto","initial","none",ae]}],grow:[{grow:["",ve,oe,ae]}],shrink:[{shrink:["",ve,oe,ae]}],order:[{order:[$t,"first","last","none",oe,ae]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:z()}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:z()}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...E(),"normal"]}],"justify-self":[{"justify-self":["auto",...E()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...E(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...E(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...E(),"baseline"]}],"place-self":[{"place-self":["auto",...E()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:te()}],mx:[{mx:te()}],my:[{my:te()}],ms:[{ms:te()}],me:[{me:te()}],mt:[{mt:te()}],mr:[{mr:te()}],mb:[{mb:te()}],ml:[{ml:te()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:ne()}],w:[{w:[l,"screen",...ne()]}],"min-w":[{"min-w":[l,"screen","none",...ne()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...ne()]}],h:[{h:["screen","lh",...ne()]}],"min-h":[{"min-h":["screen","lh","none",...ne()]}],"max-h":[{"max-h":["screen","lh",...ne()]}],"font-size":[{text:["base",r,wr,Kt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,oe,Gs]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ks,ae]}],"font-family":[{font:[Kc,ae,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,oe,ae]}],"line-clamp":[{"line-clamp":[ve,"none",oe,Gs]}],leading:[{leading:[a,...S()]}],"list-image":[{"list-image":["none",oe,ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",oe,ae]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[ve,"from-font","auto",oe,Kt]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[ve,"auto",oe,ae]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",oe,ae]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",oe,ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:le()}],"bg-repeat":[{bg:C()}],"bg-size":[{bg:k()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$t,oe,ae],radial:["",oe,ae],conic:[$t,oe,ae]},Jc,Wc]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ve,oe,ae]}],"outline-w":[{outline:["",ve,wr,Kt]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",u,Xr,Hr]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",f,Xr,Hr]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[ve,Kt]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",p,Xr,Hr]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[ve,oe,ae]}],"mix-blend":[{"mix-blend":[...M(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":M()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ve]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":K()}],"mask-image-linear-to-color":[{"mask-linear-to":K()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":K()}],"mask-image-t-to-color":[{"mask-t-to":K()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":K()}],"mask-image-r-to-color":[{"mask-r-to":K()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":K()}],"mask-image-b-to-color":[{"mask-b-to":K()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":K()}],"mask-image-l-to-color":[{"mask-l-to":K()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":K()}],"mask-image-x-to-color":[{"mask-x-to":K()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[oe,ae]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":K()}],"mask-image-radial-to-color":[{"mask-radial-to":K()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[ve]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":K()}],"mask-image-conic-to-color":[{"mask-conic-to":K()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:le()}],"mask-repeat":[{mask:C()}],"mask-size":[{mask:k()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",oe,ae]}],filter:[{filter:["","none",oe,ae]}],blur:[{blur:me()}],brightness:[{brightness:[ve,oe,ae]}],contrast:[{contrast:[ve,oe,ae]}],"drop-shadow":[{"drop-shadow":["","none",h,Xr,Hr]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",ve,oe,ae]}],"hue-rotate":[{"hue-rotate":[ve,oe,ae]}],invert:[{invert:["",ve,oe,ae]}],saturate:[{saturate:[ve,oe,ae]}],sepia:[{sepia:["",ve,oe,ae]}],"backdrop-filter":[{"backdrop-filter":["","none",oe,ae]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[ve,oe,ae]}],"backdrop-contrast":[{"backdrop-contrast":[ve,oe,ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ve,oe,ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ve,oe,ae]}],"backdrop-invert":[{"backdrop-invert":["",ve,oe,ae]}],"backdrop-opacity":[{"backdrop-opacity":[ve,oe,ae]}],"backdrop-saturate":[{"backdrop-saturate":[ve,oe,ae]}],"backdrop-sepia":[{"backdrop-sepia":["",ve,oe,ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",oe,ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ve,"initial",oe,ae]}],ease:[{ease:["linear","initial",m,oe,ae]}],delay:[{delay:[ve,oe,ae]}],animate:[{animate:["none",w,oe,ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,oe,ae]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":["scale-3d"],skew:[{skew:ke()}],"skew-x":[{"skew-x":ke()}],"skew-y":[{"skew-y":ke()}],transform:[{transform:[oe,ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ge()}],"translate-x":[{"translate-x":ge()}],"translate-y":[{"translate-y":ge()}],"translate-z":[{"translate-z":ge()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",oe,ae]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",oe,ae]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[ve,wr,Kt,Gs]}],stroke:[{stroke:["none",...K()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Xc=Oc(Hc);var Lr=e=>e.type==="checkbox",Zt=e=>e instanceof Date,Ze=e=>e==null;const Zo=e=>typeof e=="object";var De=e=>!Ze(e)&&!Array.isArray(e)&&Zo(e)&&!Zt(e),Yo=e=>De(e)&&e.target?Lr(e.target)?e.target.checked:e.target.value:e,Qc=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Ho=(e,t)=>e.has(Qc(t)),ed=e=>{const t=e.constructor&&e.constructor.prototype;return De(t)&&t.hasOwnProperty("isPrototypeOf")},Un=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function qe(e){let t;const r=Array.isArray(e),s=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Un&&(e instanceof Blob||s))&&(r||De(e)))if(t=r?[]:{},!r&&!ed(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=qe(e[n]));else return e;return t}var Ds=e=>Array.isArray(e)?e.filter(Boolean):[],Re=e=>e===void 0,re=(e,t,r)=>{if(!t||!De(e))return r;const s=Ds(t.split(/[,[\].]+?/)).reduce((n,a)=>Ze(n)?n:n[a],e);return Re(s)||s===e?Re(e[t])?r:e[t]:s},lt=e=>typeof e=="boolean",qn=e=>/^\w*$/.test(e),Xo=e=>Ds(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ce=(e,t,r)=>{let s=-1;const n=qn(t)?[t]:Xo(t),a=n.length,i=a-1;for(;++s<a;){const l=n[s];let c=r;if(s!==i){const d=e[l];c=De(d)||Array.isArray(d)?d:isNaN(+n[s+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=c,e=e[l]}};const gs={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ht={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Et={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Qo=b.createContext(null),Pr=()=>b.useContext(Qo),td=e=>{const{children:t,...r}=e;return b.createElement(Qo.Provider,{value:r},t)};var ei=(e,t,r,s=!0)=>{const n={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(n,a,{get:()=>{const i=a;return t._proxyFormState[i]!==ht.all&&(t._proxyFormState[i]=!s||ht.all),r&&(r[i]=!0),e[i]}});return n};const Wn=typeof window<"u"?H.useLayoutEffect:H.useEffect;function rd(e){const t=Pr(),{control:r=t.control,disabled:s,name:n,exact:a}=e||{},[i,l]=b.useState(r._formState),c=b.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Wn(()=>r._subscribe({name:n,formState:c.current,exact:a,callback:d=>{!s&&l({...r._formState,...d})}}),[n,s,a]),b.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),b.useMemo(()=>ei(i,r,c.current,!1),[i,r])}var Nt=e=>typeof e=="string",ti=(e,t,r,s,n)=>Nt(e)?(s&&t.watch.add(e),re(r,e,n)):Array.isArray(e)?e.map(a=>(s&&t.watch.add(a),re(r,a))):(s&&(t.watchAll=!0),r);function Kn(e){const t=Pr(),{control:r=t.control,name:s,defaultValue:n,disabled:a,exact:i}=e||{},l=b.useRef(n),[c,d]=b.useState(r._getWatch(s,l.current));return Wn(()=>r._subscribe({name:s,formState:{values:!0},exact:i,callback:u=>!a&&d(ti(s,r._names,u.values||r._formValues,!1,l.current))}),[s,r,a,i]),b.useEffect(()=>r._removeUnmounted()),c}function ri(e){const t=Pr(),{name:r,disabled:s,control:n=t.control,shouldUnregister:a}=e,i=Ho(n._names.array,r),l=Kn({control:n,name:r,defaultValue:re(n._formValues,r,re(n._defaultValues,r,e.defaultValue)),exact:!0}),c=rd({control:n,name:r,exact:!0}),d=b.useRef(e),u=b.useRef(n.register(r,{...e.rules,value:l,...lt(e.disabled)?{disabled:e.disabled}:{}})),f=b.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!re(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!re(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!re(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!re(c.validatingFields,r)},error:{enumerable:!0,get:()=>re(c.errors,r)}}),[c,r]),p=b.useCallback(g=>u.current.onChange({target:{value:Yo(g),name:r},type:gs.CHANGE}),[r]),h=b.useCallback(()=>u.current.onBlur({target:{value:re(n._formValues,r),name:r},type:gs.BLUR}),[r,n._formValues]),v=b.useCallback(g=>{const m=re(n._fields,r);m&&g&&(m._f.ref={focus:()=>g.focus(),select:()=>g.select(),setCustomValidity:w=>g.setCustomValidity(w),reportValidity:()=>g.reportValidity()})},[n._fields,r]),x=b.useMemo(()=>({name:r,value:l,...lt(s)||c.disabled?{disabled:c.disabled||s}:{},onChange:p,onBlur:h,ref:v}),[r,s,c.disabled,p,h,v,l]);return b.useEffect(()=>{const g=n._options.shouldUnregister||a;n.register(r,{...d.current.rules,...lt(d.current.disabled)?{disabled:d.current.disabled}:{}});const m=(w,y)=>{const T=re(n._fields,w);T&&T._f&&(T._f.mount=y)};if(m(r,!0),g){const w=qe(re(n._options.defaultValues,r));Ce(n._defaultValues,r,w),Re(re(n._formValues,r))&&Ce(n._formValues,r,w)}return!i&&n.register(r),()=>{(i?g&&!n._state.action:g)?n.unregister(r):m(r,!1)}},[r,n,i,a]),b.useEffect(()=>{n._setDisabledField({disabled:s,name:r})},[s,r,n]),b.useMemo(()=>({field:x,formState:c,fieldState:f}),[x,c,f])}const gt=e=>e.render(ri(e));var si=(e,t,r,s,n)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:n||!0}}:{},Er=e=>Array.isArray(e)?e:[e],ya=()=>{let e=[];return{get observers(){return e},next:n=>{for(const a of e)a.next&&a.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(a=>a!==n)}}),unsubscribe:()=>{e=[]}}},wn=e=>Ze(e)||!Zo(e);function It(e,t){if(wn(e)||wn(t))return e===t;if(Zt(e)&&Zt(t))return e.getTime()===t.getTime();const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(const n of r){const a=e[n];if(!s.includes(n))return!1;if(n!=="ref"){const i=t[n];if(Zt(a)&&Zt(i)||De(a)&&De(i)||Array.isArray(a)&&Array.isArray(i)?!It(a,i):a!==i)return!1}}return!0}var Je=e=>De(e)&&!Object.keys(e).length,Gn=e=>e.type==="file",pt=e=>typeof e=="function",xs=e=>{if(!Un)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ni=e=>e.type==="select-multiple",Jn=e=>e.type==="radio",sd=e=>Jn(e)||Lr(e),Js=e=>xs(e)&&e.isConnected;function nd(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=Re(e)?s++:e[t[s++]];return e}function ad(e){for(const t in e)if(e.hasOwnProperty(t)&&!Re(e[t]))return!1;return!0}function Ie(e,t){const r=Array.isArray(t)?t:qn(t)?[t]:Xo(t),s=r.length===1?e:nd(e,r),n=r.length-1,a=r[n];return s&&delete s[a],n!==0&&(De(s)&&Je(s)||Array.isArray(s)&&ad(s))&&Ie(e,r.slice(0,-1)),e}var ai=e=>{for(const t in e)if(pt(e[t]))return!0;return!1};function vs(e,t={}){const r=Array.isArray(e);if(De(e)||r)for(const s in e)Array.isArray(e[s])||De(e[s])&&!ai(e[s])?(t[s]=Array.isArray(e[s])?[]:{},vs(e[s],t[s])):Ze(e[s])||(t[s]=!0);return t}function oi(e,t,r){const s=Array.isArray(e);if(De(e)||s)for(const n in e)Array.isArray(e[n])||De(e[n])&&!ai(e[n])?Re(t)||wn(r[n])?r[n]=Array.isArray(e[n])?vs(e[n],[]):{...vs(e[n])}:oi(e[n],Ze(t)?{}:t[n],r[n]):r[n]=!It(e[n],t[n]);return r}var jr=(e,t)=>oi(e,t,vs(t));const wa={value:!1,isValid:!1},ja={value:!0,isValid:!0};var ii=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Re(e[0].attributes.value)?Re(e[0].value)||e[0].value===""?ja:{value:e[0].value,isValid:!0}:ja:wa}return wa},li=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:s})=>Re(e)?e:t?e===""?NaN:e&&+e:r&&Nt(e)?new Date(e):s?s(e):e;const ka={isValid:!1,value:null};var ci=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,ka):ka;function Na(e){const t=e.ref;return Gn(t)?t.files:Jn(t)?ci(e.refs).value:ni(t)?[...t.selectedOptions].map(({value:r})=>r):Lr(t)?ii(e.refs).value:li(Re(t.value)?e.ref.value:t.value,e)}var od=(e,t,r,s)=>{const n={};for(const a of e){const i=re(t,a);i&&Ce(n,a,i._f)}return{criteriaMode:r,names:[...e],fields:n,shouldUseNativeValidation:s}},ys=e=>e instanceof RegExp,kr=e=>Re(e)?e:ys(e)?e.source:De(e)?ys(e.value)?e.value.source:e.value:e,Sa=e=>({isOnSubmit:!e||e===ht.onSubmit,isOnBlur:e===ht.onBlur,isOnChange:e===ht.onChange,isOnAll:e===ht.all,isOnTouch:e===ht.onTouched});const Ea="AsyncFunction";var id=e=>!!e&&!!e.validate&&!!(pt(e.validate)&&e.validate.constructor.name===Ea||De(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Ea)),ld=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ca=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const Cr=(e,t,r,s)=>{for(const n of r||Object.keys(e)){const a=re(e,n);if(a){const{_f:i,...l}=a;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],n)&&!s)return!0;if(i.ref&&t(i.ref,i.name)&&!s)return!0;if(Cr(l,t))break}else if(De(l)&&Cr(l,t))break}}};function Aa(e,t,r){const s=re(e,r);if(s||qn(r))return{error:s,name:r};const n=r.split(".");for(;n.length;){const a=n.join("."),i=re(t,a),l=re(e,a);if(i&&!Array.isArray(i)&&r!==a)return{name:r};if(l&&l.type)return{name:a,error:l};n.pop()}return{name:r}}var cd=(e,t,r,s)=>{r(e);const{name:n,...a}=e;return Je(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(i=>t[i]===(!s||ht.all))},dd=(e,t,r)=>!e||!t||e===t||Er(e).some(s=>s&&(r?s===t:s.startsWith(t)||t.startsWith(s))),ud=(e,t,r,s,n)=>n.isOnAll?!1:!r&&n.isOnTouch?!(t||e):(r?s.isOnBlur:n.isOnBlur)?!e:(r?s.isOnChange:n.isOnChange)?e:!0,fd=(e,t)=>!Ds(re(e,t)).length&&Ie(e,t),md=(e,t,r)=>{const s=Er(re(e,r));return Ce(s,"root",t[r]),Ce(e,r,s),e},fs=e=>Nt(e);function Ta(e,t,r="validate"){if(fs(e)||Array.isArray(e)&&e.every(fs)||lt(e)&&!e)return{type:r,message:fs(e)?e:"",ref:t}}var ar=e=>De(e)&&!ys(e)?e:{value:e,message:""},_a=async(e,t,r,s,n,a)=>{const{ref:i,refs:l,required:c,maxLength:d,minLength:u,min:f,max:p,pattern:h,validate:v,name:x,valueAsNumber:g,mount:m}=e._f,w=re(r,x);if(!m||t.has(x))return{};const y=l?l[0]:i,T=q=>{n&&y.reportValidity&&(y.setCustomValidity(lt(q)?"":q||""),y.reportValidity())},N={},_=Jn(i),A=Lr(i),S=_||A,$=(g||Gn(i))&&Re(i.value)&&Re(w)||xs(i)&&i.value===""||w===""||Array.isArray(w)&&!w.length,V=si.bind(null,x,s,N),z=(q,D,P,E=Et.maxLength,te=Et.minLength)=>{const ne=q?D:P;N[x]={type:q?E:te,message:ne,ref:i,...V(q?E:te,ne)}};if(a?!Array.isArray(w)||!w.length:c&&(!S&&($||Ze(w))||lt(w)&&!w||A&&!ii(l).isValid||_&&!ci(l).isValid)){const{value:q,message:D}=fs(c)?{value:!!c,message:c}:ar(c);if(q&&(N[x]={type:Et.required,message:D,ref:y,...V(Et.required,D)},!s))return T(D),N}if(!$&&(!Ze(f)||!Ze(p))){let q,D;const P=ar(p),E=ar(f);if(!Ze(w)&&!isNaN(w)){const te=i.valueAsNumber||w&&+w;Ze(P.value)||(q=te>P.value),Ze(E.value)||(D=te<E.value)}else{const te=i.valueAsDate||new Date(w),ne=C=>new Date(new Date().toDateString()+" "+C),K=i.type=="time",le=i.type=="week";Nt(P.value)&&w&&(q=K?ne(w)>ne(P.value):le?w>P.value:te>new Date(P.value)),Nt(E.value)&&w&&(D=K?ne(w)<ne(E.value):le?w<E.value:te<new Date(E.value))}if((q||D)&&(z(!!q,P.message,E.message,Et.max,Et.min),!s))return T(N[x].message),N}if((d||u)&&!$&&(Nt(w)||a&&Array.isArray(w))){const q=ar(d),D=ar(u),P=!Ze(q.value)&&w.length>+q.value,E=!Ze(D.value)&&w.length<+D.value;if((P||E)&&(z(P,q.message,D.message),!s))return T(N[x].message),N}if(h&&!$&&Nt(w)){const{value:q,message:D}=ar(h);if(ys(q)&&!w.match(q)&&(N[x]={type:Et.pattern,message:D,ref:i,...V(Et.pattern,D)},!s))return T(D),N}if(v){if(pt(v)){const q=await v(w,r),D=Ta(q,y);if(D&&(N[x]={...D,...V(Et.validate,D.message)},!s))return T(D.message),N}else if(De(v)){let q={};for(const D in v){if(!Je(q)&&!s)break;const P=Ta(await v[D](w,r),y,D);P&&(q={...P,...V(D,P.message)},T(P.message),s&&(N[x]=q))}if(!Je(q)&&(N[x]={ref:y,...q},!s))return N}}return T(!0),N};const hd={mode:ht.onSubmit,reValidateMode:ht.onChange,shouldFocusError:!0};function pd(e={}){let t={...hd,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:pt(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1};const s={};let n=De(t.defaultValues)||De(t.values)?qe(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:qe(n),i={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...u};const p={array:ya(),state:ya()},h=t.criteriaMode===ht.all,v=j=>F=>{clearTimeout(d),d=setTimeout(j,F)},x=async j=>{if(!t.disabled&&(u.isValid||f.isValid||j)){const F=t.resolver?Je((await A()).errors):await $(s,!0);F!==r.isValid&&p.state.next({isValid:F})}},g=(j,F)=>{!t.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((j||Array.from(l.mount)).forEach(R=>{R&&(F?Ce(r.validatingFields,R,F):Ie(r.validatingFields,R))}),p.state.next({validatingFields:r.validatingFields,isValidating:!Je(r.validatingFields)}))},m=(j,F=[],R,X,Y=!0,Z=!0)=>{if(X&&R&&!t.disabled){if(i.action=!0,Z&&Array.isArray(re(s,j))){const ue=R(re(s,j),X.argA,X.argB);Y&&Ce(s,j,ue)}if(Z&&Array.isArray(re(r.errors,j))){const ue=R(re(r.errors,j),X.argA,X.argB);Y&&Ce(r.errors,j,ue),fd(r.errors,j)}if((u.touchedFields||f.touchedFields)&&Z&&Array.isArray(re(r.touchedFields,j))){const ue=R(re(r.touchedFields,j),X.argA,X.argB);Y&&Ce(r.touchedFields,j,ue)}(u.dirtyFields||f.dirtyFields)&&(r.dirtyFields=jr(n,a)),p.state.next({name:j,isDirty:z(j,F),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Ce(a,j,F)},w=(j,F)=>{Ce(r.errors,j,F),p.state.next({errors:r.errors})},y=j=>{r.errors=j,p.state.next({errors:r.errors,isValid:!1})},T=(j,F,R,X)=>{const Y=re(s,j);if(Y){const Z=re(a,j,Re(R)?re(n,j):R);Re(Z)||X&&X.defaultChecked||F?Ce(a,j,F?Z:Na(Y._f)):P(j,Z),i.mount&&x()}},N=(j,F,R,X,Y)=>{let Z=!1,ue=!1;const xe={name:j};if(!t.disabled){if(!R||X){(u.isDirty||f.isDirty)&&(ue=r.isDirty,r.isDirty=xe.isDirty=z(),Z=ue!==xe.isDirty);const je=It(re(n,j),F);ue=!!re(r.dirtyFields,j),je?Ie(r.dirtyFields,j):Ce(r.dirtyFields,j,!0),xe.dirtyFields=r.dirtyFields,Z=Z||(u.dirtyFields||f.dirtyFields)&&ue!==!je}if(R){const je=re(r.touchedFields,j);je||(Ce(r.touchedFields,j,R),xe.touchedFields=r.touchedFields,Z=Z||(u.touchedFields||f.touchedFields)&&je!==R)}Z&&Y&&p.state.next(xe)}return Z?xe:{}},_=(j,F,R,X)=>{const Y=re(r.errors,j),Z=(u.isValid||f.isValid)&&lt(F)&&r.isValid!==F;if(t.delayError&&R?(c=v(()=>w(j,R)),c(t.delayError)):(clearTimeout(d),c=null,R?Ce(r.errors,j,R):Ie(r.errors,j)),(R?!It(Y,R):Y)||!Je(X)||Z){const ue={...X,...Z&&lt(F)?{isValid:F}:{},errors:r.errors,name:j};r={...r,...ue},p.state.next(ue)}},A=async j=>{g(j,!0);const F=await t.resolver(a,t.context,od(j||l.mount,s,t.criteriaMode,t.shouldUseNativeValidation));return g(j),F},S=async j=>{const{errors:F}=await A(j);if(j)for(const R of j){const X=re(F,R);X?Ce(r.errors,R,X):Ie(r.errors,R)}else r.errors=F;return F},$=async(j,F,R={valid:!0})=>{for(const X in j){const Y=j[X];if(Y){const{_f:Z,...ue}=Y;if(Z){const xe=l.array.has(Z.name),je=Y._f&&id(Y._f);je&&u.validatingFields&&g([X],!0);const Fe=await _a(Y,l.disabled,a,h,t.shouldUseNativeValidation&&!F,xe);if(je&&u.validatingFields&&g([X]),Fe[Z.name]&&(R.valid=!1,F))break;!F&&(re(Fe,Z.name)?xe?md(r.errors,Fe,Z.name):Ce(r.errors,Z.name,Fe[Z.name]):Ie(r.errors,Z.name))}!Je(ue)&&await $(ue,F,R)}}return R.valid},V=()=>{for(const j of l.unMount){const F=re(s,j);F&&(F._f.refs?F._f.refs.every(R=>!Js(R)):!Js(F._f.ref))&&W(j)}l.unMount=new Set},z=(j,F)=>!t.disabled&&(j&&F&&Ce(a,j,F),!It(C(),n)),q=(j,F,R)=>ti(j,l,{...i.mount?a:Re(F)?n:Nt(j)?{[j]:F}:F},R,F),D=j=>Ds(re(i.mount?a:n,j,t.shouldUnregister?re(n,j,[]):[])),P=(j,F,R={})=>{const X=re(s,j);let Y=F;if(X){const Z=X._f;Z&&(!Z.disabled&&Ce(a,j,li(F,Z)),Y=xs(Z.ref)&&Ze(F)?"":F,ni(Z.ref)?[...Z.ref.options].forEach(ue=>ue.selected=Y.includes(ue.value)):Z.refs?Lr(Z.ref)?Z.refs.forEach(ue=>{(!ue.defaultChecked||!ue.disabled)&&(Array.isArray(Y)?ue.checked=!!Y.find(xe=>xe===ue.value):ue.checked=Y===ue.value||!!Y)}):Z.refs.forEach(ue=>ue.checked=ue.value===Y):Gn(Z.ref)?Z.ref.value="":(Z.ref.value=Y,Z.ref.type||p.state.next({name:j,values:qe(a)})))}(R.shouldDirty||R.shouldTouch)&&N(j,Y,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&le(j)},E=(j,F,R)=>{for(const X in F){if(!F.hasOwnProperty(X))return;const Y=F[X],Z=`${j}.${X}`,ue=re(s,Z);(l.array.has(j)||De(Y)||ue&&!ue._f)&&!Zt(Y)?E(Z,Y,R):P(Z,Y,R)}},te=(j,F,R={})=>{const X=re(s,j),Y=l.array.has(j),Z=qe(F);Ce(a,j,Z),Y?(p.array.next({name:j,values:qe(a)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&R.shouldDirty&&p.state.next({name:j,dirtyFields:jr(n,a),isDirty:z(j,Z)})):X&&!X._f&&!Ze(Z)?E(j,Z,R):P(j,Z,R),Ca(j,l)&&p.state.next({...r}),p.state.next({name:i.mount?j:void 0,values:qe(a)})},ne=async j=>{i.mount=!0;const F=j.target;let R=F.name,X=!0;const Y=re(s,R),Z=je=>{X=Number.isNaN(je)||Zt(je)&&isNaN(je.getTime())||It(je,re(a,R,je))},ue=Sa(t.mode),xe=Sa(t.reValidateMode);if(Y){let je,Fe;const vt=F.type?Na(Y._f):Yo(j),Me=j.type===gs.BLUR||j.type===gs.FOCUS_OUT,Vt=!ld(Y._f)&&!t.resolver&&!re(r.errors,R)&&!Y._f.deps||ud(Me,re(r.touchedFields,R),r.isSubmitted,xe,ue),Ft=Ca(R,l,Me);Ce(a,R,vt),Me?(Y._f.onBlur&&Y._f.onBlur(j),c&&c(0)):Y._f.onChange&&Y._f.onChange(j);const Ot=N(R,vt,Me),Rt=!Je(Ot)||Ft;if(!Me&&p.state.next({name:R,type:j.type,values:qe(a)}),Vt)return(u.isValid||f.isValid)&&(t.mode==="onBlur"?Me&&x():Me||x()),Rt&&p.state.next({name:R,...Ft?{}:Ot});if(!Me&&Ft&&p.state.next({...r}),t.resolver){const{errors:Dt}=await A([R]);if(Z(vt),X){const rr=Aa(r.errors,s,R),Mt=Aa(Dt,s,rr.name||R);je=Mt.error,R=Mt.name,Fe=Je(Dt)}}else g([R],!0),je=(await _a(Y,l.disabled,a,h,t.shouldUseNativeValidation))[R],g([R]),Z(vt),X&&(je?Fe=!1:(u.isValid||f.isValid)&&(Fe=await $(s,!0)));X&&(Y._f.deps&&le(Y._f.deps),_(R,Fe,je,Ot))}},K=(j,F)=>{if(re(r.errors,F)&&j.focus)return j.focus(),1},le=async(j,F={})=>{let R,X;const Y=Er(j);if(t.resolver){const Z=await S(Re(j)?j:Y);R=Je(Z),X=j?!Y.some(ue=>re(Z,ue)):R}else j?(X=(await Promise.all(Y.map(async Z=>{const ue=re(s,Z);return await $(ue&&ue._f?{[Z]:ue}:ue)}))).every(Boolean),!(!X&&!r.isValid)&&x()):X=R=await $(s);return p.state.next({...!Nt(j)||(u.isValid||f.isValid)&&R!==r.isValid?{}:{name:j},...t.resolver||!j?{isValid:R}:{},errors:r.errors}),F.shouldFocus&&!X&&Cr(s,K,j?Y:l.mount),X},C=j=>{const F={...i.mount?a:n};return Re(j)?F:Nt(j)?re(F,j):j.map(R=>re(F,R))},k=(j,F)=>({invalid:!!re((F||r).errors,j),isDirty:!!re((F||r).dirtyFields,j),error:re((F||r).errors,j),isValidating:!!re(r.validatingFields,j),isTouched:!!re((F||r).touchedFields,j)}),I=j=>{j&&Er(j).forEach(F=>Ie(r.errors,F)),p.state.next({errors:j?r.errors:{}})},U=(j,F,R)=>{const X=(re(s,j,{_f:{}})._f||{}).ref,Y=re(r.errors,j)||{},{ref:Z,message:ue,type:xe,...je}=Y;Ce(r.errors,j,{...je,...F,ref:X}),p.state.next({name:j,errors:r.errors,isValid:!1}),R&&R.shouldFocus&&X&&X.focus&&X.focus()},G=(j,F)=>pt(j)?p.state.subscribe({next:R=>j(q(void 0,F),R)}):q(j,F,!0),ee=j=>p.state.subscribe({next:F=>{dd(j.name,F.name,j.exact)&&cd(F,j.formState||u,ce,j.reRenderRoot)&&j.callback({values:{...a},...r,...F})}}).unsubscribe,M=j=>(i.mount=!0,f={...f,...j.formState},ee({...j,formState:f})),W=(j,F={})=>{for(const R of j?Er(j):l.mount)l.mount.delete(R),l.array.delete(R),F.keepValue||(Ie(s,R),Ie(a,R)),!F.keepError&&Ie(r.errors,R),!F.keepDirty&&Ie(r.dirtyFields,R),!F.keepTouched&&Ie(r.touchedFields,R),!F.keepIsValidating&&Ie(r.validatingFields,R),!t.shouldUnregister&&!F.keepDefaultValue&&Ie(n,R);p.state.next({values:qe(a)}),p.state.next({...r,...F.keepDirty?{isDirty:z()}:{}}),!F.keepIsValid&&x()},me=({disabled:j,name:F})=>{(lt(j)&&i.mount||j||l.disabled.has(F))&&(j?l.disabled.add(F):l.disabled.delete(F))},be=(j,F={})=>{let R=re(s,j);const X=lt(F.disabled)||lt(t.disabled);return Ce(s,j,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:j}},name:j,mount:!0,...F}}),l.mount.add(j),R?me({disabled:lt(F.disabled)?F.disabled:t.disabled,name:j}):T(j,!0,F.value),{...X?{disabled:F.disabled||t.disabled}:{},...t.progressive?{required:!!F.required,min:kr(F.min),max:kr(F.max),minLength:kr(F.minLength),maxLength:kr(F.maxLength),pattern:kr(F.pattern)}:{},name:j,onChange:ne,onBlur:ne,ref:Y=>{if(Y){be(j,F),R=re(s,j);const Z=Re(Y.value)&&Y.querySelectorAll&&Y.querySelectorAll("input,select,textarea")[0]||Y,ue=sd(Z),xe=R._f.refs||[];if(ue?xe.find(je=>je===Z):Z===R._f.ref)return;Ce(s,j,{_f:{...R._f,...ue?{refs:[...xe.filter(Js),Z,...Array.isArray(re(n,j))?[{}]:[]],ref:{type:Z.type,name:j}}:{ref:Z}}}),T(j,!1,void 0,Z)}else R=re(s,j,{}),R._f&&(R._f.mount=!1),(t.shouldUnregister||F.shouldUnregister)&&!(Ho(l.array,j)&&i.action)&&l.unMount.add(j)}}},de=()=>t.shouldFocusError&&Cr(s,K,l.mount),ke=j=>{lt(j)&&(p.state.next({disabled:j}),Cr(s,(F,R)=>{const X=re(s,R);X&&(F.disabled=X._f.disabled||j,Array.isArray(X._f.refs)&&X._f.refs.forEach(Y=>{Y.disabled=X._f.disabled||j}))},0,!1))},ge=(j,F)=>async R=>{let X;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let Y=qe(a);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:Z,values:ue}=await A();r.errors=Z,Y=ue}else await $(s);if(l.disabled.size)for(const Z of l.disabled)Ce(Y,Z,void 0);if(Ie(r.errors,"root"),Je(r.errors)){p.state.next({errors:{}});try{await j(Y,R)}catch(Z){X=Z}}else F&&await F({...r.errors},R),de(),setTimeout(de);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Je(r.errors)&&!X,submitCount:r.submitCount+1,errors:r.errors}),X)throw X},he=(j,F={})=>{re(s,j)&&(Re(F.defaultValue)?te(j,qe(re(n,j))):(te(j,F.defaultValue),Ce(n,j,qe(F.defaultValue))),F.keepTouched||Ie(r.touchedFields,j),F.keepDirty||(Ie(r.dirtyFields,j),r.isDirty=F.defaultValue?z(j,qe(re(n,j))):z()),F.keepError||(Ie(r.errors,j),u.isValid&&x()),p.state.next({...r}))},fe=(j,F={})=>{const R=j?qe(j):n,X=qe(R),Y=Je(j),Z=Y?n:X;if(F.keepDefaultValues||(n=R),!F.keepValues){if(F.keepDirtyValues){const ue=new Set([...l.mount,...Object.keys(jr(n,a))]);for(const xe of Array.from(ue))re(r.dirtyFields,xe)?Ce(Z,xe,re(a,xe)):te(xe,re(Z,xe))}else{if(Un&&Re(j))for(const ue of l.mount){const xe=re(s,ue);if(xe&&xe._f){const je=Array.isArray(xe._f.refs)?xe._f.refs[0]:xe._f.ref;if(xs(je)){const Fe=je.closest("form");if(Fe){Fe.reset();break}}}}for(const ue of l.mount)te(ue,re(Z,ue))}a=qe(Z),p.array.next({values:{...Z}}),p.state.next({values:{...Z}})}l={mount:F.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!u.isValid||!!F.keepIsValid||!!F.keepDirtyValues,i.watch=!!t.shouldUnregister,p.state.next({submitCount:F.keepSubmitCount?r.submitCount:0,isDirty:Y?!1:F.keepDirty?r.isDirty:!!(F.keepDefaultValues&&!It(j,n)),isSubmitted:F.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:Y?{}:F.keepDirtyValues?F.keepDefaultValues&&a?jr(n,a):r.dirtyFields:F.keepDefaultValues&&j?jr(n,j):F.keepDirty?r.dirtyFields:{},touchedFields:F.keepTouched?r.touchedFields:{},errors:F.keepErrors?r.errors:{},isSubmitSuccessful:F.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},pe=(j,F)=>fe(pt(j)?j(a):j,F),ye=(j,F={})=>{const R=re(s,j),X=R&&R._f;if(X){const Y=X.refs?X.refs[0]:X.ref;Y.focus&&(Y.focus(),F.shouldSelect&&pt(Y.select)&&Y.select())}},ce=j=>{r={...r,...j}},Te={control:{register:be,unregister:W,getFieldState:k,handleSubmit:ge,setError:U,_subscribe:ee,_runSchema:A,_getWatch:q,_getDirty:z,_setValid:x,_setFieldArray:m,_setDisabledField:me,_setErrors:y,_getFieldArray:D,_reset:fe,_resetDefaultValues:()=>pt(t.defaultValues)&&t.defaultValues().then(j=>{pe(j,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:V,_disableForm:ke,_subjects:p,_proxyFormState:u,get _fields(){return s},get _formValues(){return a},get _state(){return i},set _state(j){i=j},get _defaultValues(){return n},get _names(){return l},set _names(j){l=j},get _formState(){return r},get _options(){return t},set _options(j){t={...t,...j}}},subscribe:M,trigger:le,register:be,handleSubmit:ge,watch:G,setValue:te,getValues:C,reset:pe,resetField:he,clearErrors:I,unregister:W,setError:U,setFocus:ye,getFieldState:k};return{...Te,formControl:Te}}function bd(e={}){const t=b.useRef(void 0),r=b.useRef(void 0),[s,n]=b.useState({isDirty:!1,isValidating:!1,isLoading:pt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:pt(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:pd(e),formState:s},e.formControl&&e.defaultValues&&!pt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const a=t.current.control;return a._options=e,Wn(()=>{const i=a._subscribe({formState:a._proxyFormState,callback:()=>n({...a._formState}),reRenderRoot:!0});return n(l=>({...l,isReady:!0})),a._formState.isReady=!0,i},[a]),b.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),b.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode),e.errors&&!Je(e.errors)&&a._setErrors(e.errors)},[a,e.errors,e.mode,e.reValidateMode]),b.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),b.useEffect(()=>{if(a._proxyFormState.isDirty){const i=a._getDirty();i!==s.isDirty&&a._subjects.state.next({isDirty:i})}},[a,s.isDirty]),b.useEffect(()=>{e.values&&!It(e.values,r.current)?(a._reset(e.values,a._options.resetOptions),r.current=e.values,n(i=>({...i}))):a._resetDefaultValues()},[a,e.values]),b.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=ei(s,a),t.current}const di={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},gd={sm:"h-6",md:"h-10",lg:"h-12"},xd={sm:"px-2",md:"px-2.5",lg:"px-3"};function Fa(e,t,r,s,n,a,i){const l=t?"datetime-local":"date",c=se("box-border w-full rounded-lg border outline-none transition font-[var(--font-primary)]",di[r],gd[r],xd[r],a?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]"),f=Xc(c,n?"bg-[var(--color-ds-background-disabled)] border-[var(--color-ds-border-muted)] text-[var(--color-ds-text-disabled)] cursor-not-allowed opacity-60":"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",i);return o.jsxs(o.Fragment,{children:[o.jsx("input",{id:e,type:l,disabled:n,"aria-disabled":n,"data-disabled":n?"true":"false",...s,className:f}),o.jsx("div",{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 Fr(e){const{control:t,name:r,rules:s,defaultValue:n,showTime:a=!1,size:i="sm",width:l="100%",label:c,labelHidden:d=!1,hasError:u=!1,errorMessage:f="",disabled:p=!1,className:h,onChange:v}=e,x=b.useId(),g=r||x;return o.jsxs("div",{className:se("flex flex-col",h),style:{width:l,maxWidth:"100%"},children:[c&&o.jsx("label",{htmlFor:g,className:se("pb-2 text-[var(--color-ds-text-primary)]",di[i],d&&"sr-only"),children:c}),t&&r?o.jsx(gt,{name:r,control:t,rules:s,defaultValue:n,render:({field:m,fieldState:w})=>Fa(g,a,i,{value:m.value,onChange:m.onChange,onBlur:m.onBlur},p,w.error,h)}):Fa(g,a,i,{defaultValue:n,onChange:v},p,u?{message:f}:void 0,h)]})}const vd=({trigger:e,items:t,align:r="left",className:s})=>{const[n,a]=b.useState(!1),i=b.useRef(null),l=b.useRef([]);b.useEffect(()=>{const d=u=>{i.current&&!i.current.contains(u.target)&&a(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[]);const c=d=>{var f,p;const u=l.current.findIndex(h=>h===document.activeElement);if(d.key==="Escape")a(!1);else if(d.key==="ArrowDown"){d.preventDefault();const h=(u+1)%t.length;(f=l.current[h])==null||f.focus()}else if(d.key==="ArrowUp"){d.preventDefault();const h=(u-1+t.length)%t.length;(p=l.current[h])==null||p.focus()}};return o.jsxs("div",{className:se("relative inline-block",s),ref:i,children:[o.jsx("button",{type:"button",onClick:()=>a(d=>!d),className:"inline-flex items-center focus:outline-none","aria-haspopup":"menu","aria-expanded":n,children:e}),n&&o.jsx("div",{role:"menu","aria-orientation":"vertical",className:se("absolute mt-2 min-w-[160px] bg-[var(--color-ds-background-page)]","border border-[var(--color-ds-border-muted)] rounded shadow-lg z-10",r==="right"?"right-0":"left-0"),onKeyDown:c,children:t.map((d,u)=>{const{label:f,onSelect:p,disabled:h,icon:v}=d;return o.jsxs("button",{role:"menuitem",type:"button",disabled:h,ref:x=>{l.current[u]=x},className:se("w-full flex items-center px-4 py-2 text-[var(--color-ds-text-primary)] text-ds-md transition-colors",h?"opacity-50 cursor-not-allowed":"hover:bg-[var(--color-ds-background-surface)]"),onClick:()=>{h||(p(),a(!1))},children:[v&&o.jsx(v,{className:"w-5 h-5 mr-2 text-[var(--color-ds-text-secondary)]"}),f]},u)})})]})},yd=(e,t,r,s)=>{var a,i,l,c;const n=[r,{code:t,...s||{}}];if((i=(a=e==null?void 0:e.services)==null?void 0:a.logger)!=null&&i.forward)return e.services.logger.forward(n,"warn","react-i18next::",!0);Yt(n[0])&&(n[0]=`react-i18next:: ${n[0]}`),(c=(l=e==null?void 0:e.services)==null?void 0:l.logger)!=null&&c.warn?e.services.logger.warn(...n):console!=null&&console.warn&&console.warn(...n)},Oa={},jn=(e,t,r,s)=>{Yt(r)&&Oa[r]||(Yt(r)&&(Oa[r]=new Date),yd(e,t,r,s))},ui=(e,t)=>()=>{if(e.isInitialized)t();else{const r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}},kn=(e,t,r)=>{e.loadNamespaces(t,ui(e,r))},Ra=(e,t,r,s)=>{if(Yt(r)&&(r=[r]),e.options.preload&&e.options.preload.indexOf(t)>-1)return kn(e,r,s);r.forEach(n=>{e.options.ns.indexOf(n)<0&&e.options.ns.push(n)}),e.loadLanguages(t,ui(e,s))},wd=(e,t,r={})=>!t.languages||!t.languages.length?(jn(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:r.lng,precheck:(s,n)=>{var a;if(((a=r.bindI18n)==null?void 0:a.indexOf("languageChanging"))>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!n(s.isLanguageChangingTo,e))return!1}}),Yt=e=>typeof e=="string",jd=e=>typeof e=="object"&&e!==null,kd=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Nd={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Sd=e=>Nd[e],Ed=e=>e.replace(kd,Sd);let Cd={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Ed};const Ad=()=>Cd;let Td;const _d=()=>Td,Fd=b.createContext();class Od{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Rd=(e,t)=>{const r=b.useRef();return b.useEffect(()=>{r.current=e},[e,t]),r.current},fi=(e,t,r,s)=>e.getFixedT(t,r,s),Dd=(e,t,r,s)=>b.useCallback(fi(e,t,r,s),[e,t,r,s]),Zn=(e,t={})=>{var T,N,_,A;const{i18n:r}=t,{i18n:s,defaultNS:n}=b.useContext(Fd)||{},a=r||s||_d();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new Od),!a){jn(a,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const S=(V,z)=>Yt(z)?z:jd(z)&&Yt(z.defaultValue)?z.defaultValue:Array.isArray(V)?V[V.length-1]:V,$=[S,{},!1];return $.t=S,$.i18n={},$.ready=!1,$}(T=a.options.react)!=null&&T.wait&&jn(a,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const i={...Ad(),...a.options.react,...t},{useSuspense:l,keyPrefix:c}=i;let d=n||((N=a.options)==null?void 0:N.defaultNS);d=Yt(d)?[d]:d||["translation"],(A=(_=a.reportNamespaces).addUsedNamespaces)==null||A.call(_,d);const u=(a.isInitialized||a.initializedStoreOnce)&&d.every(S=>wd(S,a,i)),f=Dd(a,t.lng||null,i.nsMode==="fallback"?d:d[0],c),p=()=>f,h=()=>fi(a,t.lng||null,i.nsMode==="fallback"?d:d[0],c),[v,x]=b.useState(p);let g=d.join();t.lng&&(g=`${t.lng}${g}`);const m=Rd(g),w=b.useRef(!0);b.useEffect(()=>{const{bindI18n:S,bindI18nStore:$}=i;w.current=!0,!u&&!l&&(t.lng?Ra(a,t.lng,d,()=>{w.current&&x(h)}):kn(a,d,()=>{w.current&&x(h)})),u&&m&&m!==g&&w.current&&x(h);const V=()=>{w.current&&x(h)};return S&&(a==null||a.on(S,V)),$&&(a==null||a.store.on($,V)),()=>{w.current=!1,a&&(S==null||S.split(" ").forEach(z=>a.off(z,V))),$&&a&&$.split(" ").forEach(z=>a.store.off(z,V))}},[a,g]),b.useEffect(()=>{w.current&&u&&x(p)},[a,c,u]);const y=[v,a,u];if(y.t=v,y.i18n=a,y.ready=u,u||!u&&!l)return y;throw new Promise(S=>{t.lng?Ra(a,t.lng,d,()=>S()):kn(a,d,()=>S())})},Nn={sm:"text-sm",md:"text-base",lg:"text-lg"};function Da(e,t,r,s,n,a,i,l,c){const{t:d}=Zn(),u=b.useRef(null),f=typeof s=="number"&&t.length>=s,p=()=>{var w;!i&&!f&&((w=u.current)==null||w.click())},h=w=>{const y=w.target.files;if(!y)return;const T=Array.from(y);let N=t.concat(T);s&&(N=N.slice(0,s)),r(N),w.target.value=""},v=w=>{if(w.preventDefault(),i||f)return;const y=Array.from(w.dataTransfer.files);let T=t.concat(y);s&&(T=T.slice(0,s)),r(T)},x=w=>{w.preventDefault()},g=w=>{const y=URL.createObjectURL(w);window.open(y)},m=w=>{const y=t.filter((T,N)=>N!==w);r(y)};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"self-start mb-4 w-auto",children:o.jsx(ie,{type:"button",variant:"outline",size:a,icon:pa,onClick:p,disabled:i||f,children:d("ds.fileUploader.browse","Browse files")})}),!f&&o.jsxs("div",{className:se("relative flex bg-[var(--color-ds-background-page)] flex-col items-center justify-center border-2 border-dashed border-[var(--color-ds-border-muted)] rounded-lg p-4",i?"opacity-50 cursor-not-allowed":"hover:border-[var(--color-ds-border-default)]",Nn[a],c),onDrop:v,onDragOver:x,children:[o.jsx("input",{id:e,type:"file",ref:u,className:"hidden",multiple:s!==1,accept:n,onChange:h,disabled:i}),o.jsx(kt,{component:Ql,size:"md",className:"w-8 h-8 text-[var(--color-ds-text-secondary)]"}),o.jsx("p",{className:"mt-3 text-[var(--color-ds-text-secondary)] text-center",children:d("ds.fileUploader.dragDrop","Drag & drop your files here or click to browse")})]}),t.length>0&&o.jsx("ul",{className:"mt-4 space-y-1",children:t.map((w,y)=>o.jsxs("li",{className:"flex items-center justify-between text-[var(--color-ds-text-secondary)] text-sm",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx(pa,{className:"w-4 h-4 mr-2","aria-hidden":"true"}),o.jsx("span",{className:"truncate pr-2",children:w.name})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ie,{variant:"ghost",size:"sm",icon:Lo,ariaLabel:d("ds.fileUploader.view","View"),onClick:()=>g(w)}),o.jsx(ie,{variant:"ghost",size:"sm",icon:Vn,ariaLabel:d("ds.fileUploader.remove","Remove"),onClick:()=>m(y)})]})]},y))}),o.jsx("div",{className:"pt-[5px] min-h-[18px] w-full",children:l!=null&&l.message?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:l.message}):o.jsx("span",{"aria-hidden":"true",children:" "})})]})}function mi(e){const{control:t,name:r,rules:s,defaultValue:n,maxFiles:a,accept:i,size:l="sm",width:c="100%",label:d,labelHidden:u=!1,disabled:f=!1,hasError:p=!1,errorMessage:h="",className:v}=e,x=b.useId(),g=r||x;if(t&&r)return o.jsxs("div",{className:se("flex flex-col",v),style:{width:c},children:[d&&o.jsx("label",{htmlFor:g,className:se("pb-[10px] text-[var(--color-ds-text-primary)]",Nn[l],u&&"sr-only"),children:d}),o.jsx(gt,{name:r,control:t,rules:s,defaultValue:n instanceof FileList?Array.from(n):n||[],render:({field:y,fieldState:T})=>Da(g,y.value,N=>y.onChange(N),a,i,l,f,T.error,v)})]});const[m,w]=b.useState(n instanceof FileList?Array.from(n):n||[]);return o.jsxs("div",{className:se("flex flex-col",v),style:{width:c},children:[d&&o.jsx("label",{htmlFor:g,className:se("pb-[10px] text-[var(--color-ds-text-primary)]",Nn[l],u&&"sr-only"),children:d}),Da(g,m,w,a,i,l,f,p?{message:h}:void 0,v)]})}const Xt=({count:e=1,width:t,height:r="1em",variant:s="rect",className:n})=>{const a=Array.from({length:e});return o.jsx(o.Fragment,{children:a.map((i,l)=>o.jsx("span",{role:"status","aria-label":"Cargando...",className:se("bg-[var(--color-ds-border-muted)] animate-pulse inline-block",s==="circle"?"rounded-full":"rounded",n),style:{width:t??"auto",height:r}},l))})},Qr={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},Md={sm:"h-6",md:"h-10",lg:"h-12"},$d={sm:"px-2",md:"px-2.5",lg:"px-3"},Ma={sm:"pl-2",md:"pl-2.5",lg:"pl-3"},Ld={sm:"1.5rem",md:"2.5rem",lg:"3rem"};function we({id:e,type:t="text",size:r="sm",width:s="100%",label:n,labelHidden:a=!1,hasError:i=!1,errorMessage:l="",prefixIcon:c,suffixIcon:d,separator:u,suffixButton:f,disabled:p=!1,control:h,name:v,rules:x,defaultValue:g,reserveErrorSpace:m,disableErrorPlaceholder:w,loading:y=!1,className:T,...N}){const _=b.useId(),[A,S]=b.useState(!1),$=e||_,V=t==="password",q=c??(t==="number"?ic:void 0),D=V?A?nc:Lo:d,P=typeof m=="boolean"?m:typeof w=="boolean"?!w:!!h,E=se("box-border w-full rounded-lg border placeholder-[var(--color-ds-text-secondary)] outline-none transition font-[var(--font-primary)] appearance-none",Qr[r],Md[r],$d[r],i?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]","bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]","disabled:bg-[var(--color-ds-background-disabled)]","disabled:border-[var(--color-ds-border-muted)]","disabled:text-[var(--color-ds-text-disabled)]","disabled:cursor-not-allowed");return y?o.jsxs("div",{className:"flex flex-col",style:{width:s,maxWidth:"100%"},children:[!a&&n&&o.jsx("label",{htmlFor:$,className:se("pb-2",Qr[r]),children:n}),o.jsx(Xt,{width:"100%",height:Ld[r],variant:"rect",className:"rounded-lg"}),o.jsx("div",{className:"min-h-[18px] w-full",children:o.jsx("span",{"aria-hidden":"true",children:" "})})]}):h&&v?o.jsx(gt,{name:v,control:h,rules:x,defaultValue:g,render:({field:te,fieldState:ne})=>o.jsxs("div",{className:"flex flex-col",style:{width:s},children:[!a&&n&&o.jsx("label",{htmlFor:$,className:se("pb-2 text-[var(--color-ds-text-primary)]",Qr[r]),children:n}),o.jsxs("div",{className:"relative flex items-center w-full",children:[q&&o.jsx("div",{className:se("absolute left-0 flex items-center h-full",Ma[r]),children:o.jsx(kt,{component:q,size:r,className:"text-[var(--color-ds-text-secondary)]"})}),o.jsx("input",{...te,id:$,type:V?A?"text":"password":t,disabled:p,"aria-invalid":!!ne.error,className:se(E,q&&"pl-9",D&&"pr-9",T),onInvalid:K=>K.preventDefault(),style:V&&!A?{WebkitTextSecurity:"disc",MozTextSecurity:"disc"}:void 0}),u&&o.jsx("div",{className:"flex items-center h-full",children:u}),f&&o.jsx("div",{className:"flex items-center h-full pr-2",children:f}),D&&o.jsx("button",{type:"button",onClick:()=>S(K=>!K),className:"absolute right-0 flex items-center h-full pr-2",tabIndex:-1,children:o.jsx(kt,{component:D,size:r,className:"text-[var(--color-ds-text-secondary)]"})})]}),P?o.jsx("div",{className:"min-h-[18px]",children:ne.error?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:ne.error.message}):o.jsx("span",{"aria-hidden":"true",children:" "})}):ne.error?o.jsx("div",{className:"pt-1",children:o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:ne.error.message})}):null]})}):o.jsxs("div",{className:"flex flex-col",style:{width:s},children:[!a&&n&&o.jsx("label",{htmlFor:$,className:se("pb-2 text-[var(--color-ds-text-primary)]",Qr[r]),children:n}),o.jsxs("div",{className:"relative flex items-center w-full",children:[q&&o.jsx("div",{className:se("absolute left-0 flex items-center h-full",Ma[r]),children:o.jsx(kt,{component:q,size:r,className:"text-[var(--color-ds-text-secondary)]"})}),o.jsx("input",{...N,id:$,type:V?A?"text":"password":t,disabled:p,"aria-invalid":i,className:se(E,q&&"pl-9",D&&"pr-9",T),onInvalid:te=>te.preventDefault(),style:V&&!A?{WebkitTextSecurity:"disc",MozTextSecurity:"disc"}:void 0}),u&&o.jsx("div",{className:"flex items-center h-full",children:u}),f&&o.jsx("div",{className:"flex items-center h-full",children:f}),D&&o.jsx("button",{type:"button",onClick:()=>S(te=>!te),className:"absolute right-0 flex items-center h-full pr-2",tabIndex:-1,children:o.jsx(kt,{component:D,size:r,className:"text-[var(--color-ds-text-secondary)]"})})]}),P?o.jsx("div",{className:"min-h-[18px]",children:i&&l?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:l}):o.jsx("span",{"aria-hidden":"true",children:" "})}):i&&l?o.jsx("div",{className:"pt-1",children:o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:l})}):null]})}const Pd={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},Zs=400,es=8,Yn=({children:e,size:t="sm",position:r="top",className:s,onClick:n,ariaLabel:a="Más información"})=>{const[i,l]=b.useState(!1),[c,d]=b.useState({x:0,y:0}),u=b.useRef(null),f=b.useId();b.useEffect(()=>{if(i&&u.current){const v=u.current.getBoundingClientRect();let x=0,g=0;switch(r){case"top":x=v.left+v.width/2-Zs/2,g=v.top-es;break;case"bottom":x=v.left+v.width/2-Zs/2,g=v.bottom+es;break;case"left":x=v.left-Zs-es,g=v.top+v.height/2;break;case"right":x=v.right+es,g=v.top+v.height/2;break}d({x,y:g})}},[i,r]);const p=()=>typeof e=="string"?o.jsx("div",{dangerouslySetInnerHTML:{__html:e}}):o.jsx(o.Fragment,{children:e}),h=i?o.jsx("div",{id:f,role:"tooltip",className:se("fixed z-50 w-[250px] bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)] text-ds-sm rounded p-2 shadow-lg","pointer-events-none"),style:{top:`${c.y}px`,left:`${c.x}px`,transform:r==="left"||r==="right"?"translateY(-50%)":r==="top"?"translateY(-100%)":void 0},children:p()}):null;return o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button","aria-describedby":f,ref:u,"aria-label":a,className:se("inline-flex items-center justify-center focus:outline-none",Pd[t],"text-[var(--color-ds-text-secondary)] hover:text-[var(--color-ds-text-primary)]",s),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onFocus:()=>l(!0),onBlur:()=>l(!1),onClick:n,children:o.jsx(Po,{className:"w-full h-full"})}),Jt.createPortal(h,document.body)]})};function zd({name:e,label:t,type:r="text",size:s="sm",width:n,placeholder:a,validation:i,loadingDefaults:l,disabled:c,info:d}){var g;const{control:u,formState:{errors:f}}=Pr(),p=!!f[e],h=((g=f[e])==null?void 0:g.message)||"",v="relative",x=n??"w-full";return o.jsxs("div",{className:v,children:[o.jsx(gt,{name:e,control:u,rules:i,render:({field:m})=>o.jsx(we,{label:t,size:s,width:x,placeholder:a,hasError:p,errorMessage:h,loading:l,type:r,...m,disabled:c,reserveErrorSpace:!0})}),d&&o.jsx(Yn,{size:s,position:"left",className:"absolute top-1/2 right-2 -translate-y-1/2",children:d})]})}const Hn=b.memo(zd);Hn.displayName="FormFieldInput";function Id({title:e,headerButtons:t,children:r,className:s}){return o.jsxs("div",{className:se("flex flex-col h-full",s),children:[o.jsxs("div",{className:"flex items-center justify-between py-4",children:[o.jsx("div",{className:`bg-[var(--color-ds-background-accent)] \r
23
23
  text-[var(--color-ds-text-on-accent)] \r
24
24
  rounded-tr-[20px] \r
25
25
  pl-4 pr-10\r
26
- text-ds-lg`,children:e}),t&&o.jsx("div",{className:"flex items-center space-x-2",children:t})]}),o.jsx("main",{className:"flex-1 overflow-auto",children:r})]})}const Ma=(e,t,r)=>{if(e&&"reportValidity"in e){const s=re(r,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},mi=(e,t)=>{for(const r in t.fields){const s=t.fields[r];s&&s.ref&&"reportValidity"in s.ref?Ma(s.ref,r,e):s&&s.refs&&s.refs.forEach(n=>Ma(n,r,e))}},Id=(e,t)=>{t.shouldUseNativeValidation&&mi(e,t);const r={};for(const s in e){const n=re(t.fields,s),a=Object.assign(e[s]||{},{ref:n&&n.ref});if(Vd(t.names||Object.keys(e),s)){const i=Object.assign({},re(r,s));Ce(i,"root",a),Ce(r,s,i)}else Ce(r,s,a)}return r},Vd=(e,t)=>{const r=$a(t);return e.some(s=>$a(s).match(`^${r}\\.\\d+`))};function $a(e){return e.replace(/\]|\[/g,"")}function hi(e,t,r){return r===void 0&&(r={}),function(s,n,a){try{return Promise.resolve(function(i,l){try{var c=(t!=null&&t.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(e[r.mode==="sync"?"validateSync":"validate"](s,Object.assign({abortEarly:!1},t,{context:n}))).then(function(d){return a.shouldUseNativeValidation&&mi({},a),{values:r.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:Id((l=i,c=!a.shouldUseNativeValidation&&a.criteriaMode==="all",(l.inner||[]).reduce(function(d,u){if(d[u.path]||(d[u.path]={message:u.message,type:u.type}),c){var f=d[u.path].types,h=f&&f[u.type];d[u.path]=ri(u.path,c,d,u.type,h?[].concat(h,u.message):u.message)}return d},{})),a)};var l,c}))}catch(i){return Promise.reject(i)}}}var Zs,La;function Bd(){if(La)return Zs;La=1;function e(m){this._maxSize=m,this.clear()}e.prototype.clear=function(){this._size=0,this._values=Object.create(null)},e.prototype.get=function(m){return this._values[m]},e.prototype.set=function(m,w){return this._size>=this._maxSize&&this.clear(),m in this._values||this._size++,this._values[m]=w};var t=/[^.^\]^[]+|(?=\[\]|\.\.)/g,r=/^\d+$/,s=/^\d/,n=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,a=/^\s*(['"]?)(.*?)(\1)\s*$/,i=512,l=new e(i),c=new e(i),d=new e(i);Zs={Cache:e,split:f,normalizePath:u,setter:function(m){var w=u(m);return c.get(m)||c.set(m,function(T,N){for(var _=0,A=w.length,S=T;_<A-1;){var $=w[_];if($==="__proto__"||$==="constructor"||$==="prototype")return T;S=S[w[_++]]}S[w[_]]=N})},getter:function(m,w){var y=u(m);return d.get(m)||d.set(m,function(N){for(var _=0,A=y.length;_<A;)if(N!=null||!w)N=N[y[_++]];else return;return N})},join:function(m){return m.reduce(function(w,y){return w+(p(y)||r.test(y)?"["+y+"]":(w?".":"")+y)},"")},forEach:function(m,w,y){h(Array.isArray(m)?m:f(m),w,y)}};function u(m){return l.get(m)||l.set(m,f(m).map(function(w){return w.replace(a,"$2")}))}function f(m){return m.match(t)||[""]}function h(m,w,y){var T=m.length,N,_,A,S;for(_=0;_<T;_++)N=m[_],N&&(x(N)&&(N='"'+N+'"'),S=p(N),A=!S&&/^\d+$/.test(N),w.call(y,N,S,A,_,m))}function p(m){return typeof m=="string"&&m&&["'",'"'].indexOf(m.charAt(0))!==-1}function v(m){return m.match(s)&&!m.match(r)}function g(m){return n.test(m)}function x(m){return!p(m)&&(v(m)||g(m))}return Zs}var Ht=Bd(),Ys,Pa;function Ud(){if(Pa)return Ys;Pa=1;const e=/[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,t=u=>u.match(e)||[],r=u=>u[0].toUpperCase()+u.slice(1),s=(u,f)=>t(u).join(f).toLowerCase(),n=u=>t(u).reduce((f,h)=>`${f}${f?h[0].toUpperCase()+h.slice(1).toLowerCase():h.toLowerCase()}`,"");return Ys={words:t,upperFirst:r,camelCase:n,pascalCase:u=>r(n(u)),snakeCase:u=>s(u,"_"),kebabCase:u=>s(u,"-"),sentenceCase:u=>r(s(u," ")),titleCase:u=>t(u).map(r).join(" ")},Ys}var Hs=Ud(),es={exports:{}},za;function qd(){if(za)return es.exports;za=1,es.exports=function(n){return e(t(n),n)},es.exports.array=e;function e(n,a){var i=n.length,l=new Array(i),c={},d=i,u=r(a),f=s(n);for(a.forEach(function(p){if(!f.has(p[0])||!f.has(p[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});d--;)c[d]||h(n[d],d,new Set);return l;function h(p,v,g){if(g.has(p)){var x;try{x=", node was:"+JSON.stringify(p)}catch{x=""}throw new Error("Cyclic dependency"+x)}if(!f.has(p))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(p));if(!c[v]){c[v]=!0;var m=u.get(p)||new Set;if(m=Array.from(m),v=m.length){g.add(p);do{var w=m[--v];h(w,f.get(w),g)}while(v);g.delete(p)}l[--i]=p}}}function t(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 r(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 es.exports}var Wd=qd();const Kd=Sl(Wd),Gd=Object.prototype.toString,Jd=Error.prototype.toString,Zd=RegExp.prototype.toString,Yd=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Hd=/^Symbol\((.*)\)(.*)$/;function Xd(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function Ia(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const r=typeof e;if(r==="number")return Xd(e);if(r==="string")return t?`"${e}"`:e;if(r==="function")return"[Function "+(e.name||"anonymous")+"]";if(r==="symbol")return Yd.call(e).replace(Hd,"Symbol($1)");const s=Gd.call(e).slice(8,-1);return s==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):s==="Error"||e instanceof Error?"["+Jd.call(e)+"]":s==="RegExp"?Zd.call(e):null}function Tt(e,t){let r=Ia(e,t);return r!==null?r:JSON.stringify(e,function(s,n){let a=Ia(this[s],t);return a!==null?a:n},2)}function pi(e){return e==null?[]:[].concat(e)}let bi,gi,xi,Qd=/\$\{\s*(\w+)\s*\}/g;bi=Symbol.toStringTag;class Va{constructor(t,r,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[bi]="Error",this.name="ValidationError",this.value=r,this.path=s,this.type=n,this.errors=[],this.inner=[],pi(t).forEach(a=>{if(tt.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]}}gi=Symbol.hasInstance;xi=Symbol.toStringTag;class tt extends Error{static formatError(t,r){const s=r.label||r.path||"this";return r=Object.assign({},r,{path:s,originalPath:r.path}),typeof t=="string"?t.replace(Qd,(n,a)=>Tt(r[a])):typeof t=="function"?t(r):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,r,s,n,a){const i=new Va(t,r,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[xi]="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,tt)}static[gi](t){return Va[Symbol.hasInstance](t)||super[Symbol.hasInstance](t)}}let jt={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:e,type:t,value:r,originalValue:s})=>{const n=s!=null&&s!==r?` (cast from the value \`${Tt(s,!0)}\`).`:".";return t!=="mixed"?`${e} must be a \`${t}\` type, but the final value was: \`${Tt(r,!0)}\``+n:`${e} must match the configured type. The validated value was: \`${Tt(r,!0)}\``+n}},et={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"},Pt={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"},Nn={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Sn={isValue:"${path} field must be ${value}"},fs={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},ms={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"},eu={notType:e=>{const{path:t,value:r,spec:s}=e,n=s.types.length;if(Array.isArray(r)){if(r.length<n)return`${t} tuple value has too few items, expected a length of ${n} but got ${r.length} for value: \`${Tt(r,!0)}\``;if(r.length>n)return`${t} tuple value has too many items, expected a length of ${n} but got ${r.length} for value: \`${Tt(r,!0)}\``}return tt.formatError(jt.notType,e)}};Object.assign(Object.create(null),{mixed:jt,string:et,number:Pt,date:Nn,object:fs,array:ms,boolean:Sn,tuple:eu});const Ds=e=>e&&e.__isYupSchema__;class ys{static fromOptions(t,r){if(!r.then&&!r.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:s,then:n,otherwise:a}=r,i=typeof s=="function"?s:(...l)=>l.every(c=>c===s);return new ys(t,(l,c)=>{var d;let u=i(...l)?n:a;return(d=u==null?void 0:u(c))!=null?d:c})}constructor(t,r){this.fn=void 0,this.refs=t,this.refs=t,this.fn=r}resolve(t,r){let s=this.refs.map(a=>a.getValue(r==null?void 0:r.value,r==null?void 0:r.parent,r==null?void 0:r.context)),n=this.fn(s,t,r);if(n===void 0||n===t)return t;if(!Ds(n))throw new TypeError("conditions must return a schema object");return n.resolve(r)}}const ts={context:"$",value:"."};class tr{constructor(t,r={}){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 t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===ts.context,this.isValue=this.key[0]===ts.value,this.isSibling=!this.isContext&&!this.isValue;let s=this.isContext?ts.context:this.isValue?ts.value:"";this.path=this.key.slice(s.length),this.getter=this.path&&Ht.getter(this.path,!0),this.map=r.map}getValue(t,r,s){let n=this.isContext?s:this.isValue?t:r;return this.getter&&(n=this.getter(n||{})),this.map&&(n=this.map(n)),n}cast(t,r){return this.getValue(t,r==null?void 0:r.parent,r==null?void 0:r.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}tr.prototype.__isYupRef=!0;const bt=e=>e==null;function or(e){function t({value:r,path:s="",options:n,originalValue:a,schema:i},l,c){const{name:d,test:u,params:f,message:h,skipAbsent:p}=e;let{parent:v,context:g,abortEarly:x=i.spec.abortEarly,disableStackTrace:m=i.spec.disableStackTrace}=n;function w(z){return tr.isRef(z)?z.getValue(r,v,g):z}function y(z={}){const q=Object.assign({value:r,originalValue:a,label:i.spec.label,path:z.path||s,spec:i.spec,disableStackTrace:z.disableStackTrace||m},f,z.params);for(const P of Object.keys(q))q[P]=w(q[P]);const D=new tt(tt.formatError(z.message||h,q),r,q.path,z.type||d,q.disableStackTrace);return D.params=q,D}const T=x?l:c;let N={path:s,parent:v,type:d,from:n.from,createError:y,resolve:w,options:n,originalValue:a,schema:i};const _=z=>{tt.isError(z)?T(z):z?c(null):T(y())},A=z=>{tt.isError(z)?T(z):l(z)};if(p&&bt(r))return _(!0);let $;try{var V;if($=u.call(N,r,N),typeof((V=$)==null?void 0:V.then)=="function"){if(n.sync)throw new Error(`Validation test of type: "${N.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve($).then(_,A)}}catch(z){A(z);return}_($)}return t.OPTIONS=e,t}function tu(e,t,r,s=r){let n,a,i;return t?(Ht.forEach(t,(l,c,d)=>{let u=c?l.slice(1,l.length-1):l;e=e.resolve({context:s,parent:n,value:r});let f=e.type==="tuple",h=d?parseInt(u,10):0;if(e.innerType||f){if(f&&!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(r&&h>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${l}, in the path: ${t}. because there is no value at that index. `);n=r,r=r&&r[h],e=f?e.spec.types[h]:e.innerType}if(!d){if(!e.fields||!e.fields[u])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${i} which is a type: "${e.type}")`);n=r,r=r&&r[u],e=e.fields[u]}a=u,i=c?"["+l+"]":"."+l}),{schema:e,parent:n,parentPath:a}):{parent:n,parentPath:t,schema:e}}class ws extends Set{describe(){const t=[];for(const r of this.values())t.push(tr.isRef(r)?r.describe():r);return t}resolveAll(t){let r=[];for(const s of this.values())r.push(t(s));return r}clone(){return new ws(this.values())}merge(t,r){const s=this.clone();return t.forEach(n=>s.add(n)),r.forEach(n=>s.delete(n)),s}}function cr(e,t=new Map){if(Ds(e)||!e||typeof e!="object")return e;if(t.has(e))return t.get(e);let r;if(e instanceof Date)r=new Date(e.getTime()),t.set(e,r);else if(e instanceof RegExp)r=new RegExp(e),t.set(e,r);else if(Array.isArray(e)){r=new Array(e.length),t.set(e,r);for(let s=0;s<e.length;s++)r[s]=cr(e[s],t)}else if(e instanceof Map){r=new Map,t.set(e,r);for(const[s,n]of e.entries())r.set(s,cr(n,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const s of e)r.add(cr(s,t))}else if(e instanceof Object){r={},t.set(e,r);for(const[s,n]of Object.entries(e))r[s]=cr(n,t)}else throw Error(`Unable to clone ${e}`);return r}class nt{constructor(t){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 ws,this._blacklist=new ws,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(jt.notType)}),this.type=t.type,this._typeCheck=t.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},t==null?void 0:t.spec),this.withMutation(r=>{r.nonNullable()})}get _type(){return this.type}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const r=Object.create(Object.getPrototypeOf(this));return r.type=this.type,r._typeCheck=this._typeCheck,r._whitelist=this._whitelist.clone(),r._blacklist=this._blacklist.clone(),r.internalTests=Object.assign({},this.internalTests),r.exclusiveTests=Object.assign({},this.exclusiveTests),r.deps=[...this.deps],r.conditions=[...this.conditions],r.tests=[...this.tests],r.transforms=[...this.transforms],r.spec=cr(Object.assign({},this.spec,t)),r}label(t){let r=this.clone();return r.spec.label=t,r}meta(...t){if(t.length===0)return this.spec.meta;let r=this.clone();return r.spec.meta=Object.assign(r.spec.meta||{},t[0]),r}withMutation(t){let r=this._mutate;this._mutate=!0;let s=t(this);return this._mutate=r,s}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let r=this,s=t.clone();const n=Object.assign({},r.spec,s.spec);return s.spec=n,s.internalTests=Object.assign({},r.internalTests,s.internalTests),s._whitelist=r._whitelist.merge(t._whitelist,t._blacklist),s._blacklist=r._blacklist.merge(t._blacklist,t._whitelist),s.tests=r.tests,s.exclusiveTests=r.exclusiveTests,s.withMutation(a=>{t.tests.forEach(i=>{a.test(i.OPTIONS)})}),s.transforms=[...r.transforms,...s.transforms],s}isType(t){return t==null?!!(this.spec.nullable&&t===null||this.spec.optional&&t===void 0):this._typeCheck(t)}resolve(t){let r=this;if(r.conditions.length){let s=r.conditions;r=r.clone(),r.conditions=[],r=s.reduce((n,a)=>a.resolve(n,t),r),r=r.resolve(t)}return r}resolveOptions(t){var r,s,n,a;return Object.assign({},t,{from:t.from||[],strict:(r=t.strict)!=null?r:this.spec.strict,abortEarly:(s=t.abortEarly)!=null?s:this.spec.abortEarly,recursive:(n=t.recursive)!=null?n:this.spec.recursive,disableStackTrace:(a=t.disableStackTrace)!=null?a:this.spec.disableStackTrace})}cast(t,r={}){let s=this.resolve(Object.assign({value:t},r)),n=r.assert==="ignore-optionality",a=s._cast(t,r);if(r.assert!==!1&&!s.isType(a)){if(n&&bt(a))return a;let i=Tt(t),l=Tt(a);throw new TypeError(`The value of ${r.path||"field"} could not be cast to a value that satisfies the schema type: "${s.type}".
26
+ text-ds-lg`,children:e}),t&&o.jsx("div",{className:"flex items-center space-x-2",children:t})]}),o.jsx("main",{className:"flex-1 overflow-auto",children:r})]})}const $a=(e,t,r)=>{if(e&&"reportValidity"in e){const s=re(r,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},hi=(e,t)=>{for(const r in t.fields){const s=t.fields[r];s&&s.ref&&"reportValidity"in s.ref?$a(s.ref,r,e):s&&s.refs&&s.refs.forEach(n=>$a(n,r,e))}},Vd=(e,t)=>{t.shouldUseNativeValidation&&hi(e,t);const r={};for(const s in e){const n=re(t.fields,s),a=Object.assign(e[s]||{},{ref:n&&n.ref});if(Bd(t.names||Object.keys(e),s)){const i=Object.assign({},re(r,s));Ce(i,"root",a),Ce(r,s,i)}else Ce(r,s,a)}return r},Bd=(e,t)=>{const r=La(t);return e.some(s=>La(s).match(`^${r}\\.\\d+`))};function La(e){return e.replace(/\]|\[/g,"")}function pi(e,t,r){return r===void 0&&(r={}),function(s,n,a){try{return Promise.resolve(function(i,l){try{var c=(t!=null&&t.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(e[r.mode==="sync"?"validateSync":"validate"](s,Object.assign({abortEarly:!1},t,{context:n}))).then(function(d){return a.shouldUseNativeValidation&&hi({},a),{values:r.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:Vd((l=i,c=!a.shouldUseNativeValidation&&a.criteriaMode==="all",(l.inner||[]).reduce(function(d,u){if(d[u.path]||(d[u.path]={message:u.message,type:u.type}),c){var f=d[u.path].types,p=f&&f[u.type];d[u.path]=si(u.path,c,d,u.type,p?[].concat(p,u.message):u.message)}return d},{})),a)};var l,c}))}catch(i){return Promise.reject(i)}}}var Ys,Pa;function Ud(){if(Pa)return Ys;Pa=1;function e(m){this._maxSize=m,this.clear()}e.prototype.clear=function(){this._size=0,this._values=Object.create(null)},e.prototype.get=function(m){return this._values[m]},e.prototype.set=function(m,w){return this._size>=this._maxSize&&this.clear(),m in this._values||this._size++,this._values[m]=w};var t=/[^.^\]^[]+|(?=\[\]|\.\.)/g,r=/^\d+$/,s=/^\d/,n=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,a=/^\s*(['"]?)(.*?)(\1)\s*$/,i=512,l=new e(i),c=new e(i),d=new e(i);Ys={Cache:e,split:f,normalizePath:u,setter:function(m){var w=u(m);return c.get(m)||c.set(m,function(T,N){for(var _=0,A=w.length,S=T;_<A-1;){var $=w[_];if($==="__proto__"||$==="constructor"||$==="prototype")return T;S=S[w[_++]]}S[w[_]]=N})},getter:function(m,w){var y=u(m);return d.get(m)||d.set(m,function(N){for(var _=0,A=y.length;_<A;)if(N!=null||!w)N=N[y[_++]];else return;return N})},join:function(m){return m.reduce(function(w,y){return w+(h(y)||r.test(y)?"["+y+"]":(w?".":"")+y)},"")},forEach:function(m,w,y){p(Array.isArray(m)?m:f(m),w,y)}};function u(m){return l.get(m)||l.set(m,f(m).map(function(w){return w.replace(a,"$2")}))}function f(m){return m.match(t)||[""]}function p(m,w,y){var T=m.length,N,_,A,S;for(_=0;_<T;_++)N=m[_],N&&(g(N)&&(N='"'+N+'"'),S=h(N),A=!S&&/^\d+$/.test(N),w.call(y,N,S,A,_,m))}function h(m){return typeof m=="string"&&m&&["'",'"'].indexOf(m.charAt(0))!==-1}function v(m){return m.match(s)&&!m.match(r)}function x(m){return n.test(m)}function g(m){return!h(m)&&(v(m)||x(m))}return Ys}var Ht=Ud(),Hs,za;function qd(){if(za)return Hs;za=1;const e=/[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,t=u=>u.match(e)||[],r=u=>u[0].toUpperCase()+u.slice(1),s=(u,f)=>t(u).join(f).toLowerCase(),n=u=>t(u).reduce((f,p)=>`${f}${f?p[0].toUpperCase()+p.slice(1).toLowerCase():p.toLowerCase()}`,"");return Hs={words:t,upperFirst:r,camelCase:n,pascalCase:u=>r(n(u)),snakeCase:u=>s(u,"_"),kebabCase:u=>s(u,"-"),sentenceCase:u=>r(s(u," ")),titleCase:u=>t(u).map(r).join(" ")},Hs}var Xs=qd(),ts={exports:{}},Ia;function Wd(){if(Ia)return ts.exports;Ia=1,ts.exports=function(n){return e(t(n),n)},ts.exports.array=e;function e(n,a){var i=n.length,l=new Array(i),c={},d=i,u=r(a),f=s(n);for(a.forEach(function(h){if(!f.has(h[0])||!f.has(h[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});d--;)c[d]||p(n[d],d,new Set);return l;function p(h,v,x){if(x.has(h)){var g;try{g=", node was:"+JSON.stringify(h)}catch{g=""}throw new Error("Cyclic dependency"+g)}if(!f.has(h))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(h));if(!c[v]){c[v]=!0;var m=u.get(h)||new Set;if(m=Array.from(m),v=m.length){x.add(h);do{var w=m[--v];p(w,f.get(w),x)}while(v);x.delete(h)}l[--i]=h}}}function t(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 r(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 ts.exports}var Kd=Wd();const Gd=El(Kd),Jd=Object.prototype.toString,Zd=Error.prototype.toString,Yd=RegExp.prototype.toString,Hd=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Xd=/^Symbol\((.*)\)(.*)$/;function Qd(e){return e!=+e?"NaN":e===0&&1/e<0?"-0":""+e}function Va(e,t=!1){if(e==null||e===!0||e===!1)return""+e;const r=typeof e;if(r==="number")return Qd(e);if(r==="string")return t?`"${e}"`:e;if(r==="function")return"[Function "+(e.name||"anonymous")+"]";if(r==="symbol")return Hd.call(e).replace(Xd,"Symbol($1)");const s=Jd.call(e).slice(8,-1);return s==="Date"?isNaN(e.getTime())?""+e:e.toISOString(e):s==="Error"||e instanceof Error?"["+Zd.call(e)+"]":s==="RegExp"?Yd.call(e):null}function Tt(e,t){let r=Va(e,t);return r!==null?r:JSON.stringify(e,function(s,n){let a=Va(this[s],t);return a!==null?a:n},2)}function bi(e){return e==null?[]:[].concat(e)}let gi,xi,vi,eu=/\$\{\s*(\w+)\s*\}/g;gi=Symbol.toStringTag;class Ba{constructor(t,r,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[gi]="Error",this.name="ValidationError",this.value=r,this.path=s,this.type=n,this.errors=[],this.inner=[],bi(t).forEach(a=>{if(tt.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]}}xi=Symbol.hasInstance;vi=Symbol.toStringTag;class tt extends Error{static formatError(t,r){const s=r.label||r.path||"this";return r=Object.assign({},r,{path:s,originalPath:r.path}),typeof t=="string"?t.replace(eu,(n,a)=>Tt(r[a])):typeof t=="function"?t(r):t}static isError(t){return t&&t.name==="ValidationError"}constructor(t,r,s,n,a){const i=new Ba(t,r,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[vi]="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,tt)}static[xi](t){return Ba[Symbol.hasInstance](t)||super[Symbol.hasInstance](t)}}let jt={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:e,type:t,value:r,originalValue:s})=>{const n=s!=null&&s!==r?` (cast from the value \`${Tt(s,!0)}\`).`:".";return t!=="mixed"?`${e} must be a \`${t}\` type, but the final value was: \`${Tt(r,!0)}\``+n:`${e} must match the configured type. The validated value was: \`${Tt(r,!0)}\``+n}},et={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"},Pt={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"},Sn={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},En={isValue:"${path} field must be ${value}"},ms={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},hs={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"},tu={notType:e=>{const{path:t,value:r,spec:s}=e,n=s.types.length;if(Array.isArray(r)){if(r.length<n)return`${t} tuple value has too few items, expected a length of ${n} but got ${r.length} for value: \`${Tt(r,!0)}\``;if(r.length>n)return`${t} tuple value has too many items, expected a length of ${n} but got ${r.length} for value: \`${Tt(r,!0)}\``}return tt.formatError(jt.notType,e)}};Object.assign(Object.create(null),{mixed:jt,string:et,number:Pt,date:Sn,object:ms,array:hs,boolean:En,tuple:tu});const Ms=e=>e&&e.__isYupSchema__;class ws{static fromOptions(t,r){if(!r.then&&!r.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:s,then:n,otherwise:a}=r,i=typeof s=="function"?s:(...l)=>l.every(c=>c===s);return new ws(t,(l,c)=>{var d;let u=i(...l)?n:a;return(d=u==null?void 0:u(c))!=null?d:c})}constructor(t,r){this.fn=void 0,this.refs=t,this.refs=t,this.fn=r}resolve(t,r){let s=this.refs.map(a=>a.getValue(r==null?void 0:r.value,r==null?void 0:r.parent,r==null?void 0:r.context)),n=this.fn(s,t,r);if(n===void 0||n===t)return t;if(!Ms(n))throw new TypeError("conditions must return a schema object");return n.resolve(r)}}const rs={context:"$",value:"."};class tr{constructor(t,r={}){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 t!="string")throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),t==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===rs.context,this.isValue=this.key[0]===rs.value,this.isSibling=!this.isContext&&!this.isValue;let s=this.isContext?rs.context:this.isValue?rs.value:"";this.path=this.key.slice(s.length),this.getter=this.path&&Ht.getter(this.path,!0),this.map=r.map}getValue(t,r,s){let n=this.isContext?s:this.isValue?t:r;return this.getter&&(n=this.getter(n||{})),this.map&&(n=this.map(n)),n}cast(t,r){return this.getValue(t,r==null?void 0:r.parent,r==null?void 0:r.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}tr.prototype.__isYupRef=!0;const bt=e=>e==null;function or(e){function t({value:r,path:s="",options:n,originalValue:a,schema:i},l,c){const{name:d,test:u,params:f,message:p,skipAbsent:h}=e;let{parent:v,context:x,abortEarly:g=i.spec.abortEarly,disableStackTrace:m=i.spec.disableStackTrace}=n;function w(z){return tr.isRef(z)?z.getValue(r,v,x):z}function y(z={}){const q=Object.assign({value:r,originalValue:a,label:i.spec.label,path:z.path||s,spec:i.spec,disableStackTrace:z.disableStackTrace||m},f,z.params);for(const P of Object.keys(q))q[P]=w(q[P]);const D=new tt(tt.formatError(z.message||p,q),r,q.path,z.type||d,q.disableStackTrace);return D.params=q,D}const T=g?l:c;let N={path:s,parent:v,type:d,from:n.from,createError:y,resolve:w,options:n,originalValue:a,schema:i};const _=z=>{tt.isError(z)?T(z):z?c(null):T(y())},A=z=>{tt.isError(z)?T(z):l(z)};if(h&&bt(r))return _(!0);let $;try{var V;if($=u.call(N,r,N),typeof((V=$)==null?void 0:V.then)=="function"){if(n.sync)throw new Error(`Validation test of type: "${N.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve($).then(_,A)}}catch(z){A(z);return}_($)}return t.OPTIONS=e,t}function ru(e,t,r,s=r){let n,a,i;return t?(Ht.forEach(t,(l,c,d)=>{let u=c?l.slice(1,l.length-1):l;e=e.resolve({context:s,parent:n,value:r});let f=e.type==="tuple",p=d?parseInt(u,10):0;if(e.innerType||f){if(f&&!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(r&&p>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${l}, in the path: ${t}. because there is no value at that index. `);n=r,r=r&&r[p],e=f?e.spec.types[p]:e.innerType}if(!d){if(!e.fields||!e.fields[u])throw new Error(`The schema does not contain the path: ${t}. (failed at: ${i} which is a type: "${e.type}")`);n=r,r=r&&r[u],e=e.fields[u]}a=u,i=c?"["+l+"]":"."+l}),{schema:e,parent:n,parentPath:a}):{parent:n,parentPath:t,schema:e}}class js extends Set{describe(){const t=[];for(const r of this.values())t.push(tr.isRef(r)?r.describe():r);return t}resolveAll(t){let r=[];for(const s of this.values())r.push(t(s));return r}clone(){return new js(this.values())}merge(t,r){const s=this.clone();return t.forEach(n=>s.add(n)),r.forEach(n=>s.delete(n)),s}}function cr(e,t=new Map){if(Ms(e)||!e||typeof e!="object")return e;if(t.has(e))return t.get(e);let r;if(e instanceof Date)r=new Date(e.getTime()),t.set(e,r);else if(e instanceof RegExp)r=new RegExp(e),t.set(e,r);else if(Array.isArray(e)){r=new Array(e.length),t.set(e,r);for(let s=0;s<e.length;s++)r[s]=cr(e[s],t)}else if(e instanceof Map){r=new Map,t.set(e,r);for(const[s,n]of e.entries())r.set(s,cr(n,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const s of e)r.add(cr(s,t))}else if(e instanceof Object){r={},t.set(e,r);for(const[s,n]of Object.entries(e))r[s]=cr(n,t)}else throw Error(`Unable to clone ${e}`);return r}class nt{constructor(t){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 js,this._blacklist=new js,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(jt.notType)}),this.type=t.type,this._typeCheck=t.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},t==null?void 0:t.spec),this.withMutation(r=>{r.nonNullable()})}get _type(){return this.type}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const r=Object.create(Object.getPrototypeOf(this));return r.type=this.type,r._typeCheck=this._typeCheck,r._whitelist=this._whitelist.clone(),r._blacklist=this._blacklist.clone(),r.internalTests=Object.assign({},this.internalTests),r.exclusiveTests=Object.assign({},this.exclusiveTests),r.deps=[...this.deps],r.conditions=[...this.conditions],r.tests=[...this.tests],r.transforms=[...this.transforms],r.spec=cr(Object.assign({},this.spec,t)),r}label(t){let r=this.clone();return r.spec.label=t,r}meta(...t){if(t.length===0)return this.spec.meta;let r=this.clone();return r.spec.meta=Object.assign(r.spec.meta||{},t[0]),r}withMutation(t){let r=this._mutate;this._mutate=!0;let s=t(this);return this._mutate=r,s}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let r=this,s=t.clone();const n=Object.assign({},r.spec,s.spec);return s.spec=n,s.internalTests=Object.assign({},r.internalTests,s.internalTests),s._whitelist=r._whitelist.merge(t._whitelist,t._blacklist),s._blacklist=r._blacklist.merge(t._blacklist,t._whitelist),s.tests=r.tests,s.exclusiveTests=r.exclusiveTests,s.withMutation(a=>{t.tests.forEach(i=>{a.test(i.OPTIONS)})}),s.transforms=[...r.transforms,...s.transforms],s}isType(t){return t==null?!!(this.spec.nullable&&t===null||this.spec.optional&&t===void 0):this._typeCheck(t)}resolve(t){let r=this;if(r.conditions.length){let s=r.conditions;r=r.clone(),r.conditions=[],r=s.reduce((n,a)=>a.resolve(n,t),r),r=r.resolve(t)}return r}resolveOptions(t){var r,s,n,a;return Object.assign({},t,{from:t.from||[],strict:(r=t.strict)!=null?r:this.spec.strict,abortEarly:(s=t.abortEarly)!=null?s:this.spec.abortEarly,recursive:(n=t.recursive)!=null?n:this.spec.recursive,disableStackTrace:(a=t.disableStackTrace)!=null?a:this.spec.disableStackTrace})}cast(t,r={}){let s=this.resolve(Object.assign({value:t},r)),n=r.assert==="ignore-optionality",a=s._cast(t,r);if(r.assert!==!1&&!s.isType(a)){if(n&&bt(a))return a;let i=Tt(t),l=Tt(a);throw new TypeError(`The value of ${r.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(t,r){let s=t===void 0?t:this.transforms.reduce((n,a)=>a.call(this,n,t,this),t);return s===void 0&&(s=this.getDefault(r)),s}_validate(t,r={},s,n){let{path:a,originalValue:i=t,strict:l=this.spec.strict}=r,c=t;l||(c=this._cast(c,Object.assign({assert:!1},r)));let d=[];for(let u of Object.values(this.internalTests))u&&d.push(u);this.runTests({path:a,value:c,originalValue:i,options:r,tests:d},s,u=>{if(u.length)return n(u,c);this.runTests({path:a,value:c,originalValue:i,options:r,tests:this.tests},s,n)})}runTests(t,r,s){let n=!1,{tests:a,value:i,originalValue:l,path:c,options:d}=t,u=g=>{n||(n=!0,r(g,i))},f=g=>{n||(n=!0,s(g,i))},h=a.length,p=[];if(!h)return f([]);let v={value:i,originalValue:l,path:c,options:d,schema:this};for(let g=0;g<a.length;g++){const x=a[g];x(v,u,function(w){w&&(Array.isArray(w)?p.push(...w):p.push(w)),--h<=0&&f(p)})}}asNestedTest({key:t,index:r,parent:s,parentPath:n,originalParent:a,options:i}){const l=t??r;if(l==null)throw TypeError("Must include `key` or `index` for nested validations");const c=typeof l=="number";let d=s[l];const u=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}.`:"")+t});return(f,h,p)=>this.resolve(u)._validate(d,u,h,p)}validate(t,r){var s;let n=this.resolve(Object.assign({},r,{value:t})),a=(s=r==null?void 0:r.disableStackTrace)!=null?s:n.spec.disableStackTrace;return new Promise((i,l)=>n._validate(t,r,(c,d)=>{tt.isError(c)&&(c.value=d),l(c)},(c,d)=>{c.length?l(new tt(c,d,void 0,void 0,a)):i(d)}))}validateSync(t,r){var s;let n=this.resolve(Object.assign({},r,{value:t})),a,i=(s=r==null?void 0:r.disableStackTrace)!=null?s:n.spec.disableStackTrace;return n._validate(t,Object.assign({},r,{sync:!0}),(l,c)=>{throw tt.isError(l)&&(l.value=c),l},(l,c)=>{if(l.length)throw new tt(l,t,void 0,void 0,i);a=c}),a}isValid(t,r){return this.validate(t,r).then(()=>!0,s=>{if(tt.isError(s))return!1;throw s})}isValidSync(t,r){try{return this.validateSync(t,r),!0}catch(s){if(tt.isError(s))return!1;throw s}}_getDefault(t){let r=this.spec.default;return r==null?r:typeof r=="function"?r.call(this,t):cr(r)}getDefault(t){return this.resolve(t||{})._getDefault(t)}default(t){return arguments.length===0?this._getDefault():this.clone({default:t})}strict(t=!0){return this.clone({strict:t})}nullability(t,r){const s=this.clone({nullable:t});return s.internalTests.nullable=or({message:r,name:"nullable",test(n){return n===null?this.schema.spec.nullable:!0}}),s}optionality(t,r){const s=this.clone({optional:t});return s.internalTests.optionality=or({message:r,name:"optionality",test(n){return n===void 0?this.schema.spec.optional:!0}}),s}optional(){return this.optionality(!0)}defined(t=jt.defined){return this.optionality(!1,t)}nullable(){return this.nullability(!0)}nonNullable(t=jt.notNull){return this.nullability(!1,t)}required(t=jt.required){return this.clone().withMutation(r=>r.nonNullable(t).defined(t))}notRequired(){return this.clone().withMutation(t=>t.nullable().optional())}transform(t){let r=this.clone();return r.transforms.push(t),r}test(...t){let r;if(t.length===1?typeof t[0]=="function"?r={test:t[0]}:r=t[0]:t.length===2?r={name:t[0],test:t[1]}:r={name:t[0],message:t[1],test:t[2]},r.message===void 0&&(r.message=jt.default),typeof r.test!="function")throw new TypeError("`test` is a required parameters");let s=this.clone(),n=or(r),a=r.exclusive||r.name&&s.exclusiveTests[r.name]===!0;if(r.exclusive&&!r.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return r.name&&(s.exclusiveTests[r.name]=!!r.exclusive),s.tests=s.tests.filter(i=>!(i.OPTIONS.name===r.name&&(a||i.OPTIONS.test===n.OPTIONS.test))),s.tests.push(n),s}when(t,r){!Array.isArray(t)&&typeof t!="string"&&(r=t,t=".");let s=this.clone(),n=pi(t).map(a=>new tr(a));return n.forEach(a=>{a.isSibling&&s.deps.push(a.key)}),s.conditions.push(typeof r=="function"?new ys(n,r):ys.fromOptions(n,r)),s}typeError(t){let r=this.clone();return r.internalTests.typeError=or({message:t,name:"typeError",skipAbsent:!0,test(s){return this.schema._typeCheck(s)?!0:this.createError({params:{type:this.schema.type}})}}),r}oneOf(t,r=jt.oneOf){let s=this.clone();return t.forEach(n=>{s._whitelist.add(n),s._blacklist.delete(n)}),s.internalTests.whiteList=or({message:r,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(t,r=jt.notOneOf){let s=this.clone();return t.forEach(n=>{s._blacklist.add(n),s._whitelist.delete(n)}),s.internalTests.blacklist=or({message:r,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(t=!0){let r=this.clone();return r.spec.strip=t,r}describe(t){const r=(t?this.resolve(t):this).clone(),{label:s,meta:n,optional:a,nullable:i}=r.spec;return{meta:n,label:s,optional:a,nullable:i,default:r.getDefault(t),type:r.type,oneOf:r._whitelist.describe(),notOneOf:r._blacklist.describe(),tests:r.tests.map(c=>({name:c.OPTIONS.name,params:c.OPTIONS.params})).filter((c,d,u)=>u.findIndex(f=>f.name===c.name)===d)}}}nt.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])nt.prototype[`${e}At`]=function(t,r,s={}){const{parent:n,parentPath:a,schema:i}=tu(this,t,r,s.context);return i[e](n&&n[a],Object.assign({},s,{parent:n,path:t}))};for(const e of["equals","is"])nt.prototype[e]=nt.prototype.oneOf;for(const e of["not","nope"])nt.prototype[e]=nt.prototype.notOneOf;const ru=()=>!0;function En(e){return new vi(e)}class vi extends nt{constructor(t){super(typeof t=="function"?{type:"mixed",check:t}:Object.assign({type:"mixed",check:ru},t))}}En.prototype=vi.prototype;function yi(){return new wi}class wi extends nt{constructor(){super({type:"boolean",check(t){return t instanceof Boolean&&(t=t.valueOf()),typeof t=="boolean"}}),this.withMutation(()=>{this.transform((t,r,s)=>{if(s.spec.coerce&&!s.isType(t)){if(/^(true|1)$/i.test(String(t)))return!0;if(/^(false|0)$/i.test(String(t)))return!1}return t})})}isTrue(t=Sn.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"true"},test(r){return bt(r)||r===!0}})}isFalse(t=Sn.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"false"},test(r){return bt(r)||r===!1}})}default(t){return super.default(t)}defined(t){return super.defined(t)}optional(){return super.optional()}required(t){return super.required(t)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(t){return super.nonNullable(t)}strip(t){return super.strip(t)}}yi.prototype=wi.prototype;const su=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function nu(e){const t=Cn(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(t.z===void 0&&t.plusMinus===void 0)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let r=0;return t.z!=="Z"&&t.plusMinus!==void 0&&(r=t.hourOffset*60+t.minuteOffset,t.plusMinus==="+"&&(r=0-r)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+r,t.second,t.millisecond)}function Cn(e){var t,r;const s=su.exec(e);return s?{year:Ct(s[1]),month:Ct(s[2],1)-1,day:Ct(s[3],1),hour:Ct(s[4]),minute:Ct(s[5]),second:Ct(s[6]),millisecond:s[7]?Ct(s[7].substring(0,3)):0,precision:(t=(r=s[7])==null?void 0:r.length)!=null?t:void 0,z:s[8]||void 0,plusMinus:s[9]||void 0,hourOffset:Ct(s[10]),minuteOffset:Ct(s[11])}:null}function Ct(e,t=0){return Number(e)||t}let au=/^[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])?)*$/,ou=/^((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,iu=/^(?:[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,lu="^\\d{4}-\\d{2}-\\d{2}",cu="\\d{2}:\\d{2}:\\d{2}",du="(([+-]\\d{2}(:?\\d{2})?)|Z)",uu=new RegExp(`${lu}T${cu}(\\.\\d+)?${du}$`),fu=e=>bt(e)||e===e.trim(),mu={}.toString();function lr(){return new ji}class ji extends nt{constructor(){super({type:"string",check(t){return t instanceof String&&(t=t.valueOf()),typeof t=="string"}}),this.withMutation(()=>{this.transform((t,r,s)=>{if(!s.spec.coerce||s.isType(t)||Array.isArray(t))return t;const n=t!=null&&t.toString?t.toString():t;return n===mu?t:n})})}required(t){return super.required(t).withMutation(r=>r.test({message:t||jt.required,name:"required",skipAbsent:!0,test:s=>!!s.length}))}notRequired(){return super.notRequired().withMutation(t=>(t.tests=t.tests.filter(r=>r.OPTIONS.name!=="required"),t))}length(t,r=et.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(s){return s.length===this.resolve(t)}})}min(t,r=et.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(s){return s.length>=this.resolve(t)}})}max(t,r=et.max){return this.test({name:"max",exclusive:!0,message:r,params:{max:t},skipAbsent:!0,test(s){return s.length<=this.resolve(t)}})}matches(t,r){let s=!1,n,a;return r&&(typeof r=="object"?{excludeEmptyString:s=!1,message:n,name:a}=r:n=r),this.test({name:a||"matches",message:n||et.matches,params:{regex:t},skipAbsent:!0,test:i=>i===""&&s||i.search(t)!==-1})}email(t=et.email){return this.matches(au,{name:"email",message:t,excludeEmptyString:!0})}url(t=et.url){return this.matches(ou,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=et.uuid){return this.matches(iu,{name:"uuid",message:t,excludeEmptyString:!1})}datetime(t){let r="",s,n;return t&&(typeof t=="object"?{message:r="",allowOffset:s=!1,precision:n=void 0}=t:r=t),this.matches(uu,{name:"datetime",message:r||et.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||et.datetime_offset,params:{allowOffset:s},skipAbsent:!0,test:a=>{if(!a||s)return!0;const i=Cn(a);return i?!!i.z:!1}}).test({name:"datetime_precision",message:r||et.datetime_precision,params:{precision:n},skipAbsent:!0,test:a=>{if(!a||n==null)return!0;const i=Cn(a);return i?i.precision===n:!1}})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=et.trim){return this.transform(r=>r!=null?r.trim():r).test({message:t,name:"trim",test:fu})}lowercase(t=et.lowercase){return this.transform(r=>bt(r)?r:r.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>bt(r)||r===r.toLowerCase()})}uppercase(t=et.uppercase){return this.transform(r=>bt(r)?r:r.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>bt(r)||r===r.toUpperCase()})}}lr.prototype=ji.prototype;let hu=e=>e!=+e;function ki(){return new Ni}class Ni extends nt{constructor(){super({type:"number",check(t){return t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&!hu(t)}}),this.withMutation(()=>{this.transform((t,r,s)=>{if(!s.spec.coerce)return t;let n=t;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(t,r=Pt.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(s){return s>=this.resolve(t)}})}max(t,r=Pt.max){return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(s){return s<=this.resolve(t)}})}lessThan(t,r=Pt.lessThan){return this.test({message:r,name:"max",exclusive:!0,params:{less:t},skipAbsent:!0,test(s){return s<this.resolve(t)}})}moreThan(t,r=Pt.moreThan){return this.test({message:r,name:"min",exclusive:!0,params:{more:t},skipAbsent:!0,test(s){return s>this.resolve(t)}})}positive(t=Pt.positive){return this.moreThan(0,t)}negative(t=Pt.negative){return this.lessThan(0,t)}integer(t=Pt.integer){return this.test({name:"integer",message:t,skipAbsent:!0,test:r=>Number.isInteger(r)})}truncate(){return this.transform(t=>bt(t)?t:t|0)}round(t){var r;let s=["ceil","floor","round","trunc"];if(t=((r=t)==null?void 0:r.toLowerCase())||"round",t==="trunc")return this.truncate();if(s.indexOf(t.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+s.join(", "));return this.transform(n=>bt(n)?n:Math[t](n))}}ki.prototype=Ni.prototype;let Si=new Date(""),pu=e=>Object.prototype.toString.call(e)==="[object Date]";function Hn(){return new Pr}class Pr extends nt{constructor(){super({type:"date",check(t){return pu(t)&&!isNaN(t.getTime())}}),this.withMutation(()=>{this.transform((t,r,s)=>!s.spec.coerce||s.isType(t)||t===null?t:(t=nu(t),isNaN(t)?Pr.INVALID_DATE:new Date(t)))})}prepareParam(t,r){let s;if(tr.isRef(t))s=t;else{let n=this.cast(t);if(!this._typeCheck(n))throw new TypeError(`\`${r}\` must be a Date or a value that can be \`cast()\` to a Date`);s=n}return s}min(t,r=Nn.min){let s=this.prepareParam(t,"min");return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n>=this.resolve(s)}})}max(t,r=Nn.max){let s=this.prepareParam(t,"max");return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(n){return n<=this.resolve(s)}})}}Pr.INVALID_DATE=Si;Hn.prototype=Pr.prototype;Hn.INVALID_DATE=Si;function bu(e,t=[]){let r=[],s=new Set,n=new Set(t.map(([i,l])=>`${i}-${l}`));function a(i,l){let c=Ht.split(i)[0];s.add(c),n.has(`${l}-${c}`)||r.push([l,c])}for(const i of Object.keys(e)){let l=e[i];s.add(i),tr.isRef(l)&&l.isSibling?a(l.path,i):Ds(l)&&"deps"in l&&l.deps.forEach(c=>a(c,i))}return Kd.array(Array.from(s),r).reverse()}function Ba(e,t){let r=1/0;return e.some((s,n)=>{var a;if((a=t.path)!=null&&a.includes(s))return r=n,!0}),r}function Ei(e){return(t,r)=>Ba(e,t)-Ba(e,r)}const Ci=(e,t,r)=>{if(typeof e!="string")return e;let s=e;try{s=JSON.parse(e)}catch{}return r.isType(s)?s:e};function hs(e){if("fields"in e){const t={};for(const[r,s]of Object.entries(e.fields))t[r]=hs(s);return e.setFields(t)}if(e.type==="array"){const t=e.optional();return t.innerType&&(t.innerType=hs(t.innerType)),t}return e.type==="tuple"?e.optional().clone({types:e.spec.types.map(hs)}):"optional"in e?e.optional():e}const gu=(e,t)=>{const r=[...Ht.normalizePath(t)];if(r.length===1)return r[0]in e;let s=r.pop(),n=Ht.getter(Ht.join(r),!0)(e);return!!(n&&s in n)};let Ua=e=>Object.prototype.toString.call(e)==="[object Object]";function qa(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter(s=>r.indexOf(s)===-1)}const xu=Ei([]);function Ai(e){return new Ti(e)}class Ti extends nt{constructor(t){super({type:"object",check(r){return Ua(r)||typeof r=="function"}}),this.fields=Object.create(null),this._sortErrors=xu,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{t&&this.shape(t)})}_cast(t,r={}){var s;let n=super._cast(t,r);if(n===void 0)return this.getDefault(r);if(!this._typeCheck(n))return n;let a=this.fields,i=(s=r.stripUnknown)!=null?s:this.spec.noUnknown,l=[].concat(this._nodes,Object.keys(n).filter(f=>!this._nodes.includes(f))),c={},d=Object.assign({},r,{parent:c,__validating:r.__validating||!1}),u=!1;for(const f of l){let h=a[f],p=f in n;if(h){let v,g=n[f];d.path=(r.path?`${r.path}.`:"")+f,h=h.resolve({value:g,context:r.context,parent:c});let x=h instanceof nt?h.spec:void 0,m=x==null?void 0:x.strict;if(x!=null&&x.strip){u=u||f in n;continue}v=!r.__validating||!m?h.cast(n[f],d):n[f],v!==void 0&&(c[f]=v)}else p&&!i&&(c[f]=n[f]);(p!==f in c||c[f]!==n[f])&&(u=!0)}return u?c:n}_validate(t,r={},s,n){let{from:a=[],originalValue:i=t,recursive:l=this.spec.recursive}=r;r.from=[{schema:this,value:i},...a],r.__validating=!0,r.originalValue=i,super._validate(t,r,s,(c,d)=>{if(!l||!Ua(d)){n(c,d);return}i=i||d;let u=[];for(let f of this._nodes){let h=this.fields[f];!h||tr.isRef(h)||u.push(h.asNestedTest({options:r,key:f,parent:d,parentPath:r.path,originalParent:i}))}this.runTests({tests:u,value:d,originalValue:i,options:r},s,f=>{n(f.sort(this._sortErrors).concat(c),d)})})}clone(t){const r=super.clone(t);return r.fields=Object.assign({},this.fields),r._nodes=this._nodes,r._excludedEdges=this._excludedEdges,r._sortErrors=this._sortErrors,r}concat(t){let r=super.concat(t),s=r.fields;for(let[n,a]of Object.entries(this.fields)){const i=s[n];s[n]=i===void 0?a:i}return r.withMutation(n=>n.setFields(s,[...this._excludedEdges,...t._excludedEdges]))}_getDefault(t){if("default"in this.spec)return super._getDefault(t);if(!this._nodes.length)return;let r={};return this._nodes.forEach(s=>{var n;const a=this.fields[s];let i=t;(n=i)!=null&&n.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[s]})),r[s]=a&&"getDefault"in a?a.getDefault(i):void 0}),r}setFields(t,r){let s=this.clone();return s.fields=t,s._nodes=bu(t,r),s._sortErrors=Ei(Object.keys(t)),r&&(s._excludedEdges=r),s}shape(t,r=[]){return this.clone().withMutation(s=>{let n=s._excludedEdges;return r.length&&(Array.isArray(r[0])||(r=[r]),n=[...s._excludedEdges,...r]),s.setFields(Object.assign(s.fields,t),n)})}partial(){const t={};for(const[r,s]of Object.entries(this.fields))t[r]="optional"in s&&s.optional instanceof Function?s.optional():s;return this.setFields(t)}deepPartial(){return hs(this)}pick(t){const r={};for(const s of t)this.fields[s]&&(r[s]=this.fields[s]);return this.setFields(r,this._excludedEdges.filter(([s,n])=>t.includes(s)&&t.includes(n)))}omit(t){const r=[];for(const s of Object.keys(this.fields))t.includes(s)||r.push(s);return this.pick(r)}from(t,r,s){let n=Ht.getter(t,!0);return this.transform(a=>{if(!a)return a;let i=a;return gu(a,t)&&(i=Object.assign({},a),s||delete i[t],i[r]=n(a)),i})}json(){return this.transform(Ci)}exact(t){return this.test({name:"exact",exclusive:!0,message:t||fs.exact,test(r){if(r==null)return!0;const s=qa(this.schema,r);return s.length===0||this.createError({params:{properties:s.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(t=!0,r=fs.noUnknown){typeof t!="boolean"&&(r=t,t=!0);let s=this.test({name:"noUnknown",exclusive:!0,message:r,test(n){if(n==null)return!0;const a=qa(this.schema,n);return!t||a.length===0||this.createError({params:{unknown:a.join(", ")}})}});return s.spec.noUnknown=t,s}unknown(t=!0,r=fs.noUnknown){return this.noUnknown(!t,r)}transformKeys(t){return this.transform(r=>{if(!r)return r;const s={};for(const n of Object.keys(r))s[t(n)]=r[n];return s})}camelCase(){return this.transformKeys(Hs.camelCase)}snakeCase(){return this.transformKeys(Hs.snakeCase)}constantCase(){return this.transformKeys(t=>Hs.snakeCase(t).toUpperCase())}describe(t){const r=(t?this.resolve(t):this).clone(),s=super.describe(t);s.fields={};for(const[a,i]of Object.entries(r.fields)){var n;let l=t;(n=l)!=null&&n.value&&(l=Object.assign({},l,{parent:l.value,value:l.value[a]})),s.fields[a]=i.describe(l)}return s}}Ai.prototype=Ti.prototype;function An(e){return new _i(e)}class _i extends nt{constructor(t){super({type:"array",spec:{types:t},check(r){return Array.isArray(r)}}),this.innerType=void 0,this.innerType=t}_cast(t,r){const s=super._cast(t,r);if(!this._typeCheck(s)||!this.innerType)return s;let n=!1;const a=s.map((i,l)=>{const c=this.innerType.cast(i,Object.assign({},r,{path:`${r.path||""}[${l}]`}));return c!==i&&(n=!0),c});return n?a:s}_validate(t,r={},s,n){var a;let i=this.innerType,l=(a=r.recursive)!=null?a:this.spec.recursive;r.originalValue!=null&&r.originalValue,super._validate(t,r,s,(c,d)=>{var u;if(!l||!i||!this._typeCheck(d)){n(c,d);return}let f=new Array(d.length);for(let p=0;p<d.length;p++){var h;f[p]=i.asNestedTest({options:r,index:p,parent:d,parentPath:r.path,originalParent:(h=r.originalValue)!=null?h:t})}this.runTests({value:d,tests:f,originalValue:(u=r.originalValue)!=null?u:t,options:r},s,p=>n(p.concat(c),d))})}clone(t){const r=super.clone(t);return r.innerType=this.innerType,r}json(){return this.transform(Ci)}concat(t){let r=super.concat(t);return r.innerType=this.innerType,t.innerType&&(r.innerType=r.innerType?r.innerType.concat(t.innerType):t.innerType),r}of(t){let r=this.clone();if(!Ds(t))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+Tt(t));return r.innerType=t,r.spec=Object.assign({},r.spec,{types:t}),r}length(t,r=ms.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(s){return s.length===this.resolve(t)}})}min(t,r){return r=r||ms.min,this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(s){return s.length>=this.resolve(t)}})}max(t,r){return r=r||ms.max,this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(s){return s.length<=this.resolve(t)}})}ensure(){return this.default(()=>[]).transform((t,r)=>this._typeCheck(t)?t:r==null?[]:[].concat(r))}compact(t){let r=t?(s,n,a)=>!t(s,n,a):s=>!!s;return this.transform(s=>s!=null?s.filter(r):s)}describe(t){const r=(t?this.resolve(t):this).clone(),s=super.describe(t);if(r.innerType){var n;let a=t;(n=a)!=null&&n.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[0]})),s.innerType=r.innerType.describe(a)}return s}}An.prototype=_i.prototype;function vu(e){return e.validation??{}}function yu(e){return!!e.multiple}function Xs(e){const t=e.maxFiles;return typeof t=="number"?t:void 0}function At(e,t){return t.required?e.required(t.requiredMessage||"Requerido"):e}function rs(e,t){var s,n,a;let r=e;return((s=t.minLength)==null?void 0:s.value)!=null&&(r=r.min(t.minLength.value,t.minLength.message||`Mín. ${t.minLength.value} caracteres`)),((n=t.maxLength)==null?void 0:n.value)!=null&&(r=r.max(t.maxLength.value,t.maxLength.message||`Máx. ${t.maxLength.value} caracteres`)),((a=t.pattern)==null?void 0:a.value)instanceof RegExp&&(r=r.matches(t.pattern.value,t.pattern.message||"Formato inválido")),r}function wu(e){var r;const t=vu(e);switch(e.type){case"text":case"password":{let s=lr().trim();return s=rs(s,t),At(s,t)}case"email":{let s=lr().trim().email(t.emailMessage||"Email inválido");return s=rs(s,t),At(s,t)}case"number":{let s=ki().transform((n,a)=>a===""||a===null?void 0:n).typeError(t.typeError||"Debe ser un número");return((r=t.pattern)==null?void 0:r.value)instanceof RegExp&&(s=s.test("pattern-number",t.pattern.message||"Formato inválido",n=>n==null||t.pattern.value.test(String(n)))),At(s,t)}case"select":{if(yu(e)){const n=An().of(lr());return At(n,t)}let s=lr().trim();return s=rs(s,t),At(s,t)}case"checkbox":{let s=yi();return t.required&&(s=s.oneOf([!0],t.requiredMessage||"Debes marcar esta casilla")),s}case"textarea":{let s=lr().trim();return s=rs(s,t),At(s,t)}case"date":{const s=Hn().typeError(t.typeError||"Fecha inválida").transform((n,a)=>a?new Date(a):void 0);return At(s,t)}case"file":{const s=An().of(En()).test("max-files",Xs(e)?`Máx. ${Xs(e)} fichero(s)`:"Número de ficheros inválido",n=>{const a=Xs(e);return!Array.isArray(n)||!a||n.length<=a});return At(s,t)}default:{const s=En();return At(s,t)}}}function Fi(e){const t={};for(const r of e.fields){const s=r;s.name&&(t[s.name]=wu(s))}return Ai(t)}function zr({options:e,value:t,onChange:r,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=e.findIndex(x=>x.value===t);if(d<0)return;const u=l.children[d],f=u.querySelector("span"),h=(f==null?void 0:f.offsetWidth)??u.offsetWidth,p=u.offsetWidth,g=u.offsetLeft+(p-h)/2;i({left:g,width:h})};return c(),window.addEventListener("resize",c),l.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),l.removeEventListener("scroll",c)}},[t,e]),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:e.map(l=>{const c=l.value===t;return o.jsx("li",{role:"tab","aria-selected":c,onClick:()=>r(l.value),className:se("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[t]})]})}const ss={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},Wa={sm:"h-6",md:"h-10",lg:"h-12"},Ka={sm:"px-2",md:"px-2.5",lg:"px-3"},Ga={sm:"1.5rem",md:"2.5rem",lg:"3rem"};function Ja({id:e,size:t,disabled:r,error:s,reserveErrorSpace:n,className:a,suffixButton:i,children:l}){return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"relative flex items-center w-full",children:[l,i&&o.jsx("div",{className:"flex items-center h-full pr-2",children:i})]}),n?o.jsx("div",{className:"min-h-[18px] w-full",children:s!=null&&s.message?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:s.message}):o.jsx("span",{"aria-hidden":"true",children:" "})}):s!=null&&s.message?o.jsx("div",{className:"pt-1",children:o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:s.message})}):null]})}function rt(e){const{control:t,name:r,rules:s,defaultValue:n,options:a=[],loadOptions:i,reloadDeps:l=[],value:c,onChange:d,size:u="sm",width:f="100%",label:h,labelHidden:p=!1,hasError:v=!1,errorMessage:g="",reserveErrorSpace:x,disableErrorPlaceholder:m,disabled:w=!1,className:y,suffixButton:T,loading:N=!1,coerceFirstValid:_=!0}=e,A=b.useId(),S=r||A,[$,V]=b.useState(a),[z,q]=b.useState(!!i);b.useEffect(()=>{i&&(q(!0),i().then(E=>V(E)).finally(()=>q(!1)))},[i,...l]);const D=E=>E.find(te=>te.value!==""&&te.value!==void 0)??E[0],P=typeof x=="boolean"?x:!!t;if(t&&r){const{field:E,fieldState:te}=ti({name:r,control:t,rules:s,defaultValue:n});return b.useEffect(()=>{if(!z&&$.length>0&&_){const ne=E.value,K=$.some(le=>String(le.value)===String(ne));(ne===void 0||!K)&&E.onChange(D($).value)}},[$,z,E,_]),o.jsxs("div",{className:se("flex flex-col",y),style:{width:f,maxWidth:"100%"},children:[h&&o.jsx("label",{htmlFor:S,className:se("pb-2 text-[var(--color-ds-text-primary)]",ss[u],p&&"sr-only"),children:h}),N||z?o.jsx(Xt,{width:"100%",height:Ga[u],variant:"rect",className:"rounded-lg"}):o.jsx(Ja,{id:S,size:u,disabled:w,error:te.error,reserveErrorSpace:typeof m=="boolean"?!m:P,className:y,suffixButton:T,children:o.jsx("select",{id:S,value:E.value,onChange:ne=>E.onChange(ne.target.value),disabled:w,className:se("box-border w-full rounded-lg border bg-[var(--color-ds-background-page)] outline-none transition font-[var(--font-primary)]",ss[u],Wa[u],Ka[u],te.error?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",w?"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)]",y),children:$.map(ne=>o.jsx("option",{value:ne.value,className:"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",children:ne.label},ne.value))})})]})}return b.useEffect(()=>{if(!t&&$.length>0&&_){const E=$.some(ne=>String(ne.value)===String(c));(c===void 0||c===""||!E)&&d&&d(D($).value)}},[$,c,d,t,_]),o.jsxs("div",{className:se("flex flex-col",y),style:{width:f,maxWidth:"100%"},children:[h&&o.jsx("label",{htmlFor:S,className:se("pb-2 text-[var(--color-ds-text-primary)]",ss[u],p&&"sr-only"),children:h}),N||z?o.jsx(Xt,{width:"100%",height:Ga[u],variant:"rect",className:"rounded-lg"}):o.jsx(Ja,{id:S,size:u,disabled:w,error:v?{message:g}:void 0,reserveErrorSpace:typeof m=="boolean"?!m:!!(x??!1),className:y,suffixButton:T,children:o.jsx("select",{id:S,value:c,onChange:E=>d==null?void 0:d(E.target.value),disabled:w,className:se("box-border w-full rounded-lg border bg-[var(--color-ds-background-page)] outline-none transition font-[var(--font-primary)]",ss[u],Wa[u],Ka[u],v?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",w?"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)]",y),children:$.map(E=>o.jsx("option",{value:E.value,className:"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",children:E.label},E.value))})})]})}const Za={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"};function Oi({groupLabel:e,inputs:t=[],separator:r=o.jsx("span",{className:"px-1 select-none",children:"/"}),useSeparator:s=!0,className:n,showVisibleLabel:a=!1,size:i="sm",width:l}){const c=t.length;return o.jsxs("div",{className:se("flex flex-col",n),style:l?{width:l}:void 0,children:[o.jsx("label",{className:se("sr-only pb-2",Za[i]),children:e}),a&&o.jsx("label",{className:se("pb-2",Za[i]),children:e}),o.jsx("div",{className:"flex items-center flex-nowrap",children:t.map((d,u)=>{const{width:f,className:h,options:p,loadOptions:v,...g}=d,x=Array.isArray(p)||typeof v=="function";let m="rounded-lg";!s&&c>1&&(u===0?m="rounded-l-lg rounded-r-none":u===c-1?m="rounded-r-lg rounded-l-none !rounded-l-none":m="rounded-none !rounded-l-none !rounded-r-none");const w=[],y=typeof f=="string"&&f.split(/\s+/).some(A=>A.startsWith("w-")||A.includes(":w-")),T=se("inline-flex items-center flex-shrink-0",typeof f=="string"&&y?f:void 0,!s&&c>1&&u>0?"-ml-px focus-within:z-10 relative":void 0),N=typeof f=="string"&&!y?{width:f}:void 0,_=se(h,m,w);return o.jsxs("div",{className:T,style:N,children:[x?o.jsx(rt,{...g,size:i,className:_,options:p,loadOptions:v}):o.jsx(we,{...g,size:i,className:_}),s&&u<c-1&&r]},u)})})]})}const Ya={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},ju={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function Ri({groupLabel:e,options:t,control:r,name:s,rules:n,defaultValue:a,multiple:i=!0,size:l="sm",vertical:c=!0,className:d,showVisibleLabel:u=!0}){return o.jsx(gt,{name:s,control:r,rules:n,defaultValue:a,render:({field:f,fieldState:h})=>{const{value:p,onChange:v}=f;h.error;const g=m=>i?Array.isArray(p)&&p.includes(m):p===m,x=m=>{if(i){const w=Array.isArray(p)?[...p]:[],y=w.indexOf(m);y>=0?w.splice(y,1):w.push(m),v(w)}else v(m)};return o.jsxs("div",{className:se("w-full",d),children:[o.jsx("label",{className:se("sr-only pb-2 text-[var(--color-ds-text-primary)]",Ya[l]),children:e}),u&&o.jsx("label",{className:se("block pb-2 text-[var(--color-ds-text-primary)]",Ya[l]),children:e}),o.jsx("div",{className:se(c?"flex flex-col gap-2":"flex flex-wrap gap-4"),children:t.map(m=>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:m.value,checked:g(m.value),onChange:()=>x(m.value),className:se(ju[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:m.label})]},m.value))})]})}})}function ku(e){function t(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 u=t(i[d]);if(u)return`${d}.${u}`}}return null}const r=t(e);if(!r)return;const s=`[name="${r}"]`,n=`[name^="${r}["], [name^="${r}."]`,a=document.querySelector(s)??document.querySelector(n);a&&(a.scrollIntoView({behavior:"smooth",block:"center"}),a.focus({preventScroll:!0}))}const Nu={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"},Di=({id:e,message:t,variant:r="info",duration:s=5e3,onClose:n})=>(b.useEffect(()=>{const a=setTimeout(()=>n(e),s);return()=>clearTimeout(a)},[e,s,n]),o.jsxs("div",{className:se("w-80 max-w-full border-l-4 rounded shadow-md p-4 mb-2 flex justify-between items-start",Nu[r]),role:"alert","aria-live":"assertive",children:[o.jsx("span",{className:"flex-1",children:t}),o.jsx("button",{onClick:()=>n(e),className:"ml-4 text-xl font-bold leading-none focus:outline-none",children:"×"})]}));let ns;const Su=new Uint8Array(16);function Eu(){if(!ns&&(ns=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ns))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ns(Su)}const Ue=[];for(let e=0;e<256;++e)Ue.push((e+256).toString(16).slice(1));function Cu(e,t=0){return Ue[e[t+0]]+Ue[e[t+1]]+Ue[e[t+2]]+Ue[e[t+3]]+"-"+Ue[e[t+4]]+Ue[e[t+5]]+"-"+Ue[e[t+6]]+Ue[e[t+7]]+"-"+Ue[e[t+8]]+Ue[e[t+9]]+"-"+Ue[e[t+10]]+Ue[e[t+11]]+Ue[e[t+12]]+Ue[e[t+13]]+Ue[e[t+14]]+Ue[e[t+15]]}const Au=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ha={randomUUID:Au};function Tu(e,t,r){if(Ha.randomUUID&&!e)return Ha.randomUUID();e=e||{};const s=e.random||(e.rng||Eu)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Cu(s)}const Mi=b.createContext(null),Ir=()=>{const e=b.useContext(Mi);if(!e)throw new Error("useToast debe usarse dentro de <ToastProvider>");return e},_u=({children:e})=>{const[t,r]=b.useState([]),s=(a,i="info",l=5e3)=>{const c=Tu();r(d=>[...d,{id:c,message:a,variant:i,duration:l}])},n=a=>{r(i=>i.filter(l=>l.id!==a))};return o.jsxs(Mi.Provider,{value:{show:s},children:[e,o.jsx("div",{className:"fixed top-4 right-4 z-50 flex flex-col items-end",children:t.map(a=>o.jsx(Di,{id:a.id,message:a.message,variant:a.variant,duration:a.duration,onClose:n},a.id))})]})},Fu=e=>e.type==="inputGroup",Ou=e=>e.type==="button",Ru=e=>!Fu(e)&&!Ou(e);function Du(e){const t=Array.isArray(e)?e:[];return b.useMemo(()=>{const r={};for(const s of t)Ru(s)&&s.name&&(r[s.name]=s);return r},[t])}const $i=b.createContext(null);function Mu({children:e,value:t}){return o.jsx($i.Provider,{value:t,children:e})}function Ms(){const e=b.useContext($i);if(!e)throw new Error("useAdapters debe usarse dentro de <AdaptersProvider />");return e}const $u=e=>!!e&&typeof e.then=="function";function Lu(e){return Array.isArray(e)?e.length>0&&typeof e[0]=="object"&&e[0]!==null?e.map(t=>{var n;if("label"in t&&"value"in t)return t;const s=(n=Object.entries(t)[0])==null?void 0:n[1];return{label:String(s??JSON.stringify(t)),value:String(s??"")}}):e.map(t=>({label:String(t),value:t})):[]}function Pu(e){const{services:t}=Ms(),[r,s]=b.useState({}),[n,a]=b.useState(0),i=b.useRef(!0);b.useEffect(()=>(i.current=!0,()=>{i.current=!1}),[]);const l=b.useMemo(()=>e.filter(c=>c.type==="select"&&!c.options&&typeof c.optionSource=="string"&&c.name),[e]);return b.useEffect(()=>{if(l.length===0)return;let c=!1;return(async()=>{a(d=>d+1);try{const d=await Promise.all(l.map(async u=>{var x;const f=u.name,h=u.optionSource,p=(x=t==null?void 0:t.registry)==null?void 0:x[h];if(!p)return[f,[]];const v=$u(p)?await p:await p(),g=Lu(v);return[f,g]}));if(c||!i.current)return;s(u=>{const f={...u};for(const[h,p]of d)f[h]=[...p];return f})}finally{!c&&i.current&&a(d=>Math.max(0,d-1))}})(),()=>{c=!0}},[l,t==null?void 0:t.registry]),{optionsMap:r,loadingCount:n}}const zu=e=>e.type==="inputGroup",Iu=e=>e.type==="button",Vu=e=>!zu(e)&&!Iu(e);function Bu(e){return typeof e=="object"&&e!==null}const Uu=e=>{const t=e.disabledWhen;if(!Bu(t))return!1;const r="watchField"in t,s="rule"in t;return r&&!s};function qu(e,t){const r=Array.isArray(e)?e:[],s=b.useMemo(()=>r.filter(Vu).filter(Uu),[r]),n=b.useMemo(()=>s.map(c=>c.disabledWhen.watchField),[s]),a=Wn({control:t,...n.length>0?{name:n}:{}}),i=Array.isArray(a)?a:[],l={};return s.forEach((c,d)=>{const u=i[d];l[c.name??`__unnamed_${d}`]=u===c.disabledWhen.watchValue}),l}const Xa={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},Wu={sm:"px-2 py-1",md:"px-3 py-2",lg:"px-4 py-3"};function $s({control:e,name:t,rules:r,defaultValue:s,size:n="sm",width:a="100%",label:i,labelHidden:l=!1,hasError:c=!1,errorMessage:d="",maxLength:u,showCounter:f=!1,className:h,suffixButton:p,...v}){const g=b.useId(),x=t||g,[m,w]=b.useState(s||"");if(e&&t)return o.jsx(gt,{name:t,control:e,rules:r,defaultValue:s||"",render:({field:T,fieldState:N})=>{var _;return o.jsx($s,{...v,size:n,width:a,label:i,labelHidden:l,hasError:!!N.error,errorMessage:((_=N.error)==null?void 0:_.message)||"",maxLength:u,showCounter:f,className:h,suffixButton:p,value:T.value,onChange:T.onChange})}});b.useEffect(()=>{w(s||"")},[s]);const y=T=>{var N;u!==void 0&&T.target.value.length>u||(w(T.target.value),(N=v.onChange)==null||N.call(v,T))};return o.jsxs("div",{className:se("flex flex-col",h),style:{width:a},children:[i&&o.jsx("label",{htmlFor:x,className:se("pb-2 text-[var(--color-ds-text-primary)]",Xa[n],l&&"sr-only"),children:i}),o.jsxs("div",{className:"flex items-stretch gap-2",children:[o.jsx("textarea",{id:x,className:se("box-border bg-[var(--color-ds-background-page)] w-full resize vertical rounded-lg border outline-none transition font-[var(--font-primary)]",Xa[n],Wu[n],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:m,onChange:y,maxLength:u,...v}),p?o.jsx("div",{className:"shrink-0",children:p}):null]}),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:" "}),f&&u!==void 0&&o.jsxs("span",{className:"text-xs text-[var(--color-ds-text-secondary)]",children:[m.length,"/",u]})]})]})}const Ku={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function dt({control:e=null,name:t,rules:r,defaultValue:s=!1,label:n,labelHidden:a=!1,disabled:i=!1,size:l="sm",className:c,hasError:d=!1,errorMessage:u="",checked:f,onChange:h}){const p=se(Ku[l],"text-[var(--color-ds-button-primary-bg)]","border-[var(--color-ds-border-default)]",i&&"opacity-50 cursor-not-allowed"),v=se("text-[var(--color-ds-text-primary)] text-ds-md",i&&"text-[var(--color-ds-text-secondary)]",a&&"sr-only");return e?o.jsx("div",{className:se("flex flex-col",c),children:o.jsx(gt,{name:t||"",control:e,rules:r,defaultValue:s,render:({field:g,fieldState:x})=>{const m=x.error;return o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"flex items-center space-x-2",children:[o.jsx("input",{id:t,type:"checkbox",className:p,checked:!!g.value,onChange:w=>g.onChange(w.target.checked),disabled:i}),n&&o.jsx("span",{className:v,children:n})]}),(d||m)&&((m==null?void 0:m.message)||u)&&o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:(m==null?void 0:m.message)||u})]})}})}):o.jsxs("div",{className:se("flex flex-col",c),children:[o.jsxs("label",{className:"flex items-center space-x-2",children:[o.jsx("input",{id:t,type:"checkbox",className:p,checked:!!f,onChange:g=>h==null?void 0:h(g.target.checked),disabled:i}),n&&o.jsx("span",{className:v,children:n})]}),d&&!!u&&o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:u})]})}function Li({name:e,control:t,searchFn:r,resolveByValue:s,label:n,size:a="sm",width:i="100%",disabled:l=!1,searchMode:c="button",minChars:d=3,debounceMs:u=600}){const f=Lr(),{watch:h,getValues:p,setValue:v}=f,g=Wn({control:t,name:e}),[x,m]=b.useState([]),[w,y]=b.useState(!1),[T,N]=b.useState(!1),[_,A]=b.useState(""),S=b.useRef(null),$=b.useRef(null),V=b.useRef(!1),z=b.useRef(!1),q=b.useRef(!0),D=b.useMemo(()=>{const K=new Map;for(const le of x)K.set(String(le.value).trim(),le.label??"");return K},[x]),P=async K=>{const le=(K??"").trim();if(!le){m([]),N(!1);return}y(!0);try{const C=await r(le,{watch:h,getValues:p});m(C??[]),N(!0)}finally{y(!1)}};b.useEffect(()=>{function K(le){S.current&&!S.current.contains(le.target)&&N(!1)}if(T)return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[T]),b.useEffect(()=>{if(V.current)return;const le=(g?String(g):"").trim();if(!le){A(""),N(!1);return}const C=D.get(le);if(C){A(C),N(!1),q.current=!0;return}let k=!1;return(async()=>{if(s)try{const I=await s(le,{watch:h,getValues:p});k||(A((I==null?void 0:I.label)??le),N(!1),q.current=!0)}catch{k||(A(le),N(!1),q.current=!0)}else A(le),N(!1),q.current=!0})(),()=>{k=!0}},[g,D,s,h,p]),b.useEffect(()=>{if(c!=="debounced"||l)return;if(q.current){q.current=!1;return}if(!z.current)return;$.current&&(window.clearTimeout($.current),$.current=null);const K=(_||"").trim();return K.length>=d?$.current=window.setTimeout(()=>{P(K)},u):(m([]),N(!1)),()=>{$.current&&(window.clearTimeout($.current),$.current=null)}},[_,c,d,u,l]);const E=a==="sm"?"text-ds-sm":a==="md"?"text-ds-md":"text-ds-lg",te=a==="sm"?"h-6":a==="md"?"h-10":"h-12",ne=K=>{if(l)return;const le=(_||"").trim();K.key==="Enter"&&(K.preventDefault(),c==="debounced"?le.length>=d&&P(le):P(le)),K.key==="Escape"&&N(!1)};return o.jsx(gt,{name:e,control:t,render:({field:K,fieldState:le})=>{var C;return o.jsxs("div",{ref:S,className:"relative flex flex-col",style:{width:i},children:[n&&o.jsx("label",{className:`pb-2 text-[var(--color-ds-text-primary)] ${E}`,children:n}),o.jsx(we,{className:c==="button"?"rounded-r-none":void 0,type:"text",size:a,width:"100%",value:_,onChange:k=>{const I=k.target.value;V.current=!0,z.current=!0,A(I),(g?String(g):"").trim()&&v(e,"",{shouldDirty:!0})},onKeyDown:ne,onBlur:()=>{V.current=!1},disabled:l,hasError:le.invalid,errorMessage:(C=le.error)==null?void 0:C.message,onFocus:()=>{if(V.current=!0,c==="button"&&z.current){const k=(_||"").trim();k&&P(k)}},suffixButton:c==="button"?o.jsx(ie,{type:"button",className:"!rounded-l-none",size:a,variant:"primary",onClick:()=>P((_||"").trim()),disabled:l,children:"Buscar"}):void 0}),w&&o.jsx("div",{className:"absolute top-14 left-0 right-0 z-10",children:o.jsx(Xt,{width:"100%",height:a==="sm"?"1.5rem":a==="md"?"2.5rem":"3rem",variant:"rect",className:"rounded-lg"})}),T&&!w&&x.length>0&&o.jsx("ul",{className:`
29
+ `+(l!==i?`result of cast: ${l}`:""))}return a}_cast(t,r){let s=t===void 0?t:this.transforms.reduce((n,a)=>a.call(this,n,t,this),t);return s===void 0&&(s=this.getDefault(r)),s}_validate(t,r={},s,n){let{path:a,originalValue:i=t,strict:l=this.spec.strict}=r,c=t;l||(c=this._cast(c,Object.assign({assert:!1},r)));let d=[];for(let u of Object.values(this.internalTests))u&&d.push(u);this.runTests({path:a,value:c,originalValue:i,options:r,tests:d},s,u=>{if(u.length)return n(u,c);this.runTests({path:a,value:c,originalValue:i,options:r,tests:this.tests},s,n)})}runTests(t,r,s){let n=!1,{tests:a,value:i,originalValue:l,path:c,options:d}=t,u=x=>{n||(n=!0,r(x,i))},f=x=>{n||(n=!0,s(x,i))},p=a.length,h=[];if(!p)return f([]);let v={value:i,originalValue:l,path:c,options:d,schema:this};for(let x=0;x<a.length;x++){const g=a[x];g(v,u,function(w){w&&(Array.isArray(w)?h.push(...w):h.push(w)),--p<=0&&f(h)})}}asNestedTest({key:t,index:r,parent:s,parentPath:n,originalParent:a,options:i}){const l=t??r;if(l==null)throw TypeError("Must include `key` or `index` for nested validations");const c=typeof l=="number";let d=s[l];const u=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}.`:"")+t});return(f,p,h)=>this.resolve(u)._validate(d,u,p,h)}validate(t,r){var s;let n=this.resolve(Object.assign({},r,{value:t})),a=(s=r==null?void 0:r.disableStackTrace)!=null?s:n.spec.disableStackTrace;return new Promise((i,l)=>n._validate(t,r,(c,d)=>{tt.isError(c)&&(c.value=d),l(c)},(c,d)=>{c.length?l(new tt(c,d,void 0,void 0,a)):i(d)}))}validateSync(t,r){var s;let n=this.resolve(Object.assign({},r,{value:t})),a,i=(s=r==null?void 0:r.disableStackTrace)!=null?s:n.spec.disableStackTrace;return n._validate(t,Object.assign({},r,{sync:!0}),(l,c)=>{throw tt.isError(l)&&(l.value=c),l},(l,c)=>{if(l.length)throw new tt(l,t,void 0,void 0,i);a=c}),a}isValid(t,r){return this.validate(t,r).then(()=>!0,s=>{if(tt.isError(s))return!1;throw s})}isValidSync(t,r){try{return this.validateSync(t,r),!0}catch(s){if(tt.isError(s))return!1;throw s}}_getDefault(t){let r=this.spec.default;return r==null?r:typeof r=="function"?r.call(this,t):cr(r)}getDefault(t){return this.resolve(t||{})._getDefault(t)}default(t){return arguments.length===0?this._getDefault():this.clone({default:t})}strict(t=!0){return this.clone({strict:t})}nullability(t,r){const s=this.clone({nullable:t});return s.internalTests.nullable=or({message:r,name:"nullable",test(n){return n===null?this.schema.spec.nullable:!0}}),s}optionality(t,r){const s=this.clone({optional:t});return s.internalTests.optionality=or({message:r,name:"optionality",test(n){return n===void 0?this.schema.spec.optional:!0}}),s}optional(){return this.optionality(!0)}defined(t=jt.defined){return this.optionality(!1,t)}nullable(){return this.nullability(!0)}nonNullable(t=jt.notNull){return this.nullability(!1,t)}required(t=jt.required){return this.clone().withMutation(r=>r.nonNullable(t).defined(t))}notRequired(){return this.clone().withMutation(t=>t.nullable().optional())}transform(t){let r=this.clone();return r.transforms.push(t),r}test(...t){let r;if(t.length===1?typeof t[0]=="function"?r={test:t[0]}:r=t[0]:t.length===2?r={name:t[0],test:t[1]}:r={name:t[0],message:t[1],test:t[2]},r.message===void 0&&(r.message=jt.default),typeof r.test!="function")throw new TypeError("`test` is a required parameters");let s=this.clone(),n=or(r),a=r.exclusive||r.name&&s.exclusiveTests[r.name]===!0;if(r.exclusive&&!r.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return r.name&&(s.exclusiveTests[r.name]=!!r.exclusive),s.tests=s.tests.filter(i=>!(i.OPTIONS.name===r.name&&(a||i.OPTIONS.test===n.OPTIONS.test))),s.tests.push(n),s}when(t,r){!Array.isArray(t)&&typeof t!="string"&&(r=t,t=".");let s=this.clone(),n=bi(t).map(a=>new tr(a));return n.forEach(a=>{a.isSibling&&s.deps.push(a.key)}),s.conditions.push(typeof r=="function"?new ws(n,r):ws.fromOptions(n,r)),s}typeError(t){let r=this.clone();return r.internalTests.typeError=or({message:t,name:"typeError",skipAbsent:!0,test(s){return this.schema._typeCheck(s)?!0:this.createError({params:{type:this.schema.type}})}}),r}oneOf(t,r=jt.oneOf){let s=this.clone();return t.forEach(n=>{s._whitelist.add(n),s._blacklist.delete(n)}),s.internalTests.whiteList=or({message:r,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(t,r=jt.notOneOf){let s=this.clone();return t.forEach(n=>{s._blacklist.add(n),s._whitelist.delete(n)}),s.internalTests.blacklist=or({message:r,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(t=!0){let r=this.clone();return r.spec.strip=t,r}describe(t){const r=(t?this.resolve(t):this).clone(),{label:s,meta:n,optional:a,nullable:i}=r.spec;return{meta:n,label:s,optional:a,nullable:i,default:r.getDefault(t),type:r.type,oneOf:r._whitelist.describe(),notOneOf:r._blacklist.describe(),tests:r.tests.map(c=>({name:c.OPTIONS.name,params:c.OPTIONS.params})).filter((c,d,u)=>u.findIndex(f=>f.name===c.name)===d)}}}nt.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])nt.prototype[`${e}At`]=function(t,r,s={}){const{parent:n,parentPath:a,schema:i}=ru(this,t,r,s.context);return i[e](n&&n[a],Object.assign({},s,{parent:n,path:t}))};for(const e of["equals","is"])nt.prototype[e]=nt.prototype.oneOf;for(const e of["not","nope"])nt.prototype[e]=nt.prototype.notOneOf;const su=()=>!0;function Cn(e){return new yi(e)}class yi extends nt{constructor(t){super(typeof t=="function"?{type:"mixed",check:t}:Object.assign({type:"mixed",check:su},t))}}Cn.prototype=yi.prototype;function wi(){return new ji}class ji extends nt{constructor(){super({type:"boolean",check(t){return t instanceof Boolean&&(t=t.valueOf()),typeof t=="boolean"}}),this.withMutation(()=>{this.transform((t,r,s)=>{if(s.spec.coerce&&!s.isType(t)){if(/^(true|1)$/i.test(String(t)))return!0;if(/^(false|0)$/i.test(String(t)))return!1}return t})})}isTrue(t=En.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"true"},test(r){return bt(r)||r===!0}})}isFalse(t=En.isValue){return this.test({message:t,name:"is-value",exclusive:!0,params:{value:"false"},test(r){return bt(r)||r===!1}})}default(t){return super.default(t)}defined(t){return super.defined(t)}optional(){return super.optional()}required(t){return super.required(t)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(t){return super.nonNullable(t)}strip(t){return super.strip(t)}}wi.prototype=ji.prototype;const nu=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function au(e){const t=An(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(t.z===void 0&&t.plusMinus===void 0)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let r=0;return t.z!=="Z"&&t.plusMinus!==void 0&&(r=t.hourOffset*60+t.minuteOffset,t.plusMinus==="+"&&(r=0-r)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+r,t.second,t.millisecond)}function An(e){var t,r;const s=nu.exec(e);return s?{year:Ct(s[1]),month:Ct(s[2],1)-1,day:Ct(s[3],1),hour:Ct(s[4]),minute:Ct(s[5]),second:Ct(s[6]),millisecond:s[7]?Ct(s[7].substring(0,3)):0,precision:(t=(r=s[7])==null?void 0:r.length)!=null?t:void 0,z:s[8]||void 0,plusMinus:s[9]||void 0,hourOffset:Ct(s[10]),minuteOffset:Ct(s[11])}:null}function Ct(e,t=0){return Number(e)||t}let ou=/^[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])?)*$/,iu=/^((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,lu=/^(?:[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,cu="^\\d{4}-\\d{2}-\\d{2}",du="\\d{2}:\\d{2}:\\d{2}",uu="(([+-]\\d{2}(:?\\d{2})?)|Z)",fu=new RegExp(`${cu}T${du}(\\.\\d+)?${uu}$`),mu=e=>bt(e)||e===e.trim(),hu={}.toString();function lr(){return new ki}class ki extends nt{constructor(){super({type:"string",check(t){return t instanceof String&&(t=t.valueOf()),typeof t=="string"}}),this.withMutation(()=>{this.transform((t,r,s)=>{if(!s.spec.coerce||s.isType(t)||Array.isArray(t))return t;const n=t!=null&&t.toString?t.toString():t;return n===hu?t:n})})}required(t){return super.required(t).withMutation(r=>r.test({message:t||jt.required,name:"required",skipAbsent:!0,test:s=>!!s.length}))}notRequired(){return super.notRequired().withMutation(t=>(t.tests=t.tests.filter(r=>r.OPTIONS.name!=="required"),t))}length(t,r=et.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(s){return s.length===this.resolve(t)}})}min(t,r=et.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(s){return s.length>=this.resolve(t)}})}max(t,r=et.max){return this.test({name:"max",exclusive:!0,message:r,params:{max:t},skipAbsent:!0,test(s){return s.length<=this.resolve(t)}})}matches(t,r){let s=!1,n,a;return r&&(typeof r=="object"?{excludeEmptyString:s=!1,message:n,name:a}=r:n=r),this.test({name:a||"matches",message:n||et.matches,params:{regex:t},skipAbsent:!0,test:i=>i===""&&s||i.search(t)!==-1})}email(t=et.email){return this.matches(ou,{name:"email",message:t,excludeEmptyString:!0})}url(t=et.url){return this.matches(iu,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=et.uuid){return this.matches(lu,{name:"uuid",message:t,excludeEmptyString:!1})}datetime(t){let r="",s,n;return t&&(typeof t=="object"?{message:r="",allowOffset:s=!1,precision:n=void 0}=t:r=t),this.matches(fu,{name:"datetime",message:r||et.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||et.datetime_offset,params:{allowOffset:s},skipAbsent:!0,test:a=>{if(!a||s)return!0;const i=An(a);return i?!!i.z:!1}}).test({name:"datetime_precision",message:r||et.datetime_precision,params:{precision:n},skipAbsent:!0,test:a=>{if(!a||n==null)return!0;const i=An(a);return i?i.precision===n:!1}})}ensure(){return this.default("").transform(t=>t===null?"":t)}trim(t=et.trim){return this.transform(r=>r!=null?r.trim():r).test({message:t,name:"trim",test:mu})}lowercase(t=et.lowercase){return this.transform(r=>bt(r)?r:r.toLowerCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>bt(r)||r===r.toLowerCase()})}uppercase(t=et.uppercase){return this.transform(r=>bt(r)?r:r.toUpperCase()).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:r=>bt(r)||r===r.toUpperCase()})}}lr.prototype=ki.prototype;let pu=e=>e!=+e;function Ni(){return new Si}class Si extends nt{constructor(){super({type:"number",check(t){return t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&!pu(t)}}),this.withMutation(()=>{this.transform((t,r,s)=>{if(!s.spec.coerce)return t;let n=t;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(t,r=Pt.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(s){return s>=this.resolve(t)}})}max(t,r=Pt.max){return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(s){return s<=this.resolve(t)}})}lessThan(t,r=Pt.lessThan){return this.test({message:r,name:"max",exclusive:!0,params:{less:t},skipAbsent:!0,test(s){return s<this.resolve(t)}})}moreThan(t,r=Pt.moreThan){return this.test({message:r,name:"min",exclusive:!0,params:{more:t},skipAbsent:!0,test(s){return s>this.resolve(t)}})}positive(t=Pt.positive){return this.moreThan(0,t)}negative(t=Pt.negative){return this.lessThan(0,t)}integer(t=Pt.integer){return this.test({name:"integer",message:t,skipAbsent:!0,test:r=>Number.isInteger(r)})}truncate(){return this.transform(t=>bt(t)?t:t|0)}round(t){var r;let s=["ceil","floor","round","trunc"];if(t=((r=t)==null?void 0:r.toLowerCase())||"round",t==="trunc")return this.truncate();if(s.indexOf(t.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+s.join(", "));return this.transform(n=>bt(n)?n:Math[t](n))}}Ni.prototype=Si.prototype;let Ei=new Date(""),bu=e=>Object.prototype.toString.call(e)==="[object Date]";function Xn(){return new zr}class zr extends nt{constructor(){super({type:"date",check(t){return bu(t)&&!isNaN(t.getTime())}}),this.withMutation(()=>{this.transform((t,r,s)=>!s.spec.coerce||s.isType(t)||t===null?t:(t=au(t),isNaN(t)?zr.INVALID_DATE:new Date(t)))})}prepareParam(t,r){let s;if(tr.isRef(t))s=t;else{let n=this.cast(t);if(!this._typeCheck(n))throw new TypeError(`\`${r}\` must be a Date or a value that can be \`cast()\` to a Date`);s=n}return s}min(t,r=Sn.min){let s=this.prepareParam(t,"min");return this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(n){return n>=this.resolve(s)}})}max(t,r=Sn.max){let s=this.prepareParam(t,"max");return this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(n){return n<=this.resolve(s)}})}}zr.INVALID_DATE=Ei;Xn.prototype=zr.prototype;Xn.INVALID_DATE=Ei;function gu(e,t=[]){let r=[],s=new Set,n=new Set(t.map(([i,l])=>`${i}-${l}`));function a(i,l){let c=Ht.split(i)[0];s.add(c),n.has(`${l}-${c}`)||r.push([l,c])}for(const i of Object.keys(e)){let l=e[i];s.add(i),tr.isRef(l)&&l.isSibling?a(l.path,i):Ms(l)&&"deps"in l&&l.deps.forEach(c=>a(c,i))}return Gd.array(Array.from(s),r).reverse()}function Ua(e,t){let r=1/0;return e.some((s,n)=>{var a;if((a=t.path)!=null&&a.includes(s))return r=n,!0}),r}function Ci(e){return(t,r)=>Ua(e,t)-Ua(e,r)}const Ai=(e,t,r)=>{if(typeof e!="string")return e;let s=e;try{s=JSON.parse(e)}catch{}return r.isType(s)?s:e};function ps(e){if("fields"in e){const t={};for(const[r,s]of Object.entries(e.fields))t[r]=ps(s);return e.setFields(t)}if(e.type==="array"){const t=e.optional();return t.innerType&&(t.innerType=ps(t.innerType)),t}return e.type==="tuple"?e.optional().clone({types:e.spec.types.map(ps)}):"optional"in e?e.optional():e}const xu=(e,t)=>{const r=[...Ht.normalizePath(t)];if(r.length===1)return r[0]in e;let s=r.pop(),n=Ht.getter(Ht.join(r),!0)(e);return!!(n&&s in n)};let qa=e=>Object.prototype.toString.call(e)==="[object Object]";function Wa(e,t){let r=Object.keys(e.fields);return Object.keys(t).filter(s=>r.indexOf(s)===-1)}const vu=Ci([]);function Ti(e){return new _i(e)}class _i extends nt{constructor(t){super({type:"object",check(r){return qa(r)||typeof r=="function"}}),this.fields=Object.create(null),this._sortErrors=vu,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{t&&this.shape(t)})}_cast(t,r={}){var s;let n=super._cast(t,r);if(n===void 0)return this.getDefault(r);if(!this._typeCheck(n))return n;let a=this.fields,i=(s=r.stripUnknown)!=null?s:this.spec.noUnknown,l=[].concat(this._nodes,Object.keys(n).filter(f=>!this._nodes.includes(f))),c={},d=Object.assign({},r,{parent:c,__validating:r.__validating||!1}),u=!1;for(const f of l){let p=a[f],h=f in n;if(p){let v,x=n[f];d.path=(r.path?`${r.path}.`:"")+f,p=p.resolve({value:x,context:r.context,parent:c});let g=p instanceof nt?p.spec:void 0,m=g==null?void 0:g.strict;if(g!=null&&g.strip){u=u||f in n;continue}v=!r.__validating||!m?p.cast(n[f],d):n[f],v!==void 0&&(c[f]=v)}else h&&!i&&(c[f]=n[f]);(h!==f in c||c[f]!==n[f])&&(u=!0)}return u?c:n}_validate(t,r={},s,n){let{from:a=[],originalValue:i=t,recursive:l=this.spec.recursive}=r;r.from=[{schema:this,value:i},...a],r.__validating=!0,r.originalValue=i,super._validate(t,r,s,(c,d)=>{if(!l||!qa(d)){n(c,d);return}i=i||d;let u=[];for(let f of this._nodes){let p=this.fields[f];!p||tr.isRef(p)||u.push(p.asNestedTest({options:r,key:f,parent:d,parentPath:r.path,originalParent:i}))}this.runTests({tests:u,value:d,originalValue:i,options:r},s,f=>{n(f.sort(this._sortErrors).concat(c),d)})})}clone(t){const r=super.clone(t);return r.fields=Object.assign({},this.fields),r._nodes=this._nodes,r._excludedEdges=this._excludedEdges,r._sortErrors=this._sortErrors,r}concat(t){let r=super.concat(t),s=r.fields;for(let[n,a]of Object.entries(this.fields)){const i=s[n];s[n]=i===void 0?a:i}return r.withMutation(n=>n.setFields(s,[...this._excludedEdges,...t._excludedEdges]))}_getDefault(t){if("default"in this.spec)return super._getDefault(t);if(!this._nodes.length)return;let r={};return this._nodes.forEach(s=>{var n;const a=this.fields[s];let i=t;(n=i)!=null&&n.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[s]})),r[s]=a&&"getDefault"in a?a.getDefault(i):void 0}),r}setFields(t,r){let s=this.clone();return s.fields=t,s._nodes=gu(t,r),s._sortErrors=Ci(Object.keys(t)),r&&(s._excludedEdges=r),s}shape(t,r=[]){return this.clone().withMutation(s=>{let n=s._excludedEdges;return r.length&&(Array.isArray(r[0])||(r=[r]),n=[...s._excludedEdges,...r]),s.setFields(Object.assign(s.fields,t),n)})}partial(){const t={};for(const[r,s]of Object.entries(this.fields))t[r]="optional"in s&&s.optional instanceof Function?s.optional():s;return this.setFields(t)}deepPartial(){return ps(this)}pick(t){const r={};for(const s of t)this.fields[s]&&(r[s]=this.fields[s]);return this.setFields(r,this._excludedEdges.filter(([s,n])=>t.includes(s)&&t.includes(n)))}omit(t){const r=[];for(const s of Object.keys(this.fields))t.includes(s)||r.push(s);return this.pick(r)}from(t,r,s){let n=Ht.getter(t,!0);return this.transform(a=>{if(!a)return a;let i=a;return xu(a,t)&&(i=Object.assign({},a),s||delete i[t],i[r]=n(a)),i})}json(){return this.transform(Ai)}exact(t){return this.test({name:"exact",exclusive:!0,message:t||ms.exact,test(r){if(r==null)return!0;const s=Wa(this.schema,r);return s.length===0||this.createError({params:{properties:s.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(t=!0,r=ms.noUnknown){typeof t!="boolean"&&(r=t,t=!0);let s=this.test({name:"noUnknown",exclusive:!0,message:r,test(n){if(n==null)return!0;const a=Wa(this.schema,n);return!t||a.length===0||this.createError({params:{unknown:a.join(", ")}})}});return s.spec.noUnknown=t,s}unknown(t=!0,r=ms.noUnknown){return this.noUnknown(!t,r)}transformKeys(t){return this.transform(r=>{if(!r)return r;const s={};for(const n of Object.keys(r))s[t(n)]=r[n];return s})}camelCase(){return this.transformKeys(Xs.camelCase)}snakeCase(){return this.transformKeys(Xs.snakeCase)}constantCase(){return this.transformKeys(t=>Xs.snakeCase(t).toUpperCase())}describe(t){const r=(t?this.resolve(t):this).clone(),s=super.describe(t);s.fields={};for(const[a,i]of Object.entries(r.fields)){var n;let l=t;(n=l)!=null&&n.value&&(l=Object.assign({},l,{parent:l.value,value:l.value[a]})),s.fields[a]=i.describe(l)}return s}}Ti.prototype=_i.prototype;function Tn(e){return new Fi(e)}class Fi extends nt{constructor(t){super({type:"array",spec:{types:t},check(r){return Array.isArray(r)}}),this.innerType=void 0,this.innerType=t}_cast(t,r){const s=super._cast(t,r);if(!this._typeCheck(s)||!this.innerType)return s;let n=!1;const a=s.map((i,l)=>{const c=this.innerType.cast(i,Object.assign({},r,{path:`${r.path||""}[${l}]`}));return c!==i&&(n=!0),c});return n?a:s}_validate(t,r={},s,n){var a;let i=this.innerType,l=(a=r.recursive)!=null?a:this.spec.recursive;r.originalValue!=null&&r.originalValue,super._validate(t,r,s,(c,d)=>{var u;if(!l||!i||!this._typeCheck(d)){n(c,d);return}let f=new Array(d.length);for(let h=0;h<d.length;h++){var p;f[h]=i.asNestedTest({options:r,index:h,parent:d,parentPath:r.path,originalParent:(p=r.originalValue)!=null?p:t})}this.runTests({value:d,tests:f,originalValue:(u=r.originalValue)!=null?u:t,options:r},s,h=>n(h.concat(c),d))})}clone(t){const r=super.clone(t);return r.innerType=this.innerType,r}json(){return this.transform(Ai)}concat(t){let r=super.concat(t);return r.innerType=this.innerType,t.innerType&&(r.innerType=r.innerType?r.innerType.concat(t.innerType):t.innerType),r}of(t){let r=this.clone();if(!Ms(t))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+Tt(t));return r.innerType=t,r.spec=Object.assign({},r.spec,{types:t}),r}length(t,r=hs.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(s){return s.length===this.resolve(t)}})}min(t,r){return r=r||hs.min,this.test({message:r,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(s){return s.length>=this.resolve(t)}})}max(t,r){return r=r||hs.max,this.test({message:r,name:"max",exclusive:!0,params:{max:t},skipAbsent:!0,test(s){return s.length<=this.resolve(t)}})}ensure(){return this.default(()=>[]).transform((t,r)=>this._typeCheck(t)?t:r==null?[]:[].concat(r))}compact(t){let r=t?(s,n,a)=>!t(s,n,a):s=>!!s;return this.transform(s=>s!=null?s.filter(r):s)}describe(t){const r=(t?this.resolve(t):this).clone(),s=super.describe(t);if(r.innerType){var n;let a=t;(n=a)!=null&&n.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[0]})),s.innerType=r.innerType.describe(a)}return s}}Tn.prototype=Fi.prototype;function yu(e){return e.validation??{}}function wu(e){return!!e.multiple}function Qs(e){const t=e.maxFiles;return typeof t=="number"?t:void 0}function At(e,t){return t.required?e.required(t.requiredMessage||"Requerido"):e}function ss(e,t){var s,n,a;let r=e;return((s=t.minLength)==null?void 0:s.value)!=null&&(r=r.min(t.minLength.value,t.minLength.message||`Mín. ${t.minLength.value} caracteres`)),((n=t.maxLength)==null?void 0:n.value)!=null&&(r=r.max(t.maxLength.value,t.maxLength.message||`Máx. ${t.maxLength.value} caracteres`)),((a=t.pattern)==null?void 0:a.value)instanceof RegExp&&(r=r.matches(t.pattern.value,t.pattern.message||"Formato inválido")),r}function ju(e){var r;const t=yu(e);switch(e.type){case"text":case"password":{let s=lr().trim();return s=ss(s,t),At(s,t)}case"email":{let s=lr().trim().email(t.emailMessage||"Email inválido");return s=ss(s,t),At(s,t)}case"number":{let s=Ni().transform((n,a)=>a===""||a===null?void 0:n).typeError(t.typeError||"Debe ser un número");return((r=t.pattern)==null?void 0:r.value)instanceof RegExp&&(s=s.test("pattern-number",t.pattern.message||"Formato inválido",n=>n==null||t.pattern.value.test(String(n)))),At(s,t)}case"select":{if(wu(e)){const n=Tn().of(lr());return At(n,t)}let s=lr().trim();return s=ss(s,t),At(s,t)}case"checkbox":{let s=wi();return t.required&&(s=s.oneOf([!0],t.requiredMessage||"Debes marcar esta casilla")),s}case"textarea":{let s=lr().trim();return s=ss(s,t),At(s,t)}case"date":{const s=Xn().typeError(t.typeError||"Fecha inválida").transform((n,a)=>a?new Date(a):void 0);return At(s,t)}case"file":{const s=Tn().of(Cn()).test("max-files",Qs(e)?`Máx. ${Qs(e)} fichero(s)`:"Número de ficheros inválido",n=>{const a=Qs(e);return!Array.isArray(n)||!a||n.length<=a});return At(s,t)}default:{const s=Cn();return At(s,t)}}}function Oi(e){const t={};for(const r of e.fields){const s=r;s.name&&(t[s.name]=ju(s))}return Ti(t)}function Ir({options:e,value:t,onChange:r,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=e.findIndex(g=>g.value===t);if(d<0)return;const u=l.children[d],f=u.querySelector("span"),p=(f==null?void 0:f.offsetWidth)??u.offsetWidth,h=u.offsetWidth,x=u.offsetLeft+(h-p)/2;i({left:x,width:p})};return c(),window.addEventListener("resize",c),l.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),l.removeEventListener("scroll",c)}},[t,e]),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:e.map(l=>{const c=l.value===t;return o.jsx("li",{role:"tab","aria-selected":c,onClick:()=>r(l.value),className:se("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[t]})]})}const ns={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},Ka={sm:"h-6",md:"h-10",lg:"h-12"},Ga={sm:"px-2",md:"px-2.5",lg:"px-3"},Ja={sm:"1.5rem",md:"2.5rem",lg:"3rem"};function Za({id:e,size:t,disabled:r,error:s,reserveErrorSpace:n,className:a,suffixButton:i,children:l}){return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"relative flex items-center w-full",children:[l,i&&o.jsx("div",{className:"flex items-center h-full pr-2",children:i})]}),n?o.jsx("div",{className:"min-h-[18px] w-full",children:s!=null&&s.message?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:s.message}):o.jsx("span",{"aria-hidden":"true",children:" "})}):s!=null&&s.message?o.jsx("div",{className:"pt-1",children:o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:s.message})}):null]})}function rt(e){const{control:t,name:r,rules:s,defaultValue:n,options:a=[],loadOptions:i,reloadDeps:l=[],value:c,onChange:d,size:u="sm",width:f="100%",label:p,labelHidden:h=!1,hasError:v=!1,errorMessage:x="",reserveErrorSpace:g,disableErrorPlaceholder:m,disabled:w=!1,className:y,suffixButton:T,loading:N=!1,coerceFirstValid:_=!0}=e,A=b.useId(),S=r||A,[$,V]=b.useState(a),[z,q]=b.useState(!!i);b.useEffect(()=>{i&&(q(!0),i().then(E=>V(E)).finally(()=>q(!1)))},[i,...l]);const D=E=>E.find(te=>te.value!==""&&te.value!==void 0)??E[0],P=typeof g=="boolean"?g:!!t;if(t&&r){const{field:E,fieldState:te}=ri({name:r,control:t,rules:s,defaultValue:n});return b.useEffect(()=>{if(!z&&$.length>0&&_){const ne=E.value,K=$.some(le=>String(le.value)===String(ne));(ne===void 0||!K)&&E.onChange(D($).value)}},[$,z,E,_]),o.jsxs("div",{className:se("flex flex-col",y),style:{width:f,maxWidth:"100%"},children:[p&&o.jsx("label",{htmlFor:S,className:se("pb-2 text-[var(--color-ds-text-primary)]",ns[u],h&&"sr-only"),children:p}),N||z?o.jsx(Xt,{width:"100%",height:Ja[u],variant:"rect",className:"rounded-lg"}):o.jsx(Za,{id:S,size:u,disabled:w,error:te.error,reserveErrorSpace:typeof m=="boolean"?!m:P,className:y,suffixButton:T,children:o.jsx("select",{id:S,value:E.value,onChange:ne=>E.onChange(ne.target.value),disabled:w,className:se("box-border w-full rounded-lg border bg-[var(--color-ds-background-page)] outline-none transition font-[var(--font-primary)]",ns[u],Ka[u],Ga[u],te.error?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",w?"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)]",y),children:$.map(ne=>o.jsx("option",{value:ne.value,className:"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",children:ne.label},ne.value))})})]})}return b.useEffect(()=>{if(!t&&$.length>0&&_){const E=$.some(ne=>String(ne.value)===String(c));(c===void 0||c===""||!E)&&d&&d(D($).value)}},[$,c,d,t,_]),o.jsxs("div",{className:se("flex flex-col",y),style:{width:f,maxWidth:"100%"},children:[p&&o.jsx("label",{htmlFor:S,className:se("pb-2 text-[var(--color-ds-text-primary)]",ns[u],h&&"sr-only"),children:p}),N||z?o.jsx(Xt,{width:"100%",height:Ja[u],variant:"rect",className:"rounded-lg"}):o.jsx(Za,{id:S,size:u,disabled:w,error:v?{message:x}:void 0,reserveErrorSpace:typeof m=="boolean"?!m:!!(g??!1),className:y,suffixButton:T,children:o.jsx("select",{id:S,value:c,onChange:E=>d==null?void 0:d(E.target.value),disabled:w,className:se("box-border w-full rounded-lg border bg-[var(--color-ds-background-page)] outline-none transition font-[var(--font-primary)]",ns[u],Ka[u],Ga[u],v?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",w?"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)]",y),children:$.map(E=>o.jsx("option",{value:E.value,className:"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",children:E.label},E.value))})})]})}const Ya={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"};function Ri({groupLabel:e,inputs:t=[],separator:r=o.jsx("span",{className:"px-1 select-none",children:"/"}),useSeparator:s=!0,className:n,showVisibleLabel:a=!1,size:i="sm",width:l}){const c=t.length;return o.jsxs("div",{className:se("flex flex-col",n),style:l?{width:l}:void 0,children:[o.jsx("label",{className:se("sr-only pb-2",Ya[i]),children:e}),a&&o.jsx("label",{className:se("pb-2",Ya[i]),children:e}),o.jsx("div",{className:"flex items-center flex-nowrap",children:t.map((d,u)=>{const{width:f,className:p,options:h,loadOptions:v,...x}=d,g=Array.isArray(h)||typeof v=="function";let m="rounded-lg";!s&&c>1&&(u===0?m="rounded-l-lg rounded-r-none":u===c-1?m="rounded-r-lg rounded-l-none !rounded-l-none":m="rounded-none !rounded-l-none !rounded-r-none");const w=[],y=typeof f=="string"&&f.split(/\s+/).some(A=>A.startsWith("w-")||A.includes(":w-")),T=se("inline-flex items-center flex-shrink-0",typeof f=="string"&&y?f:void 0,!s&&c>1&&u>0?"-ml-px focus-within:z-10 relative":void 0),N=typeof f=="string"&&!y?{width:f}:void 0,_=se(p,m,w);return o.jsxs("div",{className:T,style:N,children:[g?o.jsx(rt,{...x,size:i,className:_,options:h,loadOptions:v}):o.jsx(we,{...x,size:i,className:_}),s&&u<c-1&&r]},u)})})]})}const Ha={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},ku={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function Di({groupLabel:e,options:t,control:r,name:s,rules:n,defaultValue:a,multiple:i=!0,size:l="sm",vertical:c=!0,className:d,showVisibleLabel:u=!0}){return o.jsx(gt,{name:s,control:r,rules:n,defaultValue:a,render:({field:f,fieldState:p})=>{const{value:h,onChange:v}=f;p.error;const x=m=>i?Array.isArray(h)&&h.includes(m):h===m,g=m=>{if(i){const w=Array.isArray(h)?[...h]:[],y=w.indexOf(m);y>=0?w.splice(y,1):w.push(m),v(w)}else v(m)};return o.jsxs("div",{className:se("w-full",d),children:[o.jsx("label",{className:se("sr-only pb-2 text-[var(--color-ds-text-primary)]",Ha[l]),children:e}),u&&o.jsx("label",{className:se("block pb-2 text-[var(--color-ds-text-primary)]",Ha[l]),children:e}),o.jsx("div",{className:se(c?"flex flex-col gap-2":"flex flex-wrap gap-4"),children:t.map(m=>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:m.value,checked:x(m.value),onChange:()=>g(m.value),className:se(ku[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:m.label})]},m.value))})]})}})}function Nu(e){function t(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 u=t(i[d]);if(u)return`${d}.${u}`}}return null}const r=t(e);if(!r)return;const s=`[name="${r}"]`,n=`[name^="${r}["], [name^="${r}."]`,a=document.querySelector(s)??document.querySelector(n);a&&(a.scrollIntoView({behavior:"smooth",block:"center"}),a.focus({preventScroll:!0}))}const Su={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"},Mi=({id:e,message:t,variant:r="info",duration:s=5e3,onClose:n})=>(b.useEffect(()=>{const a=setTimeout(()=>n(e),s);return()=>clearTimeout(a)},[e,s,n]),o.jsxs("div",{className:se("w-80 max-w-full border-l-4 rounded shadow-md p-4 mb-2 flex justify-between items-start",Su[r]),role:"alert","aria-live":"assertive",children:[o.jsx("span",{className:"flex-1",children:t}),o.jsx("button",{onClick:()=>n(e),className:"ml-4 text-xl font-bold leading-none focus:outline-none",children:"×"})]}));let as;const Eu=new Uint8Array(16);function Cu(){if(!as&&(as=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!as))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return as(Eu)}const Ue=[];for(let e=0;e<256;++e)Ue.push((e+256).toString(16).slice(1));function Au(e,t=0){return Ue[e[t+0]]+Ue[e[t+1]]+Ue[e[t+2]]+Ue[e[t+3]]+"-"+Ue[e[t+4]]+Ue[e[t+5]]+"-"+Ue[e[t+6]]+Ue[e[t+7]]+"-"+Ue[e[t+8]]+Ue[e[t+9]]+"-"+Ue[e[t+10]]+Ue[e[t+11]]+Ue[e[t+12]]+Ue[e[t+13]]+Ue[e[t+14]]+Ue[e[t+15]]}const Tu=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Xa={randomUUID:Tu};function _u(e,t,r){if(Xa.randomUUID&&!e)return Xa.randomUUID();e=e||{};const s=e.random||(e.rng||Cu)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Au(s)}const $i=b.createContext(null),Vr=()=>{const e=b.useContext($i);if(!e)throw new Error("useToast debe usarse dentro de <ToastProvider>");return e},Fu=({children:e})=>{const[t,r]=b.useState([]),s=(a,i="info",l=5e3)=>{const c=_u();r(d=>[...d,{id:c,message:a,variant:i,duration:l}])},n=a=>{r(i=>i.filter(l=>l.id!==a))};return o.jsxs($i.Provider,{value:{show:s},children:[e,o.jsx("div",{className:"fixed top-4 right-4 z-50 flex flex-col items-end",children:t.map(a=>o.jsx(Mi,{id:a.id,message:a.message,variant:a.variant,duration:a.duration,onClose:n},a.id))})]})},Ou=e=>e.type==="inputGroup",Ru=e=>e.type==="button",Du=e=>!Ou(e)&&!Ru(e);function Mu(e){const t=Array.isArray(e)?e:[];return b.useMemo(()=>{const r={};for(const s of t)Du(s)&&s.name&&(r[s.name]=s);return r},[t])}const Li=b.createContext(null);function $u({children:e,value:t}){return o.jsx(Li.Provider,{value:t,children:e})}function $s(){const e=b.useContext(Li);if(!e)throw new Error("useAdapters debe usarse dentro de <AdaptersProvider />");return e}const Lu=e=>!!e&&typeof e.then=="function";function Pu(e){return Array.isArray(e)?e.length>0&&typeof e[0]=="object"&&e[0]!==null?e.map(t=>{var n;if("label"in t&&"value"in t)return t;const s=(n=Object.entries(t)[0])==null?void 0:n[1];return{label:String(s??JSON.stringify(t)),value:String(s??"")}}):e.map(t=>({label:String(t),value:t})):[]}function zu(e){const{services:t}=$s(),[r,s]=b.useState({}),[n,a]=b.useState(0),i=b.useRef(!0);b.useEffect(()=>(i.current=!0,()=>{i.current=!1}),[]);const l=b.useMemo(()=>e.filter(c=>c.type==="select"&&!c.options&&typeof c.optionSource=="string"&&c.name),[e]);return b.useEffect(()=>{if(l.length===0)return;let c=!1;return(async()=>{a(d=>d+1);try{const d=await Promise.all(l.map(async u=>{var g;const f=u.name,p=u.optionSource,h=(g=t==null?void 0:t.registry)==null?void 0:g[p];if(!h)return[f,[]];const v=Lu(h)?await h:await h(),x=Pu(v);return[f,x]}));if(c||!i.current)return;s(u=>{const f={...u};for(const[p,h]of d)f[p]=[...h];return f})}finally{!c&&i.current&&a(d=>Math.max(0,d-1))}})(),()=>{c=!0}},[l,t==null?void 0:t.registry]),{optionsMap:r,loadingCount:n}}const Iu=e=>e.type==="inputGroup",Vu=e=>e.type==="button",Bu=e=>!Iu(e)&&!Vu(e);function Uu(e){return typeof e=="object"&&e!==null}const qu=e=>{const t=e.disabledWhen;if(!Uu(t))return!1;const r="watchField"in t,s="rule"in t;return r&&!s};function Wu(e,t){const r=Array.isArray(e)?e:[],s=b.useMemo(()=>r.filter(Bu).filter(qu),[r]),n=b.useMemo(()=>s.map(c=>c.disabledWhen.watchField),[s]),a=Kn({control:t,...n.length>0?{name:n}:{}}),i=Array.isArray(a)?a:[],l={};return s.forEach((c,d)=>{const u=i[d];l[c.name??`__unnamed_${d}`]=u===c.disabledWhen.watchValue}),l}const Qa={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},Ku={sm:"px-2 py-1",md:"px-3 py-2",lg:"px-4 py-3"};function Ls({control:e,name:t,rules:r,defaultValue:s,size:n="sm",width:a="100%",label:i,labelHidden:l=!1,hasError:c=!1,errorMessage:d="",maxLength:u,showCounter:f=!1,className:p,suffixButton:h,...v}){const x=b.useId(),g=t||x,[m,w]=b.useState(s||"");if(e&&t)return o.jsx(gt,{name:t,control:e,rules:r,defaultValue:s||"",render:({field:T,fieldState:N})=>{var _;return o.jsx(Ls,{...v,size:n,width:a,label:i,labelHidden:l,hasError:!!N.error,errorMessage:((_=N.error)==null?void 0:_.message)||"",maxLength:u,showCounter:f,className:p,suffixButton:h,value:T.value,onChange:T.onChange})}});b.useEffect(()=>{w(s||"")},[s]);const y=T=>{var N;u!==void 0&&T.target.value.length>u||(w(T.target.value),(N=v.onChange)==null||N.call(v,T))};return o.jsxs("div",{className:se("flex flex-col",p),style:{width:a},children:[i&&o.jsx("label",{htmlFor:g,className:se("pb-2 text-[var(--color-ds-text-primary)]",Qa[n],l&&"sr-only"),children:i}),o.jsxs("div",{className:"flex items-stretch gap-2",children:[o.jsx("textarea",{id:g,className:se("box-border bg-[var(--color-ds-background-page)] w-full resize vertical rounded-lg border outline-none transition font-[var(--font-primary)]",Qa[n],Ku[n],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:m,onChange:y,maxLength:u,...v}),h?o.jsx("div",{className:"shrink-0",children:h}):null]}),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:" "}),f&&u!==void 0&&o.jsxs("span",{className:"text-xs text-[var(--color-ds-text-secondary)]",children:[m.length,"/",u]})]})]})}const Gu={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function dt({control:e=null,name:t,rules:r,defaultValue:s=!1,label:n,labelHidden:a=!1,disabled:i=!1,size:l="sm",className:c,hasError:d=!1,errorMessage:u="",checked:f,onChange:p}){const h=se(Gu[l],"text-[var(--color-ds-button-primary-bg)]","border-[var(--color-ds-border-default)]",i&&"opacity-50 cursor-not-allowed"),v=se("text-[var(--color-ds-text-primary)] text-ds-md",i&&"text-[var(--color-ds-text-secondary)]",a&&"sr-only");return e?o.jsx("div",{className:se("flex flex-col",c),children:o.jsx(gt,{name:t||"",control:e,rules:r,defaultValue:s,render:({field:x,fieldState:g})=>{const m=g.error;return o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"flex items-center space-x-2",children:[o.jsx("input",{id:t,type:"checkbox",className:h,checked:!!x.value,onChange:w=>x.onChange(w.target.checked),disabled:i}),n&&o.jsx("span",{className:v,children:n})]}),(d||m)&&((m==null?void 0:m.message)||u)&&o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:(m==null?void 0:m.message)||u})]})}})}):o.jsxs("div",{className:se("flex flex-col",c),children:[o.jsxs("label",{className:"flex items-center space-x-2",children:[o.jsx("input",{id:t,type:"checkbox",className:h,checked:!!f,onChange:x=>p==null?void 0:p(x.target.checked),disabled:i}),n&&o.jsx("span",{className:v,children:n})]}),d&&!!u&&o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:u})]})}function Pi({name:e,control:t,searchFn:r,resolveByValue:s,label:n,size:a="sm",width:i="100%",disabled:l=!1,searchMode:c="button",minChars:d=3,debounceMs:u=600}){const f=Pr(),{watch:p,getValues:h,setValue:v}=f,x=Kn({control:t,name:e}),[g,m]=b.useState([]),[w,y]=b.useState(!1),[T,N]=b.useState(!1),[_,A]=b.useState(""),S=b.useRef(null),$=b.useRef(null),V=b.useRef(!1),z=b.useRef(!1),q=b.useRef(!0),D=b.useMemo(()=>{const K=new Map;for(const le of g)K.set(String(le.value).trim(),le.label??"");return K},[g]),P=async K=>{const le=(K??"").trim();if(!le){m([]),N(!1);return}y(!0);try{const C=await r(le,{watch:p,getValues:h});m(C??[]),N(!0)}finally{y(!1)}};b.useEffect(()=>{function K(le){S.current&&!S.current.contains(le.target)&&N(!1)}if(T)return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[T]),b.useEffect(()=>{if(V.current)return;const le=(x?String(x):"").trim();if(!le){A(""),N(!1);return}const C=D.get(le);if(C){A(C),N(!1),q.current=!0;return}let k=!1;return(async()=>{if(s)try{const I=await s(le,{watch:p,getValues:h});k||(A((I==null?void 0:I.label)??le),N(!1),q.current=!0)}catch{k||(A(le),N(!1),q.current=!0)}else A(le),N(!1),q.current=!0})(),()=>{k=!0}},[x,D,s,p,h]),b.useEffect(()=>{if(c!=="debounced"||l)return;if(q.current){q.current=!1;return}if(!z.current)return;$.current&&(window.clearTimeout($.current),$.current=null);const K=(_||"").trim();return K.length>=d?$.current=window.setTimeout(()=>{P(K)},u):(m([]),N(!1)),()=>{$.current&&(window.clearTimeout($.current),$.current=null)}},[_,c,d,u,l]);const E=a==="sm"?"text-ds-sm":a==="md"?"text-ds-md":"text-ds-lg",te=a==="sm"?"h-6":a==="md"?"h-10":"h-12",ne=K=>{if(l)return;const le=(_||"").trim();K.key==="Enter"&&(K.preventDefault(),c==="debounced"?le.length>=d&&P(le):P(le)),K.key==="Escape"&&N(!1)};return o.jsx(gt,{name:e,control:t,render:({field:K,fieldState:le})=>{var C;return o.jsxs("div",{ref:S,className:"relative flex flex-col",style:{width:i},children:[n&&o.jsx("label",{className:`pb-2 text-[var(--color-ds-text-primary)] ${E}`,children:n}),o.jsx(we,{className:c==="button"?"rounded-r-none":void 0,type:"text",size:a,width:"100%",value:_,onChange:k=>{const I=k.target.value;V.current=!0,z.current=!0,A(I),(x?String(x):"").trim()&&v(e,"",{shouldDirty:!0})},onKeyDown:ne,onBlur:()=>{V.current=!1},disabled:l,hasError:le.invalid,errorMessage:(C=le.error)==null?void 0:C.message,onFocus:()=>{if(V.current=!0,c==="button"&&z.current){const k=(_||"").trim();k&&P(k)}},suffixButton:c==="button"?o.jsx(ie,{type:"button",className:"!rounded-l-none",size:a,variant:"primary",onClick:()=>P((_||"").trim()),disabled:l,children:"Buscar"}):void 0}),w&&o.jsx("div",{className:"absolute top-14 left-0 right-0 z-10",children:o.jsx(Xt,{width:"100%",height:a==="sm"?"1.5rem":a==="md"?"2.5rem":"3rem",variant:"rect",className:"rounded-lg"})}),T&&!w&&g.length>0&&o.jsx("ul",{className:`
30
30
  absolute top-14 left-0 right-0
31
31
  border-[var(--color-ds-border-default)]
32
32
  rounded-lg bg-[var(--color-ds-background-page)]
33
33
  shadow-lg ${E} max-h-48 overflow-auto z-10
34
- `,children:x.map(k=>o.jsx("li",{className:`px-2 ${te} flex items-center cursor-pointer
34
+ `,children:g.map(k=>o.jsx("li",{className:`px-2 ${te} flex items-center cursor-pointer
35
35
  text-[var(--color-ds-text-primary)]
36
- hover:bg-[var(--color-ds-background-surface)]`,onClick:()=>{const I=String(k.value).trim();v(e,I,{shouldDirty:!0,shouldValidate:!0}),A(k.label??I),V.current=!1,z.current=!1,N(!1)},children:k.label},String(k.value)))})]})}})}const Nr=(e,t)=>e[t],Qa=e=>e instanceof Date?e.getTime():e;function Gu(e,t,r){const s=Qa(e),n=Qa(t);return typeof s=="number"&&typeof n=="number"||typeof s=="string"&&typeof n=="string"?r==="gt"?s>n:r==="gte"?s>=n:r==="lt"?s<n:s<=n:!1}function js(e,t){if(!e)return!1;switch(e.op){case"eq":return Nr(t,e.field)===e.value;case"neq":return Nr(t,e.field)!==e.value;case"in":return e.values.includes(Nr(t,e.field));case"notIn":return!e.values.includes(Nr(t,e.field));case"gt":case"gte":case"lt":case"lte":return Gu(Nr(t,e.field),e.value,e.op);case"and":return e.rules.every(r=>js(r,t));case"or":return e.rules.some(r=>js(r,t));default:return!1}}function eo(e){if(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return}if(typeof e=="object")return e}}function Ju(e,t){var r;return Array.isArray(e)?e.length&&typeof e[0]=="object"&&"value"in e[0]?t?e.map(s=>s.value):((r=e[0])==null?void 0:r.value)??"":t?e:e[0]??"":e&&typeof e=="object"&&"value"in e?e.value:e??(t?[]:"")}const Zu=e=>e.type!=="inputGroup"&&e.type!=="button";function Pi({schema:e,resolver:t}){const{layout:r,fields:s=[],onSubmit:n,successMessage:a,errorMessage:i,footerButtons:l,defaultValues:c,loadDefaultValues:d,validationSchema:u}=e,{show:f}=Ir(),{t:h}=Jn(),{services:p}=Ms(),v=b.useMemo(()=>{if(t)return t;try{const C=u??Fi(e);return hi(C)}catch{return}},[t,e,u]),g=pd({resolver:v,mode:"onBlur",reValidateMode:"onChange",defaultValues:c??{}});b.useEffect(()=>{const C=e.defaultSource;if(!C)return;let k=!1;return(async()=>{var I;try{const U=(I=p==null?void 0:p.registry)==null?void 0:I[C];if(!U)return;const G=typeof U=="function"?await U():U;!k&&G&&typeof G=="object"&&g.reset({...e.defaultValues??{},...G})}catch{}})(),()=>{k=!0}},[e,p==null?void 0:p.registry,g.reset]);const{control:x,reset:m,handleSubmit:w,formState:{errors:y,isSubmitting:T}}=g,[N,_]=b.useState(!1);b.useEffect(()=>{d&&(_(!0),d().then(C=>m(C)).finally(()=>_(!1)))},[d,m]);const A=b.useMemo(()=>(s??[]).filter(Zu),[s]),{loadingCount:S,optionsMap:$}=Pu(A),[V,z]=b.useState({});b.useEffect(()=>{let C=!0;return(async()=>{const I=await Promise.all(A.filter(G=>G.type==="select"&&G.optionSource).map(async G=>{var be;const ee=G.name,M=G.optionSource,W=eo(G.adapterCtx??G.optionAdapterCtx),me=(be=p==null?void 0:p.registry)==null?void 0:be[M];if(typeof me!="function")return[ee,[]];try{const de=await Promise.resolve(me("",{getValues:g.getValues,watch:g.watch,ctx:W})),ke=Array.isArray(de)?de:[];return[ee,ke]}catch{return[ee,[]]}}));if(!C)return;const U={};for(const[G,ee]of I)U[G]=ee;z(U)})(),()=>{C=!1}},[p==null?void 0:p.registry,g.getValues,g.watch,JSON.stringify(A.map(C=>({n:C.name,os:C.optionSource??null,ctx:C.adapterCtx??C.optionAdapterCtx??null,staticLen:Array.isArray(C.options)?C.options.length:-1})))]),b.useEffect(()=>{let C=!0;return(async()=>{var I;for(const U of A){if(U.type!=="select")continue;const G=U.name,ee=U.defaultSource;if(!ee)continue;const M=g.getValues(G);if(!(M==null||(Array.isArray(M)?M.length===0:M==="")))continue;const me=(I=p==null?void 0:p.registry)==null?void 0:I[ee];if(typeof me=="function")try{const be=eo(U.adapterCtx??U.optionAdapterCtx),de=await Promise.resolve(me("",{getValues:g.getValues,watch:g.watch,ctx:be}));if(!C)return;const ke=Ju(de,!!U.multiple);g.setValue(G,ke,{shouldDirty:!0,shouldTouch:!0})}catch{}}})(),()=>{C=!1}},[p==null?void 0:p.registry,g.getValues,g.setValue,JSON.stringify(A.map(C=>({n:C.name,ds:C.defaultSource??null,mult:!!C.multiple})))]);const q=Du(s),D=qu(s,x),P=b.useMemo(()=>{const C={};return r.forEach((k,I)=>{k.type==="tabs"&&(C[I]=k.tabs[0].key)}),C},[r]),[E,te]=b.useState(P),ne=b.useCallback((C,k)=>{if(!(C!=null&&C.enabled)||!C.rule)return k;try{return!!js(C.rule,g.getValues())}catch{return k}},[g]),K=b.useMemo(()=>s.map(C=>C).filter(C=>{var k;return((k=C.clearWhen)==null?void 0:k.enabled)&&C.clearWhen.rule}).map(C=>({name:C.name,rule:C.clearWhen.rule,clearTo:C.clearWhen.clearTo})),[s]);b.useEffect(()=>{if(!K.length)return;const C=I=>{K.forEach(({name:U,rule:G,clearTo:ee})=>{try{if(!!js(G,I)){const W=ee??"";I[U]!==W&&g.setValue(U,W,{shouldDirty:!0,shouldValidate:!0})}}catch{}})};C(g.getValues());const k=g.watch(()=>C(g.getValues()));return()=>{var I;return(I=k==null?void 0:k.unsubscribe)==null?void 0:I.call(k)}},[g,K]);const le=b.useCallback(C=>{var de,ke,ge,he;let k;if(typeof C=="string"){if(k=q[C],!k){const fe=(s??[]).find(pe=>(pe==null?void 0:pe.name)===C);if(fe)k=fe;else return null}}else k=C;const I=k.visibleWhen;if(!ne(I,!0))return null;let G=!!k.disabled;const ee=k.disabledWhen,M=ne(ee,!1);if(ee!=null&&ee.enabled&&(G=M),!(ee!=null&&ee.enabled)&&"name"in k&&k.name&&D[k.name]&&(G=!0),k.type==="search"){const fe=typeof k.searchFn=="function",pe=k.searchSource,ye=async Se=>{var Te;if(fe)return k.searchFn(Se,{getValues:g.getValues,watch:g.watch});if(pe){const j=(Te=p==null?void 0:p.registry)==null?void 0:Te[pe];if(typeof j=="function")return await j(Se,{getValues:g.getValues,watch:g.watch});if(Array.isArray(j))return j}return[]},ce={};return k.searchMode&&(ce.searchMode=k.searchMode),k.minChars&&(ce.minChars=k.minChars),k.debounceMs&&(ce.debounceMs=k.debounceMs),k.resolveByValue&&(ce.resolveByValue=k.resolveByValue),o.jsx(Li,{name:k.name,control:x,searchFn:ye,label:k.label,size:k.size,width:k.width,disabled:G||T,...ce},k.name)}if(k.type==="inputGroup"){const fe=k,pe=(fe.inputs??[]).map(ye=>{var R;const ce=typeof ye=="string"?q[ye]??(s??[]).find(X=>(X==null?void 0:X.name)===ye):ye;if(!ce)return null;const Se=ce.disabledWhen;let Te=!!ce.disabled;const j=ne(Se,!1);Se!=null&&Se.enabled&&(Te=j),!(Se!=null&&Se.enabled)&&D[ce.name]&&(Te=!0);const F={name:ce.name,control:x,label:ce.label,size:ce.size,width:ce.width,placeholder:ce.placeholder,hasError:!!y[ce.name],errorMessage:((R=y[ce.name])==null?void 0:R.message)||"",loading:N,disabled:Te||T,suffixButton:ce.suffixButton,reserveErrorSpace:!0};return ce.type==="select"?{...F,options:ce.options??V[ce.name]??$[ce.name]??[],loadOptions:ce.options||ce.optionSource?void 0:ce.loadOptions}:{...F,type:ce.type}}).filter(Boolean);return o.jsx(Oi,{groupLabel:fe.groupLabel,inputs:pe,separator:fe.separator,useSeparator:fe.useSeparator,className:fe.className,showVisibleLabel:fe.showVisibleLabel,size:fe.size},`inputGroup_${fe.name??fe.groupLabel??"group"}`)}if(k.type==="button"){const fe=k;return o.jsx("div",{className:"self-center",children:o.jsx(ie,{type:"button",variant:fe.variant,size:fe.size,width:fe.width,icon:fe.icon,iconPosition:fe.iconPosition,ariaLabel:fe.ariaLabel,onClick:fe.onClick,disabled:G||T,children:fe.label})},fe.name)}const W=k.suffixButton,me=typeof W=="string"?le(W):W,be={name:k.name,control:x,disabled:G||T,label:k.label,size:k.size,width:k.width,placeholder:k.placeholder,info:k.info,suffixButton:me};switch(k.type){case"select":{const fe=k.name,pe=k.options??V[fe]??$[fe]??[],ye=Array.isArray(pe)&&pe.length?`${pe.length}:${pe.map(Se=>String((Se==null?void 0:Se.value)??"")).join("|")}`:"0",ce=!k.options&&!k.optionSource&&k.loadOptions;return o.jsx(gt,{name:fe,control:x,render:({field:Se})=>{var Te;return o.jsx(rt,{...be,value:Se.value,onChange:Se.onChange,options:pe,loadOptions:ce||void 0,hasError:!!y[fe],errorMessage:(Te=y[fe])==null?void 0:Te.message,suffixButton:me})}},`${fe}:${ye}`)}case"textarea":return o.jsx(gt,{name:k.name,control:x,render:({field:fe,fieldState:pe})=>{var ye;return o.jsx($s,{...be,value:fe.value,onChange:fe.onChange,maxLength:k.maxLength,showCounter:!!k.showCounter,hasError:!!pe.error,errorMessage:((ye=pe.error)==null?void 0:ye.message)||""})}},k.name);case"file":return o.jsx(fi,{...be,defaultValue:[],maxFiles:k.maxFiles,accept:k.accept,hasError:!!y[k.name],errorMessage:(de=y[k.name])==null?void 0:de.message},k.name);case"checkbox":return o.jsx(dt,{...be,defaultValue:!1,hasError:!!y[k.name],errorMessage:(ke=y[k.name])==null?void 0:ke.message,name:k.name},k.name);case"date":return o.jsx(_r,{...be,defaultValue:"",showTime:!!k.showTime,hasError:!!y[k.name],errorMessage:(ge=y[k.name])==null?void 0:ge.message},k.name);case"optionGroup":return o.jsx(Ri,{...be,options:k.options||[],multiple:k.multiple,vertical:k.vertical,groupLabel:k.groupLabel,defaultValue:k.defaultValue,className:k.width?void 0:"w-full",name:k.name},k.name);default:return o.jsx(Yn,{...be,type:k.type,loadingDefaults:N,hasError:!!y[k.name],errorMessage:(he=y[k.name])==null?void 0:he.message,suffixButton:me,name:k.name},k.name)}},[s,q,x,y,T,N,$,V,ne,D,g.getValues,g.watch,p==null?void 0:p.registry]);return o.jsx(ed,{...g,children:o.jsxs("form",{noValidate:!0,onSubmit:w(async C=>{await n(C),f(a??h("ds.form.saveSuccess"),"success")},C=>{console.log("❌ errores de validación:",C),ku(C),f(i??h("ds.form.saveError"),"error")}),className:"space-y-6",children:[r.map((C,k)=>C.type==="rows"?o.jsx(b.Fragment,{children:C.sections.map((I,U)=>o.jsx("div",{className:"mb-6",children:o.jsx(it,{title:I.sectionTitle,defaultOpen:I.defaultOpen,children:I.rows.map((G,ee)=>o.jsxs("div",{children:[G.title&&o.jsx("h2",{className:"mb-2 text-lg text-[var(--color-ds-text-primary)]",children:G.title}),o.jsx("div",{className:"flex flex-wrap -mx-2",children:G.columns.map((M,W)=>{var me;return o.jsx("div",{className:`${M.width} px-2 flex flex-col`,children:o.jsx("div",{className:"space-y-4",children:M.fields?M.fields.map(be=>le(be)):(me=M.rows)==null?void 0:me.map((be,de)=>o.jsx("div",{className:"mb-1",children:o.jsx("div",{className:"flex flex-wrap -mx-2",children:be.columns.map((ke,ge)=>{var he;return o.jsx("div",{className:`${ke.width} px-2`,children:(he=ke.fields)==null?void 0:he.map(fe=>le(fe))},ge)})})},de))})},W)})})]},ee))})},U))},k):o.jsx(zr,{options:C.tabs.map(I=>({label:I.label,value:I.key})),value:E[k],onChange:I=>te(U=>({...U,[k]:I})),children:Object.fromEntries(C.tabs.map(I=>[I.key,o.jsx("div",{className:"space-y-6",children:I.sections.map((U,G)=>o.jsx("div",{className:"mb-6",children:o.jsx(it,{title:U.sectionTitle,defaultOpen:U.defaultOpen,children:U.rows.map((ee,M)=>o.jsx("div",{children:o.jsx("div",{className:"flex flex-wrap -mx-2",children:ee.columns.map((W,me)=>{var be;return o.jsx("div",{className:`${W.width??"flex-1"} px-2 flex flex-col`,children:o.jsx("div",{className:"space-y-4",children:(be=W.fields)==null?void 0:be.map((de,ke)=>o.jsx(b.Fragment,{children:le(de)},ke))})},me)})})},M))})},G))},I.key)]))},k)),o.jsx("footer",{className:"py-4 w-full flex justify-center space-x-4",children:l??o.jsx(ie,{type:"submit",variant:"primary",icon:ql,size:"sm",disabled:T||N||S>0,children:h(T?"ds.form.sending":"ds.form.submit")})})]})})}const Yu={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"};function zi({icon:e,size:t="md",ariaLabel:r,disabled:s=!1,onClick:n,...a}){return o.jsx("button",{type:"button","aria-label":r,disabled:s,onClick:n,className:se("inline-flex items-center justify-center","rounded-full","bg-transparent","text-[var(--color-ds-text-primary)]","transition-transform","focus:outline-none",Yu[t],s?"opacity-50 cursor-not-allowed":["hover:scale-110","hover:animate-pulse"]),...a,children:o.jsx(e,{className:se(t==="sm"?"h-4 w-4":t==="md"?"h-5 w-5":"h-6 w-6")})})}function Ii({dark:e,onToggle:t}){return o.jsx("button",{type:"button","aria-pressed":e,"aria-label":e?"Cambiar a modo claro":"Cambiar a modo oscuro",onClick:t,className:se("relative inline-flex items-center transition-colors focus:outline-none duration-200 ease-in-out","bg-[var(--color-ds-background-accent)]","h-6 w-12 rounded-full"),children:o.jsxs("div",{className:se("absolute bg-[var(--color-ds-background-page)] flex items-center justify-center rounded-full transition-transform duration-200 ease-in-out","h-5 w-5",e?"translate-x-6":"translate-x-1"),children:[o.jsx(kt,{component:mc,size:"sm",className:se("absolute transition-opacity duration-200 ease-in-out",e?"opacity-0":"opacity-100 text-[var(--color-ds-background-accent)]")}),o.jsx(kt,{component:cc,size:"sm",className:se("absolute transition-opacity duration-200 ease-in-out",e?"opacity-100 text-[var(--color-ds-background-accent)]":"opacity-0")})]})})}const Vi=b.createContext({theme:"light",toggle:()=>{}});function Hu({children:e}){const[t,r]=b.useState(!1),[s,n]=b.useState("light");b.useEffect(()=>{if(typeof window>"u")return;const i=localStorage.getItem("ds-theme");i==="light"||i==="dark"?n(i):window.matchMedia("(prefers-color-scheme: dark)").matches&&n("dark"),r(!0)},[]),b.useEffect(()=>{t&&(document.documentElement.classList.toggle("dark",s==="dark"),s==="dark"?localStorage.setItem("ds-theme","dark"):localStorage.removeItem("ds-theme"))},[s,t]);const a=()=>n(i=>i==="light"?"dark":"light");return t?o.jsx(Vi.Provider,{value:{theme:s,toggle:a},children:e}):null}const Bi=()=>b.useContext(Vi),Ui=({pinnedPages:e,onRemovePinned:t,onBack:r,dark:s,locale:n,languageOptions:a,onChangeLocale:i,profile:l,profileOptions:c,onChangeProfile:d})=>{const u=e.slice(0,3),{toggle:f}=Bi(),{t:h,i18n:p}=Jn(),v=g=>{i(g)};return o.jsxs("header",{className:"flex items-center bg-[var(--color-ds-background-page)] py-2",children:[o.jsx("div",{className:"flex items-center space-x-2",children:u.map(g=>o.jsxs("div",{className:"flex items-center",children:[o.jsx("a",{href:g.href,className:se("inline-flex items-center rounded-lg","py-1 px-1 my-1 text-ds-sm","bg-transparent text-[var(--color-ds-text-primary)]","transition-colors duration-200 ease-in-out","hover:bg-[var(--color-ds-border-muted)] hover:animate-pulse"),children:g.label}),o.jsx(zi,{icon:In,size:"sm",ariaLabel:`${h("remove")} ${g.label}`,onClick:()=>t(g.id)})]},g.id))}),o.jsx("div",{className:"flex-grow"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(rt,{size:"sm",width:"auto",options:a,value:n,onChange:v,disableErrorPlaceholder:!0}),o.jsx(rt,{size:"sm",width:"auto",options:c,value:l,onChange:d,disableErrorPlaceholder:!0}),o.jsx(Ii,{dark:s,onToggle:f})]})]})},Xu=({loading:e=!1,ariaLabel:t="Cargando..."})=>e?o.jsxs("div",{className:`\r
36
+ hover:bg-[var(--color-ds-background-surface)]`,onClick:()=>{const I=String(k.value).trim();v(e,I,{shouldDirty:!0,shouldValidate:!0}),A(k.label??I),V.current=!1,z.current=!1,N(!1)},children:k.label},String(k.value)))})]})}})}const Nr=(e,t)=>e[t],eo=e=>e instanceof Date?e.getTime():e;function Ju(e,t,r){const s=eo(e),n=eo(t);return typeof s=="number"&&typeof n=="number"||typeof s=="string"&&typeof n=="string"?r==="gt"?s>n:r==="gte"?s>=n:r==="lt"?s<n:s<=n:!1}function ks(e,t){if(!e)return!1;switch(e.op){case"eq":return Nr(t,e.field)===e.value;case"neq":return Nr(t,e.field)!==e.value;case"in":return e.values.includes(Nr(t,e.field));case"notIn":return!e.values.includes(Nr(t,e.field));case"gt":case"gte":case"lt":case"lte":return Ju(Nr(t,e.field),e.value,e.op);case"and":return e.rules.every(r=>ks(r,t));case"or":return e.rules.some(r=>ks(r,t));default:return!1}}function to(e){if(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return}if(typeof e=="object")return e}}function Zu(e,t){var r;return Array.isArray(e)?e.length&&typeof e[0]=="object"&&"value"in e[0]?t?e.map(s=>s.value):((r=e[0])==null?void 0:r.value)??"":t?e:e[0]??"":e&&typeof e=="object"&&"value"in e?e.value:e??(t?[]:"")}const Yu=e=>e.type!=="inputGroup"&&e.type!=="button";function zi({schema:e,resolver:t}){const{layout:r,fields:s=[],onSubmit:n,successMessage:a,errorMessage:i,footerButtons:l,defaultValues:c,loadDefaultValues:d,validationSchema:u}=e,{show:f}=Vr(),{t:p}=Zn(),{services:h}=$s(),v=b.useMemo(()=>{if(t)return t;try{const C=u??Oi(e);return pi(C)}catch{return}},[t,e,u]),x=bd({resolver:v,mode:"onBlur",reValidateMode:"onChange",defaultValues:c??{}});b.useEffect(()=>{const C=e.defaultSource;if(!C)return;let k=!1;return(async()=>{var I;try{const U=(I=h==null?void 0:h.registry)==null?void 0:I[C];if(!U)return;const G=typeof U=="function"?await U():U;!k&&G&&typeof G=="object"&&x.reset({...e.defaultValues??{},...G})}catch{}})(),()=>{k=!0}},[e,h==null?void 0:h.registry,x.reset]);const{control:g,reset:m,handleSubmit:w,formState:{errors:y,isSubmitting:T}}=x,[N,_]=b.useState(!1);b.useEffect(()=>{d&&(_(!0),d().then(C=>m(C)).finally(()=>_(!1)))},[d,m]);const A=b.useMemo(()=>(s??[]).filter(Yu),[s]),{loadingCount:S,optionsMap:$}=zu(A),[V,z]=b.useState({});b.useEffect(()=>{let C=!0;return(async()=>{const I=await Promise.all(A.filter(G=>G.type==="select"&&G.optionSource).map(async G=>{var be;const ee=G.name,M=G.optionSource,W=to(G.adapterCtx??G.optionAdapterCtx),me=(be=h==null?void 0:h.registry)==null?void 0:be[M];if(typeof me!="function")return[ee,[]];try{const de=await Promise.resolve(me("",{getValues:x.getValues,watch:x.watch,ctx:W})),ke=Array.isArray(de)?de:[];return[ee,ke]}catch{return[ee,[]]}}));if(!C)return;const U={};for(const[G,ee]of I)U[G]=ee;z(U)})(),()=>{C=!1}},[h==null?void 0:h.registry,x.getValues,x.watch,JSON.stringify(A.map(C=>({n:C.name,os:C.optionSource??null,ctx:C.adapterCtx??C.optionAdapterCtx??null,staticLen:Array.isArray(C.options)?C.options.length:-1})))]),b.useEffect(()=>{let C=!0;return(async()=>{var I;for(const U of A){if(U.type!=="select")continue;const G=U.name,ee=U.defaultSource;if(!ee)continue;const M=x.getValues(G);if(!(M==null||(Array.isArray(M)?M.length===0:M==="")))continue;const me=(I=h==null?void 0:h.registry)==null?void 0:I[ee];if(typeof me=="function")try{const be=to(U.adapterCtx??U.optionAdapterCtx),de=await Promise.resolve(me("",{getValues:x.getValues,watch:x.watch,ctx:be}));if(!C)return;const ke=Zu(de,!!U.multiple);x.setValue(G,ke,{shouldDirty:!0,shouldTouch:!0})}catch{}}})(),()=>{C=!1}},[h==null?void 0:h.registry,x.getValues,x.setValue,JSON.stringify(A.map(C=>({n:C.name,ds:C.defaultSource??null,mult:!!C.multiple})))]);const q=Mu(s),D=Wu(s,g),P=b.useMemo(()=>{const C={};return r.forEach((k,I)=>{k.type==="tabs"&&(C[I]=k.tabs[0].key)}),C},[r]),[E,te]=b.useState(P),ne=b.useCallback((C,k)=>{if(!(C!=null&&C.enabled)||!C.rule)return k;try{return!!ks(C.rule,x.getValues())}catch{return k}},[x]),K=b.useMemo(()=>s.map(C=>C).filter(C=>{var k;return((k=C.clearWhen)==null?void 0:k.enabled)&&C.clearWhen.rule}).map(C=>({name:C.name,rule:C.clearWhen.rule,clearTo:C.clearWhen.clearTo})),[s]);b.useEffect(()=>{if(!K.length)return;const C=I=>{K.forEach(({name:U,rule:G,clearTo:ee})=>{try{if(!!ks(G,I)){const W=ee??"";I[U]!==W&&x.setValue(U,W,{shouldDirty:!0,shouldValidate:!0})}}catch{}})};C(x.getValues());const k=x.watch(()=>C(x.getValues()));return()=>{var I;return(I=k==null?void 0:k.unsubscribe)==null?void 0:I.call(k)}},[x,K]);const le=b.useCallback(C=>{var de,ke,ge,he;let k;if(typeof C=="string"){if(k=q[C],!k){const fe=(s??[]).find(pe=>(pe==null?void 0:pe.name)===C);if(fe)k=fe;else return null}}else k=C;const I=k.visibleWhen;if(!ne(I,!0))return null;let G=!!k.disabled;const ee=k.disabledWhen,M=ne(ee,!1);if(ee!=null&&ee.enabled&&(G=M),!(ee!=null&&ee.enabled)&&"name"in k&&k.name&&D[k.name]&&(G=!0),k.type==="search"){const fe=typeof k.searchFn=="function",pe=k.searchSource,ye=async Se=>{var Te;if(fe)return k.searchFn(Se,{getValues:x.getValues,watch:x.watch});if(pe){const j=(Te=h==null?void 0:h.registry)==null?void 0:Te[pe];if(typeof j=="function")return await j(Se,{getValues:x.getValues,watch:x.watch});if(Array.isArray(j))return j}return[]},ce={};return k.searchMode&&(ce.searchMode=k.searchMode),k.minChars&&(ce.minChars=k.minChars),k.debounceMs&&(ce.debounceMs=k.debounceMs),k.resolveByValue&&(ce.resolveByValue=k.resolveByValue),o.jsx(Pi,{name:k.name,control:g,searchFn:ye,label:k.label,size:k.size,width:k.width,disabled:G||T,...ce},k.name)}if(k.type==="inputGroup"){const fe=k,pe=(fe.inputs??[]).map(ye=>{var R;const ce=typeof ye=="string"?q[ye]??(s??[]).find(X=>(X==null?void 0:X.name)===ye):ye;if(!ce)return null;const Se=ce.disabledWhen;let Te=!!ce.disabled;const j=ne(Se,!1);Se!=null&&Se.enabled&&(Te=j),!(Se!=null&&Se.enabled)&&D[ce.name]&&(Te=!0);const F={name:ce.name,control:g,label:ce.label,size:ce.size,width:ce.width,placeholder:ce.placeholder,hasError:!!y[ce.name],errorMessage:((R=y[ce.name])==null?void 0:R.message)||"",loading:N,disabled:Te||T,suffixButton:ce.suffixButton,reserveErrorSpace:!0};return ce.type==="select"?{...F,options:ce.options??V[ce.name]??$[ce.name]??[],loadOptions:ce.options||ce.optionSource?void 0:ce.loadOptions}:{...F,type:ce.type}}).filter(Boolean);return o.jsx(Ri,{groupLabel:fe.groupLabel,inputs:pe,separator:fe.separator,useSeparator:fe.useSeparator,className:fe.className,showVisibleLabel:fe.showVisibleLabel,size:fe.size},`inputGroup_${fe.name??fe.groupLabel??"group"}`)}if(k.type==="button"){const fe=k;return o.jsx("div",{className:"self-center",children:o.jsx(ie,{type:"button",variant:fe.variant,size:fe.size,width:fe.width,icon:fe.icon,iconPosition:fe.iconPosition,ariaLabel:fe.ariaLabel,onClick:fe.onClick,disabled:G||T,children:fe.label})},fe.name)}const W=k.suffixButton,me=typeof W=="string"?le(W):W,be={name:k.name,control:g,disabled:G||T,label:k.label,size:k.size,width:k.width,placeholder:k.placeholder,info:k.info,suffixButton:me};switch(k.type){case"select":{const fe=k.name,pe=k.options??V[fe]??$[fe]??[],ye=Array.isArray(pe)&&pe.length?`${pe.length}:${pe.map(Se=>String((Se==null?void 0:Se.value)??"")).join("|")}`:"0",ce=!k.options&&!k.optionSource&&k.loadOptions;return o.jsx(gt,{name:fe,control:g,render:({field:Se})=>{var Te;return o.jsx(rt,{...be,value:Se.value,onChange:Se.onChange,options:pe,loadOptions:ce||void 0,hasError:!!y[fe],errorMessage:(Te=y[fe])==null?void 0:Te.message,suffixButton:me})}},`${fe}:${ye}`)}case"textarea":return o.jsx(gt,{name:k.name,control:g,render:({field:fe,fieldState:pe})=>{var ye;return o.jsx(Ls,{...be,value:fe.value,onChange:fe.onChange,maxLength:k.maxLength,showCounter:!!k.showCounter,hasError:!!pe.error,errorMessage:((ye=pe.error)==null?void 0:ye.message)||""})}},k.name);case"file":return o.jsx(mi,{...be,defaultValue:[],maxFiles:k.maxFiles,accept:k.accept,hasError:!!y[k.name],errorMessage:(de=y[k.name])==null?void 0:de.message},k.name);case"checkbox":return o.jsx(dt,{...be,defaultValue:!1,hasError:!!y[k.name],errorMessage:(ke=y[k.name])==null?void 0:ke.message,name:k.name},k.name);case"date":return o.jsx(Fr,{...be,defaultValue:"",showTime:!!k.showTime,hasError:!!y[k.name],errorMessage:(ge=y[k.name])==null?void 0:ge.message},k.name);case"optionGroup":return o.jsx(Di,{...be,options:k.options||[],multiple:k.multiple,vertical:k.vertical,groupLabel:k.groupLabel,defaultValue:k.defaultValue,className:k.width?void 0:"w-full",name:k.name},k.name);default:return o.jsx(Hn,{...be,type:k.type,loadingDefaults:N,hasError:!!y[k.name],errorMessage:(he=y[k.name])==null?void 0:he.message,suffixButton:me,name:k.name},k.name)}},[s,q,g,y,T,N,$,V,ne,D,x.getValues,x.watch,h==null?void 0:h.registry]);return o.jsx(td,{...x,children:o.jsxs("form",{noValidate:!0,onSubmit:w(async C=>{await n(C),f(a??p("ds.form.saveSuccess"),"success")},C=>{console.log("❌ errores de validación:",C),Nu(C),f(i??p("ds.form.saveError"),"error")}),className:"space-y-6",children:[r.map((C,k)=>C.type==="rows"?o.jsx(b.Fragment,{children:C.sections.map((I,U)=>o.jsx("div",{className:"mb-6",children:o.jsx(it,{title:I.sectionTitle,defaultOpen:I.defaultOpen,children:I.rows.map((G,ee)=>o.jsxs("div",{children:[G.title&&o.jsx("h2",{className:"mb-2 text-lg text-[var(--color-ds-text-primary)]",children:G.title}),o.jsx("div",{className:"flex flex-wrap -mx-2",children:G.columns.map((M,W)=>{var me;return o.jsx("div",{className:`${M.width} px-2 flex flex-col`,children:o.jsx("div",{className:"space-y-4",children:M.fields?M.fields.map(be=>le(be)):(me=M.rows)==null?void 0:me.map((be,de)=>o.jsx("div",{className:"mb-1",children:o.jsx("div",{className:"flex flex-wrap -mx-2",children:be.columns.map((ke,ge)=>{var he;return o.jsx("div",{className:`${ke.width} px-2`,children:(he=ke.fields)==null?void 0:he.map(fe=>le(fe))},ge)})})},de))})},W)})})]},ee))})},U))},k):o.jsx(Ir,{options:C.tabs.map(I=>({label:I.label,value:I.key})),value:E[k],onChange:I=>te(U=>({...U,[k]:I})),children:Object.fromEntries(C.tabs.map(I=>[I.key,o.jsx("div",{className:"space-y-6",children:I.sections.map((U,G)=>o.jsx("div",{className:"mb-6",children:o.jsx(it,{title:U.sectionTitle,defaultOpen:U.defaultOpen,children:U.rows.map((ee,M)=>o.jsx("div",{children:o.jsx("div",{className:"flex flex-wrap -mx-2",children:ee.columns.map((W,me)=>{var be;return o.jsx("div",{className:`${W.width??"flex-1"} px-2 flex flex-col`,children:o.jsx("div",{className:"space-y-4",children:(be=W.fields)==null?void 0:be.map((de,ke)=>o.jsx(b.Fragment,{children:le(de)},ke))})},me)})})},M))})},G))},I.key)]))},k)),o.jsx("footer",{className:"py-4 w-full flex justify-center space-x-4",children:l??o.jsx(ie,{type:"submit",variant:"primary",icon:Wl,size:"sm",disabled:T||N||S>0,children:p(T?"ds.form.sending":"ds.form.submit")})})]})})}const Hu={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"};function Ii({icon:e,size:t="md",ariaLabel:r,disabled:s=!1,onClick:n,...a}){return o.jsx("button",{type:"button","aria-label":r,disabled:s,onClick:n,className:se("inline-flex items-center justify-center","rounded-full","bg-transparent","text-[var(--color-ds-text-primary)]","transition-transform","focus:outline-none",Hu[t],s?"opacity-50 cursor-not-allowed":["hover:scale-110","hover:animate-pulse"]),...a,children:o.jsx(e,{className:se(t==="sm"?"h-4 w-4":t==="md"?"h-5 w-5":"h-6 w-6")})})}function Vi({dark:e,onToggle:t}){return o.jsx("button",{type:"button","aria-pressed":e,"aria-label":e?"Cambiar a modo claro":"Cambiar a modo oscuro",onClick:t,className:se("relative inline-flex items-center transition-colors focus:outline-none duration-200 ease-in-out","bg-[var(--color-ds-background-accent)]","h-6 w-12 rounded-full"),children:o.jsxs("div",{className:se("absolute bg-[var(--color-ds-background-page)] flex items-center justify-center rounded-full transition-transform duration-200 ease-in-out","h-5 w-5",e?"translate-x-6":"translate-x-1"),children:[o.jsx(kt,{component:hc,size:"sm",className:se("absolute transition-opacity duration-200 ease-in-out",e?"opacity-0":"opacity-100 text-[var(--color-ds-background-accent)]")}),o.jsx(kt,{component:dc,size:"sm",className:se("absolute transition-opacity duration-200 ease-in-out",e?"opacity-100 text-[var(--color-ds-background-accent)]":"opacity-0")})]})})}const Bi=b.createContext({theme:"light",toggle:()=>{}});function Xu({children:e}){const[t,r]=b.useState(!1),[s,n]=b.useState("light");b.useEffect(()=>{if(typeof window>"u")return;const i=localStorage.getItem("ds-theme");i==="light"||i==="dark"?n(i):window.matchMedia("(prefers-color-scheme: dark)").matches&&n("dark"),r(!0)},[]),b.useEffect(()=>{t&&(document.documentElement.classList.toggle("dark",s==="dark"),s==="dark"?localStorage.setItem("ds-theme","dark"):localStorage.removeItem("ds-theme"))},[s,t]);const a=()=>n(i=>i==="light"?"dark":"light");return t?o.jsx(Bi.Provider,{value:{theme:s,toggle:a},children:e}):null}const Ui=()=>b.useContext(Bi),Sr={locale:"licytal:ui:locale",theme:"licytal:ui:theme"},qi=({pinnedPages:e,onRemovePinned:t,onBack:r,dark:s,locale:n,languageOptions:a,onChangeLocale:i,profile:l="",profileOptions:c=[],onChangeProfile:d})=>{const u=e.slice(0,3),{toggle:f}=Ui(),{t:p,i18n:h}=Zn(),v=g=>{try{localStorage.setItem(Sr.locale,g)}catch{}h.changeLanguage(g),i==null||i(g)},x=()=>{const g=!s;try{localStorage.setItem(Sr.theme,g?"dark":"light")}catch{}f()};return b.useEffect(()=>{try{const g=localStorage.getItem(Sr.locale),m=g||n;m&&m!==h.language&&(h.changeLanguage(m),g&&g!==n&&(i==null||i(g)))}catch{}},[]),b.useEffect(()=>{if(n&&n!==h.language){h.changeLanguage(n);try{localStorage.setItem(Sr.locale,n)}catch{}}},[n,h]),b.useEffect(()=>{try{const g=localStorage.getItem(Sr.theme);if(!g)return;g==="dark"!==s&&f()}catch{}},[]),o.jsxs("header",{className:"flex items-center bg-[var(--color-ds-background-page)] py-2",children:[o.jsx("div",{className:"flex items-center space-x-2",children:u.map(g=>o.jsxs("div",{className:"flex items-center",children:[o.jsx("a",{href:g.href,className:se("inline-flex items-center rounded-lg","py-1 px-1 my-1 text-ds-sm","bg-transparent text-[var(--color-ds-text-primary)]","transition-colors duration-200 ease-in-out","hover:bg-[var(--color-ds-border-muted)] hover:animate-pulse"),children:g.label}),o.jsx(Ii,{icon:Vn,size:"sm",ariaLabel:`${p("remove")} ${g.label}`,onClick:()=>t(g.id)})]},g.id))}),o.jsx("div",{className:"flex-grow"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(rt,{size:"sm",width:"auto",options:a,value:n,onChange:v,disableErrorPlaceholder:!0}),!!c.length&&o.jsx(rt,{size:"sm",width:"auto",options:c,value:l,onChange:g=>d==null?void 0:d(g),disableErrorPlaceholder:!0}),o.jsx(Vi,{dark:s,onToggle:x})]})]})},Qu=({loading:e=!1,ariaLabel:t="Cargando..."})=>e?o.jsxs("div",{className:`\r
37
37
  fixed inset-0\r
38
38
  flex items-center justify-center\r
39
39
  bg-[var(--color-ds-background-surface)]/90\r
@@ -44,7 +44,7 @@ attempted value: ${i}
44
44
  border-gray-200\r
45
45
  border-t-[var(--color-ds-button-primary-bg)]\r
46
46
  animate-spin\r
47
- `}),o.jsx("span",{className:"sr-only",children:t})]}):null,Qu=({isOpen:e,onClose:t,title:r,children:s,footer:n})=>(b.useEffect(()=>{const a=i=>i.key==="Escape"&&t();return e&&(document.addEventListener("keydown",a),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",a),document.body.style.overflow=""}},[e,t]),e?Jt.createPortal(o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-[var(--color-ds-text-primary)]/50 z-40",onClick:t}),o.jsx("div",{className:"fixed inset-0 flex items-center justify-center px-4 z-50",children:o.jsxs("div",{className:`\r
47
+ `}),o.jsx("span",{className:"sr-only",children:t})]}):null,ef=({isOpen:e,onClose:t,title:r,children:s,footer:n})=>(b.useEffect(()=>{const a=i=>i.key==="Escape"&&t();return e&&(document.addEventListener("keydown",a),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",a),document.body.style.overflow=""}},[e,t]),e?Jt.createPortal(o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 bg-[var(--color-ds-text-primary)]/50 z-40",onClick:t}),o.jsx("div",{className:"fixed inset-0 flex items-center justify-center px-4 z-50",children:o.jsxs("div",{className:`\r
48
48
  relative\r
49
49
  bg-[var(--color-ds-background-page)]\r
50
50
  dark:bg-[var(--color-ds-background-surface)]\r
@@ -58,11 +58,11 @@ attempted value: ${i}
58
58
  dark:bg-[var(--color-ds-background-surface)]\r
59
59
  hover:bg-[var(--color-ds-background-accent)]/10\r
60
60
  focus:outline-none\r
61
- `,children:[o.jsx(In,{className:"w-5 h-5 text-[var(--color-ds-text-secondary)] hover:text-[var(--color-ds-text-primary)]"}),o.jsx("span",{className:"sr-only",children:"Cerrar modal"})]})]}),o.jsx("div",{className:"px-6 py-6 text-[var(--color-ds-text-primary)]",children:s}),n&&o.jsx("div",{className:"px-6 py-4 border-t border-[var(--color-ds-border-muted)] bg-[var(--color-ds-background-surface)]",children:n})]})})]}),document.body):null),Xn=({items:e,selected:t,onSelect:r,level:s=0})=>{const[n,a]=b.useState(new Set),i=l=>{const c=new Set(n);s===0?(c.clear(),n.has(l)||c.add(l)):c.has(l)?c.delete(l):c.add(l),a(c)};return o.jsx("ul",{className:se(s>0?"mt-1":"mt-0"),children:e.map(l=>{var v;const c=l.value===t,d=n.has(l.value),u=["pl-2","pl-2","pl-2"][s]||"pl-4",f=s===0?d||c?"bg-[var(--color-ds-background-accent)] text-[var(--color-ds-text-on-accent)] rounded-r-lg":"text-[var(--color-ds-text-primary)] hover:bg-[var(--color-ds-background-surface)]":c?"bg-[var(--color-ds-background-surface)] text-[var(--color-ds-text-primary)]":"text-[var(--color-ds-text-primary)] hover:bg-[var(--color-ds-background-surface)]",h=s===0&&(d||c)?"text-[var(--color-ds-text-on-accent)]":"text-[var(--color-ds-text-secondary)]",p=!!((v=l.children)!=null&&v.length);return o.jsxs("li",{children:[o.jsxs("button",{type:"button",onClick:()=>p?i(l.value):r(l.value),"aria-expanded":p?d:void 0,className:se("w-full flex items-center justify-between h-8 transition-colors",u,f),children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[s===0&&l.icon&&o.jsx(l.icon,{className:"w-5 h-5 ml-2"}),o.jsx("span",{className:"text-ds-sm",children:l.label})]}),p&&(d?o.jsx(Os,{className:se("w-4 h-4",h)}):o.jsx(Mo,{className:se("w-4 h-4",h)}))]}),p&&o.jsx("div",{className:se("overflow-hidden transition-[max-height] duration-300 ease-in-out","border-l-1 border-[var(--color-ds-background-accent)] ml-6",d?"max-h-screen":"max-h-0"),children:o.jsx(Xn,{items:l.children,selected:t,onSelect:r,level:s+1})})]},l.value)})})},ef="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20250%20250'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2029.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.0%20Build%20186)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23FFFFFF;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='st0'%20d='M101.7,82.72c1.6.57,3.25,1.09,4.98,1.53,11.93,3.07,17.85,7.44,17.85,13.01,0,2.72-1.14,5-3.43,6.86-2.29,1.86-5.14,2.79-8.57,2.79s-6.49-1.13-8.9-3.36c-2.62,6.82-6.19,13.16-10.51,18.91,5.53,3.09,11.9,4.68,19.13,4.68,10.14,0,18.64-3,25.43-9.01,3.7-3.24,6.35-6.96,8.02-11.11,1.77,3.2,4.03,6.17,6.81,8.9,7.64,7.51,17.28,11.22,28.78,11.22,9.14,0,17.21-2.43,24.21-7.22,2.24-1.55,4.24-3.27,6.05-5.14l-14.05-13.73h-.14c-2.57,4.29-8.57,7.44-15.64,7.44-8.78,0-15.5-5.22-17.85-13.58h57.06c.36-1.57.57-3.79.57-6.58,0-11.37-3.86-20.73-11.5-28.24-7.71-7.44-17.28-11.15-28.71-11.15s-21.14,3.72-28.78,11.15c-5.19,5.09-8.59,11.03-10.26,17.78-1.11-1.42-2.37-2.71-3.78-3.83-6.07-4.79-12.07-7.36-20.64-9.73-11-2.93-16.5-7.08-16.5-12.58,0-2.51,1-4.65,3.07-6.37,2.07-1.71,4.57-2.57,7.57-2.57,3.21,0,5.93,1,8,3,2.07,2,3.14,4.5,3.14,7.5h23.21c0-8.79-3.29-16.08-9.78-21.95-6.5-5.86-14.71-8.79-24.57-8.79s-17.44,2.77-23.89,8.31C74.82,12.54,53.44.47,29.27,0v24.08c27.07.77,48.86,23.04,48.86,50.32s-21.79,49.55-48.86,50.32v24.08c37.54-.72,68.34-29.42,72.44-66.08ZM181.29,67.38c8.21,0,15,5.08,17.21,13.3h-34.5c2.57-8.22,8.93-13.3,17.28-13.3Z'/%3e%3cpath%20class='st0'%20d='M29.35,160.65v29.07h10.94c4.12,0,7.57-1.38,10.31-4.16,2.74-2.76,4.12-6.21,4.12-10.39s-1.38-7.61-4.12-10.39c-2.74-2.76-6.19-4.14-10.31-4.14h-10.94ZM52.1,175.17c0,3.46-1.14,6.34-3.39,8.64-2.25,2.3-5.07,3.46-8.46,3.46h-8.36v-24.17h8.36c3.39,0,6.21,1.15,8.46,3.46,2.25,2.3,3.39,5.18,3.39,8.62Z'/%3e%3cpath%20class='st0'%20d='M60.61,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3crect%20class='st0'%20x='57.63'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M64.15,168.24v29.48h2.41v-13.19c.85,1.77,2.09,3.17,3.69,4.18,1.6,1.01,3.41,1.52,5.44,1.52,3.11,0,5.7-1.07,7.75-3.23,2.05-2.16,3.07-4.83,3.07-8.04s-1.04-5.86-3.09-8.02c-2.05-2.14-4.63-3.21-7.73-3.21-2.03,0-3.84.49-5.44,1.5-1.6,1.01-2.84,2.41-3.69,4.18v-5.16h-2.41ZM69.06,172.62c1.64-1.69,3.73-2.53,6.23-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36c-1.66,1.71-3.73,2.55-6.23,2.55s-4.59-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33Z'/%3e%3cpath%20class='st0'%20d='M107.73,189.71v-21.48h-2.42v12.59c0,2.1-.65,3.79-1.97,5.08-1.32,1.3-3.05,1.95-5.18,1.95s-3.69-.64-4.93-1.91c-1.26-1.28-1.89-2.96-1.89-5.04v-12.67h-2.4v13.35c0,2.61.79,4.69,2.35,6.27,1.56,1.58,3.61,2.37,6.15,2.37,3.65-.02,6.27-1.52,7.85-4.53v4.01h2.42Z'/%3e%3cpolygon%20class='st0'%20points='117.35%20189.71%20117.35%20170.46%20122.55%20170.46%20122.55%20168.24%20117.35%20168.24%20117.35%20161.9%20114.94%20162.38%20114.94%20168.24%20110.01%20168.24%20110.01%20170.46%20114.94%20170.46%20114.94%20189.71%20117.35%20189.71'/%3e%3cpath%20class='st0'%20d='M144.27,189.71v-21.48h-2.42v5.12c-.87-1.75-2.13-3.13-3.73-4.14-1.6-1.01-3.41-1.5-5.4-1.5-3.08,0-5.64,1.07-7.69,3.21-2.05,2.16-3.09,4.83-3.09,8.02s1.04,5.88,3.09,8.04c2.05,2.16,4.63,3.23,7.69,3.23,1.99,0,3.79-.51,5.4-1.52,1.6-1.01,2.84-2.39,3.73-4.13v5.14h2.42ZM139.36,185.31c-1.66,1.71-3.73,2.55-6.23,2.55s-4.53-.84-6.19-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.19-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36Z'/%3e%3cpath%20class='st0'%20d='M158.18,170.09c2.09,0,3.9.62,5.46,1.85,1.54,1.23,2.56,2.84,3.02,4.83h2.5c-.47-2.63-1.73-4.79-3.73-6.5-2.03-1.71-4.44-2.55-7.25-2.55-3.19,0-5.84,1.07-8,3.21-2.15,2.16-3.23,4.83-3.23,8.02s1.08,5.88,3.23,8.04c2.13,2.16,4.81,3.23,8,3.23,2.8,0,5.22-.84,7.25-2.55,2.01-1.71,3.27-3.87,3.73-6.52h-2.5c-.47,2-1.48,3.62-3.02,4.85-1.56,1.23-3.37,1.85-5.46,1.85-2.5,0-4.57-.84-6.23-2.55-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3crect%20class='st0'%20x='171.72'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M174.71,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3cpath%20class='st0'%20d='M176.86,178.95c0,3.21,1.08,5.88,3.23,8.04,2.15,2.16,4.83,3.23,8.02,3.23s5.85-1.07,7.98-3.23c2.13-2.16,3.19-4.83,3.19-8.04s-1.06-5.86-3.19-8.02c-2.13-2.14-4.79-3.21-7.98-3.21s-5.86,1.07-8.02,3.21c-2.15,2.16-3.23,4.83-3.23,8.02ZM188.09,170.09c2.5,0,4.57.84,6.21,2.53,1.64,1.71,2.48,3.8,2.48,6.33s-.83,4.65-2.48,6.36c-1.64,1.71-3.71,2.55-6.21,2.55s-4.57-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3cpolygon%20class='st0'%20points='194.03%20160.01%20190.83%20160.01%20186.46%20165.15%20189.08%20165.15%20194.03%20160.01'/%3e%3cpath%20class='st0'%20d='M221.5,189.71v-13.02c0-2.69-.81-4.86-2.44-6.5-1.64-1.65-3.79-2.47-6.45-2.47-3.75,0-6.68,1.67-8.22,4.71v-4.2h-2.42v21.48h2.42v-12.22c0-2.22.69-4.01,2.07-5.37,1.38-1.36,3.19-2.04,5.44-2.04s3.92.66,5.24,2c1.32,1.34,1.97,3.11,1.97,5.33v12.3h2.4Z'/%3e%3cpath%20class='st0'%20d='M57.27,225.24c-2.82-2.23-5.61-3.43-9.59-4.53-5.11-1.37-7.66-3.3-7.66-5.87,0-1.17.46-2.17,1.43-2.97.96-.8,2.12-1.2,3.52-1.2,1.49,0,2.75.47,3.72,1.4.96.93,1.46,2.1,1.46,3.5h10.78c0-4.1-1.53-7.5-4.55-10.23-3.02-2.73-6.83-4.1-11.42-4.1s-8.23,1.33-11.25,4c-3.02,2.67-4.51,6-4.51,10s1.26,7.4,3.75,9.73c2.49,2.37,5.68,4.03,9.56,5.03,5.54,1.43,8.29,3.47,8.29,6.06,0,1.27-.53,2.33-1.59,3.2-1.06.87-2.39,1.3-3.98,1.3s-3.05-.53-4.18-1.6c-1.16-1.07-1.73-2.37-1.73-3.93h-10.82c0,4.3,1.59,7.86,4.78,10.7,3.15,2.83,7.1,4.26,11.81,4.26s8.66-1.4,11.81-4.2c3.15-2.77,4.71-6.26,4.71-10.43,0-4.43-1.56-7.9-4.35-10.13Z'/%3e%3cpolygon%20class='st0'%20points='118.26%20236.54%20110.23%20214.38%2098.88%20214.38%20113.02%20249.17%20123.21%20249.17%20137.28%20214.38%20126.19%20214.38%20118.26%20236.54'/%3e%3crect%20class='st0'%20x='139.25'%20y='214.38'%20width='9.92'%20height='34.79'/%3e%3cpath%20class='st0'%20d='M144.2,199.53c-1.72,0-3.18.57-4.35,1.73-1.16,1.17-1.76,2.6-1.76,4.33s.6,3.23,1.76,4.4c1.16,1.17,2.62,1.73,4.35,1.73s3.25-.57,4.45-1.73c1.16-1.17,1.76-2.63,1.76-4.4s-.6-3.17-1.76-4.33c-1.19-1.17-2.69-1.73-4.45-1.73Z'/%3e%3crect%20class='st0'%20x='154.93'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3crect%20class='st0'%20x='170.61'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3cpath%20class='st0'%20d='M211.58,214.38v3.8c-2.82-3.1-6.34-4.63-10.49-4.63-4.75,0-8.73,1.73-11.91,5.2-3.22,3.5-4.81,7.83-4.81,13s1.59,9.53,4.81,13.03c3.19,3.5,7.17,5.23,11.91,5.23,4.18-.03,7.67-1.57,10.49-4.67v3.83h9.92v-34.79h-9.92ZM209.19,237.9c-1.63,1.63-3.65,2.47-6.11,2.47s-4.41-.83-6.01-2.47c-1.63-1.63-2.42-3.7-2.42-6.17s.8-4.5,2.42-6.13c1.59-1.63,3.58-2.43,6.01-2.43s4.45.8,6.07,2.43c1.63,1.63,2.42,3.7,2.42,6.13s-.8,4.53-2.39,6.17Z'/%3e%3cpath%20class='st0'%20d='M82.34,213.54c-5.34,0-9.82,1.73-13.37,5.2-3.55,3.5-5.34,7.83-5.34,13s1.79,9.53,5.34,13.03c3.55,3.5,8.03,5.23,13.37,5.23,4.25,0,8-1.13,11.25-3.37,1.05-.73,1.99-1.55,2.84-2.43l-6.5-6.37h-.13c-1.19,2-3.98,3.47-7.27,3.47-4.08,0-7.2-2.43-8.29-6.33h26.51c.17-.73.27-1.77.27-3.07,0-5.3-1.79-9.66-5.34-13.16-3.58-3.47-8.03-5.2-13.34-5.2ZM74.31,228.34c1.19-3.83,4.15-6.2,8.03-6.2s6.97,2.37,8,6.2h-16.03Z'/%3e%3c/svg%3e",tf="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20250%20250'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2029.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.0%20Build%20186)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23005751;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='st0'%20d='M101.7,82.72c1.6.57,3.25,1.09,4.98,1.53,11.93,3.07,17.85,7.44,17.85,13.01,0,2.72-1.14,5-3.43,6.86-2.29,1.86-5.14,2.79-8.57,2.79s-6.49-1.13-8.9-3.36c-2.62,6.82-6.19,13.16-10.51,18.91,5.53,3.09,11.9,4.68,19.13,4.68,10.14,0,18.64-3,25.43-9.01,3.7-3.24,6.35-6.96,8.02-11.11,1.77,3.2,4.03,6.17,6.81,8.9,7.64,7.51,17.28,11.22,28.78,11.22,9.14,0,17.21-2.43,24.21-7.22,2.24-1.55,4.24-3.27,6.05-5.14l-14.05-13.73h-.14c-2.57,4.29-8.57,7.44-15.64,7.44-8.78,0-15.5-5.22-17.85-13.58h57.06c.36-1.57.57-3.79.57-6.58,0-11.37-3.86-20.73-11.5-28.24-7.71-7.44-17.28-11.15-28.71-11.15s-21.14,3.72-28.78,11.15c-5.19,5.09-8.59,11.03-10.26,17.78-1.11-1.42-2.37-2.71-3.78-3.83-6.07-4.79-12.07-7.36-20.64-9.73-11-2.93-16.5-7.08-16.5-12.58,0-2.51,1-4.65,3.07-6.37,2.07-1.71,4.57-2.57,7.57-2.57,3.21,0,5.93,1,8,3,2.07,2,3.14,4.5,3.14,7.5h23.21c0-8.79-3.29-16.08-9.78-21.95-6.5-5.86-14.71-8.79-24.57-8.79s-17.44,2.77-23.89,8.31C74.82,12.54,53.44.47,29.27,0v24.08c27.07.77,48.86,23.04,48.86,50.32s-21.79,49.55-48.86,50.32v24.08c37.54-.72,68.34-29.42,72.44-66.08ZM181.29,67.38c8.21,0,15,5.08,17.21,13.3h-34.5c2.57-8.22,8.93-13.3,17.28-13.3Z'/%3e%3cpath%20class='st0'%20d='M29.35,160.65v29.07h10.94c4.12,0,7.57-1.38,10.31-4.16,2.74-2.76,4.12-6.21,4.12-10.39s-1.38-7.61-4.12-10.39c-2.74-2.76-6.19-4.14-10.31-4.14h-10.94ZM52.1,175.17c0,3.46-1.14,6.34-3.39,8.64-2.25,2.3-5.07,3.46-8.46,3.46h-8.36v-24.17h8.36c3.39,0,6.21,1.15,8.46,3.46,2.25,2.3,3.39,5.18,3.39,8.62Z'/%3e%3cpath%20class='st0'%20d='M60.61,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3crect%20class='st0'%20x='57.63'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M64.15,168.24v29.48h2.41v-13.19c.85,1.77,2.09,3.17,3.69,4.18,1.6,1.01,3.41,1.52,5.44,1.52,3.11,0,5.7-1.07,7.75-3.23,2.05-2.16,3.07-4.83,3.07-8.04s-1.04-5.86-3.09-8.02c-2.05-2.14-4.63-3.21-7.73-3.21-2.03,0-3.84.49-5.44,1.5-1.6,1.01-2.84,2.41-3.69,4.18v-5.16h-2.41ZM69.06,172.62c1.64-1.69,3.73-2.53,6.23-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36c-1.66,1.71-3.73,2.55-6.23,2.55s-4.59-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33Z'/%3e%3cpath%20class='st0'%20d='M107.73,189.71v-21.48h-2.42v12.59c0,2.1-.65,3.79-1.97,5.08-1.32,1.3-3.05,1.95-5.18,1.95s-3.69-.64-4.93-1.91c-1.26-1.28-1.89-2.96-1.89-5.04v-12.67h-2.4v13.35c0,2.61.79,4.69,2.35,6.27,1.56,1.58,3.61,2.37,6.15,2.37,3.65-.02,6.27-1.52,7.85-4.53v4.01h2.42Z'/%3e%3cpolygon%20class='st0'%20points='117.35%20189.71%20117.35%20170.46%20122.55%20170.46%20122.55%20168.24%20117.35%20168.24%20117.35%20161.9%20114.94%20162.38%20114.94%20168.24%20110.01%20168.24%20110.01%20170.46%20114.94%20170.46%20114.94%20189.71%20117.35%20189.71'/%3e%3cpath%20class='st0'%20d='M144.27,189.71v-21.48h-2.42v5.12c-.87-1.75-2.13-3.13-3.73-4.14-1.6-1.01-3.41-1.5-5.4-1.5-3.08,0-5.64,1.07-7.69,3.21-2.05,2.16-3.09,4.83-3.09,8.02s1.04,5.88,3.09,8.04c2.05,2.16,4.63,3.23,7.69,3.23,1.99,0,3.79-.51,5.4-1.52,1.6-1.01,2.84-2.39,3.73-4.13v5.14h2.42ZM139.36,185.31c-1.66,1.71-3.73,2.55-6.23,2.55s-4.53-.84-6.19-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.19-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36Z'/%3e%3cpath%20class='st0'%20d='M158.18,170.09c2.09,0,3.9.62,5.46,1.85,1.54,1.23,2.56,2.84,3.02,4.83h2.5c-.47-2.63-1.73-4.79-3.73-6.5-2.03-1.71-4.44-2.55-7.25-2.55-3.19,0-5.84,1.07-8,3.21-2.15,2.16-3.23,4.83-3.23,8.02s1.08,5.88,3.23,8.04c2.13,2.16,4.81,3.23,8,3.23,2.8,0,5.22-.84,7.25-2.55,2.01-1.71,3.27-3.87,3.73-6.52h-2.5c-.47,2-1.48,3.62-3.02,4.85-1.56,1.23-3.37,1.85-5.46,1.85-2.5,0-4.57-.84-6.23-2.55-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3crect%20class='st0'%20x='171.72'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M174.71,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3cpath%20class='st0'%20d='M176.86,178.95c0,3.21,1.08,5.88,3.23,8.04,2.15,2.16,4.83,3.23,8.02,3.23s5.85-1.07,7.98-3.23c2.13-2.16,3.19-4.83,3.19-8.04s-1.06-5.86-3.19-8.02c-2.13-2.14-4.79-3.21-7.98-3.21s-5.86,1.07-8.02,3.21c-2.15,2.16-3.23,4.83-3.23,8.02ZM188.09,170.09c2.5,0,4.57.84,6.21,2.53,1.64,1.71,2.48,3.8,2.48,6.33s-.83,4.65-2.48,6.36c-1.64,1.71-3.71,2.55-6.21,2.55s-4.57-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3cpolygon%20class='st0'%20points='194.03%20160.01%20190.83%20160.01%20186.46%20165.15%20189.08%20165.15%20194.03%20160.01'/%3e%3cpath%20class='st0'%20d='M221.5,189.71v-13.02c0-2.69-.81-4.86-2.44-6.5-1.64-1.65-3.79-2.47-6.45-2.47-3.75,0-6.68,1.67-8.22,4.71v-4.2h-2.42v21.48h2.42v-12.22c0-2.22.69-4.01,2.07-5.37,1.38-1.36,3.19-2.04,5.44-2.04s3.92.66,5.24,2c1.32,1.34,1.97,3.11,1.97,5.33v12.3h2.4Z'/%3e%3cpath%20class='st0'%20d='M57.27,225.24c-2.82-2.23-5.61-3.43-9.59-4.53-5.11-1.37-7.66-3.3-7.66-5.87,0-1.17.46-2.17,1.43-2.97.96-.8,2.12-1.2,3.52-1.2,1.49,0,2.75.47,3.72,1.4.96.93,1.46,2.1,1.46,3.5h10.78c0-4.1-1.53-7.5-4.55-10.23-3.02-2.73-6.83-4.1-11.42-4.1s-8.23,1.33-11.25,4c-3.02,2.67-4.51,6-4.51,10s1.26,7.4,3.75,9.73c2.49,2.37,5.68,4.03,9.56,5.03,5.54,1.43,8.29,3.47,8.29,6.06,0,1.27-.53,2.33-1.59,3.2-1.06.87-2.39,1.3-3.98,1.3s-3.05-.53-4.18-1.6c-1.16-1.07-1.73-2.37-1.73-3.93h-10.82c0,4.3,1.59,7.86,4.78,10.7,3.15,2.83,7.1,4.26,11.81,4.26s8.66-1.4,11.81-4.2c3.15-2.77,4.71-6.26,4.71-10.43,0-4.43-1.56-7.9-4.35-10.13Z'/%3e%3cpolygon%20class='st0'%20points='118.26%20236.54%20110.23%20214.38%2098.88%20214.38%20113.02%20249.17%20123.21%20249.17%20137.28%20214.38%20126.19%20214.38%20118.26%20236.54'/%3e%3crect%20class='st0'%20x='139.25'%20y='214.38'%20width='9.92'%20height='34.79'/%3e%3cpath%20class='st0'%20d='M144.2,199.53c-1.72,0-3.18.57-4.35,1.73-1.16,1.17-1.76,2.6-1.76,4.33s.6,3.23,1.76,4.4c1.16,1.17,2.62,1.73,4.35,1.73s3.25-.57,4.45-1.73c1.16-1.17,1.76-2.63,1.76-4.4s-.6-3.17-1.76-4.33c-1.19-1.17-2.69-1.73-4.45-1.73Z'/%3e%3crect%20class='st0'%20x='154.93'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3crect%20class='st0'%20x='170.61'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3cpath%20class='st0'%20d='M211.58,214.38v3.8c-2.82-3.1-6.34-4.63-10.49-4.63-4.75,0-8.73,1.73-11.91,5.2-3.22,3.5-4.81,7.83-4.81,13s1.59,9.53,4.81,13.03c3.19,3.5,7.17,5.23,11.91,5.23,4.18-.03,7.67-1.57,10.49-4.67v3.83h9.92v-34.79h-9.92ZM209.19,237.9c-1.63,1.63-3.65,2.47-6.11,2.47s-4.41-.83-6.01-2.47c-1.63-1.63-2.42-3.7-2.42-6.17s.8-4.5,2.42-6.13c1.59-1.63,3.58-2.43,6.01-2.43s4.45.8,6.07,2.43c1.63,1.63,2.42,3.7,2.42,6.13s-.8,4.53-2.39,6.17Z'/%3e%3cpath%20class='st0'%20d='M82.34,213.54c-5.34,0-9.82,1.73-13.37,5.2-3.55,3.5-5.34,7.83-5.34,13s1.79,9.53,5.34,13.03c3.55,3.5,8.03,5.23,13.37,5.23,4.25,0,8-1.13,11.25-3.37,1.05-.73,1.99-1.55,2.84-2.43l-6.5-6.37h-.13c-1.19,2-3.98,3.47-7.27,3.47-4.08,0-7.2-2.43-8.29-6.33h26.51c.17-.73.27-1.77.27-3.07,0-5.3-1.79-9.66-5.34-13.16-3.58-3.47-8.03-5.2-13.34-5.2ZM74.31,228.34c1.19-3.83,4.15-6.2,8.03-6.2s6.97,2.37,8,6.2h-16.03Z'/%3e%3c/svg%3e",qi=({appName:e,orgName:t,username:r,footerText:s,navItems:n,selectedNav:a,onSelectNav:i,width:l="200px"})=>{const{theme:c}=Bi(),d=c==="dark"?ef:tf;return o.jsxs("aside",{className:"flex flex-col h-screen bg-[var(--color-ds-background-page)]",style:{width:l},children:[o.jsxs("div",{className:"flex gap-1 flex-col items-center py-4 space-y-1",children:[o.jsx("img",{src:d,alt:"Logo Diputación",className:"w-20 h-20"}),o.jsx("span",{className:"text-[var(--color-ds-text-primary)] text-ds-lg ",children:e}),o.jsx("span",{className:"text-ds-sm text-[var(--color-ds-text-secondary)]",children:t}),o.jsx("span",{className:"text-ds-sm text-[var(--color-ds-text-secondary)]",children:r}),o.jsx("div",{className:"w-1/5 h-0.5 rounded-full bg-[var(--color-ds-background-accent)] mt-2"})]}),o.jsx("nav",{className:"flex-1 overflow-auto pt-3",children:o.jsx(Xn,{items:n,selected:a,onSelect:i})}),o.jsx("div",{className:"px-4 w-full py-3",children:o.jsx("span",{className:"text-ds-sm w-full text-center text-[var(--color-ds-text-secondary)]",children:s})})]})};function rf({hideSidebar:e=!1,sidebar:t,header:r,children:s}){return o.jsxs("div",{className:"flex h-screen overflow-hidden bg-[var(--color-ds-background-page)]",children:[!e&&o.jsx(qi,{...t}),o.jsxs("div",{className:`flex-1 flex flex-col overflow-auto [scrollbar-gutter:stable_both-edges] ${e?"px-0":"px-10"}`,children:[o.jsx(Ui,{...r}),o.jsx("main",{className:"flex-1",children:s})]})]})}function sf({columns:e,data:t,loadData:r,loading:s,idAccessor:n,multiSelect:a=!1,onSelectionChange:i,pageSize:l=10,initialSort:c,onSort:d,className:u,onRowDoubleClick:f}){const h=t!==void 0,[p,v]=b.useState([]),[g,x]=b.useState(!1),m=b.useRef(null);b.useEffect(()=>{var I;if(!r||h)return;(I=m.current)==null||I.abort();const k=new AbortController;return m.current=k,x(!0),r().then(U=>{k.signal.aborted||v(U)}).finally(()=>{k.signal.aborted||x(!1)}),()=>k.abort()},[r,h]);const w=b.useMemo(()=>h?t:p,[t,p,h]),y=s??(r?g:!1),[T,N]=b.useState(new Set),[_,A]=b.useState(1),[S,$]=b.useState(c==null?void 0:c.sortBy),[V,z]=b.useState((c==null?void 0:c.sortDir)??"asc"),q=k=>typeof n=="function"?n(k):k[n],D=b.useRef(null);b.useEffect(()=>{D.current!==w&&(N(new Set),A(1),D.current=w)},[w]);const P=b.useMemo(()=>{if(!S)return w;const k=V==="asc"?1:-1;return[...w].sort((I,U)=>{const G=I[S],ee=U[S];return G==null?-k:ee==null||G>ee?k:G<ee?-k:0})},[w,S,V]),E=Math.max(1,Math.ceil(P.length/l)),te=b.useMemo(()=>{const k=(_-1)*l;return P.slice(k,k+l)},[P,_,l]),ne=k=>{const I=new Set(T);I.has(k)?I.delete(k):I.add(k),N(I),i==null||i(w.filter(U=>I.has(q(U))))},K=()=>{const k=te.every(U=>T.has(q(U))),I=new Set(T);te.forEach(U=>{k?I.delete(q(U)):I.add(q(U))}),N(I),i==null||i(w.filter(U=>I.has(q(U))))},le=k=>{if(!k.sortable)return;const I=typeof k.accessor=="string"?k.accessor:k.sortKey;if(S===I){const U=V==="asc"?"desc":"asc";z(U),d==null||d(I,U)}else $(I),z("asc"),d==null||d(I,"asc");A(1)},C=()=>y?o.jsx("tbody",{children:Array.from({length:l}).map((k,I)=>o.jsxs("tr",{children:[a&&o.jsx("td",{children:o.jsx(Xt,{width:"1rem",height:"1rem",variant:"circle"})}),e.map((U,G)=>o.jsx("td",{children:o.jsx(Xt,{width:"100%",height:"1em",variant:"rect"})},G))]},I))}):te.length?o.jsx("tbody",{children:te.map(k=>{const I=q(k);return o.jsxs("tr",{className:se("hover:bg-gray-50",f&&"cursor-pointer select-none"),onDoubleClick:f?()=>f(k):void 0,title:f?"Doble clic para abrir":void 0,children:[a&&o.jsx("td",{children:o.jsx("input",{type:"checkbox",checked:T.has(I),onChange:()=>ne(I),onDoubleClick:U=>U.stopPropagation()})}),e.map((U,G)=>{const ee=U.render?U.render(k):typeof U.accessor=="function"?U.accessor(k):k[U.accessor];return o.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-sm",children:ee},G)})]},I)})}):o.jsx("tbody",{children:o.jsx("tr",{children:o.jsx("td",{colSpan:e.length+(a?1:0),children:"No hay datos"})})});return o.jsxs("div",{className:se("w-full overflow-auto",u),children:[o.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[o.jsx("thead",{className:"bg-gray-50",children:o.jsxs("tr",{children:[a&&o.jsx("th",{children:o.jsx("input",{type:"checkbox",checked:te.length>0&&te.every(k=>T.has(q(k))),onChange:K,onDoubleClick:k=>k.stopPropagation()})}),e.map(k=>{const I=typeof k.accessor=="string"?k.accessor:k.header,U=S===(typeof k.accessor=="string"?k.accessor:k.sortKey);return o.jsx("th",{className:se("px-4 py-2 text-left text-sm font-medium text-gray-700",k.width),onClick:()=>le(k),children:o.jsxs("div",{className:"inline-flex items-center space-x-1 cursor-pointer",children:[o.jsx("span",{children:k.header}),k.sortable&&o.jsx("span",{className:"text-xs",children:U?V==="asc"?"▲":"▼":"⇵"})]})},I)})]})}),C()]}),o.jsxs("div",{className:"flex items-center justify-between py-2 px-4",children:[o.jsx("span",{className:"text-sm text-gray-700",children:y?"Cargando...":`Página ${_} de ${E}`}),o.jsxs("div",{className:"space-x-2",children:[o.jsx(ie,{size:"sm",variant:"outline",disabled:y||_<=1,onClick:()=>A(k=>Math.max(1,k-1)),children:"Prev"}),o.jsx(ie,{size:"sm",variant:"outline",disabled:y||_>=E,onClick:()=>A(k=>Math.min(E,k+1)),children:"Next"})]})]})]})}function Wi({control:e,name:t,rules:r,defaultValue:s=!1,checked:n,onChange:a,disabled:i=!1,label:l,labelPosition:c="right",errorMessage:d="",className:u}){const f=b.useId();if(e&&t)return o.jsx(gt,{name:t,control:e,rules:r,defaultValue:s,render:({field:p,fieldState:v})=>{var g;return o.jsx(Wi,{checked:p.value,onChange:p.onChange,disabled:i,label:l,labelPosition:c,errorMessage:((g=v.error)==null?void 0:g.message)||"",className:u})}});const h=!!n;return o.jsxs("div",{className:se("flex flex-col",u),children:[o.jsxs("label",{className:se("inline-flex items-center space-x-3 select-none",i&&"opacity-50 cursor-not-allowed"),htmlFor:f,children:[l&&c==="left"&&o.jsx("span",{className:"text-ds-md text-[var(--color-ds-text-primary)]",children:l}),o.jsx("button",{id:f,type:"button",role:"switch","aria-checked":h,disabled:i,onClick:()=>!i&&(a==null?void 0:a(!h)),className:se("relative inline-flex items-center h-8 w-16","bg-[var(--color-ds-background-accent)] rounded-full transition-colors duration-200","focus:outline-none "),children:o.jsx("div",{className:se("absolute h-6 w-6 bg-[var(--color-ds-background-page)] rounded-full shadow transform transition-transform duration-200",h?"translate-x-9":"translate-x-1")})}),l&&c==="right"&&o.jsx("span",{className:"text-ds-md text-[var(--color-ds-text-primary)]",children:l})]}),o.jsx("div",{className:"pt-1 min-h-[18px] w-full",children:d?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:d}):o.jsx("span",{"aria-hidden":"true",children:" "})})]})}function Ki({items:e,value:t,onValueChange:r,multiple:s=!0,dense:n=!1,className:a}){const i=b.useMemo(()=>e.filter(v=>v.defaultOpen&&!v.disabled).map(v=>v.id),[e]),[l,c]=b.useState(i),d=t??l,u=v=>{r?r(v):c(v)},f=(v,g)=>{g&&u(s?d.includes(v)?d.filter(x=>x!==v):[...d,v]:d.includes(v)?[]:[v])},h=(v,g,x)=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),f(g,x))},p=n?"py-1":"py-2";return o.jsx("div",{className:["divide-y","divide-[var(--color-ds-border-default-50)]",a].filter(Boolean).join(" "),children:e.map(v=>{const g=d.includes(v.id),x=!v.disabled;return o.jsxs("section",{"aria-disabled":v.disabled||void 0,children:[o.jsxs("button",{type:"button",onClick:()=>f(v.id,x),onKeyDown:m=>h(m,v.id,x),"aria-expanded":g,className:["w-full flex items-center justify-between gap-2 text-left select-none",p,"text-[var(--color-ds-text-primary)]",v.disabled?"opacity-60 cursor-not-allowed":"hover:bg-[color-mix(in_srgb,var(--color-ds-background-surface)_80%,transparent)]"].join(" "),children:[o.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[v.leftAdornment&&o.jsx("span",{className:"shrink-0",children:v.leftAdornment}),o.jsx("span",{className:"font-medium truncate",children:v.title})]}),o.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[v.actions,o.jsx(Os,{className:["h-4 w-4 transition-transform",g?"rotate-180":"",v.disabled?"opacity-40":""].join(" ")})]})]}),g&&o.jsx("div",{className:[n?"py-1":"py-2"].join(" "),children:v.content})]},v.id)})})}const to=e=>{let t;const r=new Set,s=(d,u)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const h=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),r.forEach(p=>p(t,h))}},n=()=>t,l={setState:s,getState:n,getInitialState:()=>c,subscribe:d=>(r.add(d),()=>r.delete(d))},c=t=e(s,n,l);return l},nf=e=>e?to(e):to,af=e=>e;function of(e,t=af){const r=b.useSyncExternalStore(e.subscribe,b.useCallback(()=>t(e.getState()),[e,t]),b.useCallback(()=>t(e.getInitialState()),[e,t]));return b.useDebugValue(r),r}const ro=e=>{const t=nf(e),r=s=>of(t,s);return Object.assign(r,t),r},lf=e=>e?ro(e):ro;var Gi=Symbol.for("immer-nothing"),so=Symbol.for("immer-draftable"),ct=Symbol.for("immer-state"),cf=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function st(e,...t){if(process.env.NODE_ENV!=="production"){const r=cf[e],s=typeof r=="function"?r.apply(null,t):r;throw new Error(`[Immer] ${s}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var fr=Object.getPrototypeOf;function mr(e){return!!e&&!!e[ct]}function Qt(e){var t;return e?Ji(e)||Array.isArray(e)||!!e[so]||!!((t=e.constructor)!=null&&t[so])||Vr(e)||Ps(e):!1}var df=Object.prototype.constructor.toString();function Ji(e){if(!e||typeof e!="object")return!1;const t=fr(e);if(t===null)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===df}function ks(e,t){Ls(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,s)=>t(s,r,e))}function Ls(e){const t=e[ct];return t?t.type_:Array.isArray(e)?1:Vr(e)?2:Ps(e)?3:0}function Tn(e,t){return Ls(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Zi(e,t,r){const s=Ls(e);s===2?e.set(t,r):s===3?e.add(r):e[t]=r}function uf(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Vr(e){return e instanceof Map}function Ps(e){return e instanceof Set}function Gt(e){return e.copy_||e.base_}function _n(e,t){if(Vr(e))return new Map(e);if(Ps(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Ji(e);if(t===!0||t==="class_only"&&!r){const s=Object.getOwnPropertyDescriptors(e);delete s[ct];let n=Reflect.ownKeys(s);for(let a=0;a<n.length;a++){const i=n[a],l=s[i];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(s[i]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[i]})}return Object.create(fr(e),s)}else{const s=fr(e);if(s!==null&&r)return{...e};const n=Object.create(s);return Object.assign(n,e)}}function Qn(e,t=!1){return zs(e)||mr(e)||!Qt(e)||(Ls(e)>1&&Object.defineProperties(e,{set:{value:as},add:{value:as},clear:{value:as},delete:{value:as}}),Object.freeze(e),t&&Object.values(e).forEach(r=>Qn(r,!0))),e}function as(){st(2)}function zs(e){return Object.isFrozen(e)}var ff={};function er(e){const t=ff[e];return t||st(0,e),t}var Fr;function Yi(){return Fr}function mf(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function no(e,t){t&&(er("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Fn(e){On(e),e.drafts_.forEach(hf),e.drafts_=null}function On(e){e===Fr&&(Fr=e.parent_)}function ao(e){return Fr=mf(Fr,e)}function hf(e){const t=e[ct];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function oo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[ct].modified_&&(Fn(t),st(4)),Qt(e)&&(e=Ns(t,e),t.parent_||Ss(t,e)),t.patches_&&er("Patches").generateReplacementPatches_(r[ct].base_,e,t.patches_,t.inversePatches_)):e=Ns(t,r,[]),Fn(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Gi?e:void 0}function Ns(e,t,r){if(zs(t))return t;const s=t[ct];if(!s)return ks(t,(n,a)=>io(e,s,t,n,a,r)),t;if(s.scope_!==e)return t;if(!s.modified_)return Ss(e,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;const n=s.copy_;let a=n,i=!1;s.type_===3&&(a=new Set(n),n.clear(),i=!0),ks(a,(l,c)=>io(e,s,n,l,c,r,i)),Ss(e,n,!1),r&&e.patches_&&er("Patches").generatePatches_(s,r,e.patches_,e.inversePatches_)}return s.copy_}function io(e,t,r,s,n,a,i){if(process.env.NODE_ENV!=="production"&&n===r&&st(5),mr(n)){const l=a&&t&&t.type_!==3&&!Tn(t.assigned_,s)?a.concat(s):void 0,c=Ns(e,n,l);if(Zi(r,s,c),mr(c))e.canAutoFreeze_=!1;else return}else i&&r.add(n);if(Qt(n)&&!zs(n)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ns(e,n),(!t||!t.scope_.parent_)&&typeof s!="symbol"&&(Vr(r)?r.has(s):Object.prototype.propertyIsEnumerable.call(r,s))&&Ss(e,n)}}function Ss(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Qn(t,r)}function pf(e,t){const r=Array.isArray(e),s={type_:r?1:0,scope_:t?t.scope_:Yi(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let n=s,a=ea;r&&(n=[s],a=Or);const{revoke:i,proxy:l}=Proxy.revocable(n,a);return s.draft_=l,s.revoke_=i,l}var ea={get(e,t){if(t===ct)return e;const r=Gt(e);if(!Tn(r,t))return bf(e,r,t);const s=r[t];return e.finalized_||!Qt(s)?s:s===Qs(e.base_,t)?(en(e),e.copy_[t]=Dn(s,e)):s},has(e,t){return t in Gt(e)},ownKeys(e){return Reflect.ownKeys(Gt(e))},set(e,t,r){const s=Hi(Gt(e),t);if(s!=null&&s.set)return s.set.call(e.draft_,r),!0;if(!e.modified_){const n=Qs(Gt(e),t),a=n==null?void 0:n[ct];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(uf(r,n)&&(r!==void 0||Tn(e.base_,t)))return!0;en(e),Rn(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Qs(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,en(e),Rn(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Gt(e),s=Reflect.getOwnPropertyDescriptor(r,t);return s&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:s.enumerable,value:r[t]}},defineProperty(){st(11)},getPrototypeOf(e){return fr(e.base_)},setPrototypeOf(){st(12)}},Or={};ks(ea,(e,t)=>{Or[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Or.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&st(13),Or.set.call(this,e,t,void 0)};Or.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&st(14),ea.set.call(this,e[0],t,r,e[0])};function Qs(e,t){const r=e[ct];return(r?Gt(r):e)[t]}function bf(e,t,r){var n;const s=Hi(t,r);return s?"value"in s?s.value:(n=s.get)==null?void 0:n.call(e.draft_):void 0}function Hi(e,t){if(!(t in e))return;let r=fr(e);for(;r;){const s=Object.getOwnPropertyDescriptor(r,t);if(s)return s;r=fr(r)}}function Rn(e){e.modified_||(e.modified_=!0,e.parent_&&Rn(e.parent_))}function en(e){e.copy_||(e.copy_=_n(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var gf=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,s)=>{if(typeof t=="function"&&typeof r!="function"){const a=r;r=t;const i=this;return function(c=a,...d){return i.produce(c,u=>r.call(this,u,...d))}}typeof r!="function"&&st(6),s!==void 0&&typeof s!="function"&&st(7);let n;if(Qt(t)){const a=ao(this),i=Dn(t,void 0);let l=!0;try{n=r(i),l=!1}finally{l?Fn(a):On(a)}return no(a,s),oo(n,a)}else if(!t||typeof t!="object"){if(n=r(t),n===void 0&&(n=t),n===Gi&&(n=void 0),this.autoFreeze_&&Qn(n,!0),s){const a=[],i=[];er("Patches").generateReplacementPatches_(t,n,a,i),s(a,i)}return n}else st(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(i,...l)=>this.produceWithPatches(i,c=>t(c,...l));let s,n;return[this.produce(t,r,(i,l)=>{s=i,n=l}),s,n]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Qt(e)||st(8),mr(e)&&(e=xf(e));const t=ao(this),r=Dn(e,void 0);return r[ct].isManual_=!0,On(t),r}finishDraft(e,t){const r=e&&e[ct];(!r||!r.isManual_)&&st(9);const{scope_:s}=r;return no(s,t),oo(void 0,s)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(n.path.length===0&&n.op==="replace"){e=n.value;break}}r>-1&&(t=t.slice(r+1));const s=er("Patches").applyPatches_;return mr(e)?s(e,t):this.produce(e,n=>s(n,t))}};function Dn(e,t){const r=Vr(e)?er("MapSet").proxyMap_(e,t):Ps(e)?er("MapSet").proxySet_(e,t):pf(e,t);return(t?t.scope_:Yi()).drafts_.push(r),r}function xf(e){return mr(e)||st(10,e),Xi(e)}function Xi(e){if(!Qt(e)||zs(e))return e;const t=e[ct];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=_n(e,t.scope_.immer_.useStrictShallowCopy_)}else r=_n(e,!0);return ks(r,(s,n)=>{Zi(r,s,Xi(n))}),t&&(t.finalized_=!1),r}var vf=new gf,yf=vf.produce;const tn=e=>Number(e.toFixed(2)),dr=e=>Math.max(0,Math.min(100,e??0)),wf={text:{name:"text",label:"Texto"},number:{name:"number",label:"Número"},email:{name:"email",label:"Email"},select:{name:"select",label:"Select"},checkbox:{name:"checkbox",label:"Checkbox"},date:{name:"date",label:"Fecha"},textarea:{name:"textarea",label:"Textarea"},file:{name:"file",label:"Archivo"}},_e=e=>e.layout.find(t=>t.type==="rows"),mt=(e,t)=>{if(t==null)return _e(e);const r=e.layout[t];return r&&r.type==="rows"?r:_e(e)},rn=e=>e<=1?["w-full"]:e===2?["w-1/2","w-1/2"]:e===3?["w-1/3","w-1/3","w-1/3"]:Array.from({length:e},()=>"flex-1"),sn={1:["w-full"],2:["w-1/2","w-1/2"],3:["w-1/3","w-1/3","w-1/3"],4:["w-1/4","w-1/4","w-1/4","w-1/4"],"1/3-2/3":["w-1/3","w-2/3"],"2/3-1/3":["w-2/3","w-1/3"],"1/4-3/4":["w-1/4","w-3/4"],"3/4-1/4":["w-3/4","w-1/4"]},$e=(e,t)=>{for(let r=0;r<e.layout.length;r++){const s=e.layout[r];if((s==null?void 0:s.type)!=="tabs")continue;const n=s.tabs.findIndex(a=>a.key===t);if(n>=0)return{nodeIdx:r,tabIdx:n}}return null},jf=e=>{const t=[];return e.layout.forEach(r=>{r.type==="rows"&&r.sections.forEach(s=>s.rows.forEach(n=>n.columns.forEach(a=>(a.fields??[]).forEach(i=>t.push(i))))),r.type==="tabs"&&r.tabs.forEach(s=>s.sections.forEach(n=>n.rows.forEach(a=>a.columns.forEach(i=>(i.fields??[]).forEach(l=>t.push(l))))))}),t},kf=e=>({type:"rows",sections:[{sectionTitle:e??"Sección",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}),Nf=()=>({type:"tabs",tabs:[{key:`tab_${Date.now().toString(36)}_1`,label:"Pestaña 1",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]},{key:`tab_${Date.now().toString(36)}_2`,label:"Pestaña 2",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}]}),ir=(e,t)=>jf(e).includes(t),Mn=e=>e.replace(/(?:_copy)+$/i,"").replace(/_(\d+)$/i,""),Qi=e=>e.replace(/\s\((\d+)\)$/i,""),Xe=(e,t)=>{const r=e||"campo";if(!t.has(r))return r;let s=2;for(;t.has(`${r}_${s}`);)s++;return`${r}_${s}`},ot=(e,t)=>{const r=e||"Campo";if(!t.has(r))return r;let s=2;for(;t.has(`${r} (${s})`);)s++;return`${r} (${s})`},Qe=e=>{const t=(e.type??"text").toString(),r=wf[t]??{name:"campo",label:"Campo"},s=e.name?Mn(e.name):r.name,n=e.label?Qi(e.label):r.label;return{baseName:s,baseLabel:n}},Sf={layout:[{type:"rows",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}],fields:[],onSubmit:async()=>{},successMessage:"Guardado",errorMessage:"Error"},J=lf((e,t)=>({schema:Sf,selection:{kind:"none"},past:[],future:[],setSchema:r=>{const s=t().schema,n=yf(s,r),a=n;e(i=>({...i,schema:a,past:[...i.past,s],future:[]}))},setSelection:r=>e({selection:r}),undo:()=>e(r=>r.past.length?{schema:r.past[r.past.length-1],past:r.past.slice(0,-1),future:[r.schema,...r.future]}:r),redo:()=>e(r=>r.future.length?{schema:r.future[0],past:[...r.past,r.schema],future:r.future.slice(1)}:r),resetHistory:()=>e(r=>({past:[],future:[]})),addField:r=>t().setSchema(s=>{const{baseName:n,baseLabel:a}=Qe(r),i=new Set(s.fields.map(u=>u.name).filter(Boolean)),l=new Set(s.fields.map(u=>u.label??"").filter(Boolean)),c=Xe(n,i),d=ot(a,l);r.name=c,r.label||(r.label=d),s.fields.push(r)}),addFieldAt:(r,s)=>t().setSchema(n=>{const{baseName:a,baseLabel:i}=Qe(r),l=new Set(n.fields.map(h=>h.name).filter(Boolean)),c=new Set(n.fields.map(h=>h.label??"").filter(Boolean)),d=Xe(a,l),u=ot(i,c);r.name=d,r.label||(r.label=u);const f=Math.max(0,Math.min(s??n.fields.length,n.fields.length));n.fields.splice(f,0,r)}),removeField:r=>t().setSchema(s=>{s.fields=s.fields.filter(n=>n.name!==r),s.layout.forEach(n=>{n.type==="rows"&&n.sections.forEach(a=>a.rows.forEach(i=>i.columns.forEach(l=>{l.fields=(l.fields??[]).filter(c=>c!==r)}))),n.type==="tabs"&&n.tabs.forEach(a=>a.sections.forEach(i=>i.rows.forEach(l=>l.columns.forEach(c=>{c.fields=(c.fields??[]).filter(d=>d!==r)}))))})}),updateField:(r,s)=>t().setSchema(n=>{const a=n.fields.findIndex(i=>i.name===r);a>=0&&s(n.fields[a])}),duplicateField:(r,s)=>t().setSchema(n=>{const a=n.fields.findIndex(v=>v.name===r);if(a<0)return;const i=n.fields[a],l=Mn((s==null?void 0:s.trim())||i.name||""),c=Qi(i.label??""),d=new Set(n.fields.map(v=>v.name).filter(Boolean)),u=new Set(n.fields.map(v=>v.label??"").filter(Boolean)),f=Xe(l||Qe(i).baseName,d),h=ot(c||Qe(i).baseLabel,u),p=JSON.parse(JSON.stringify(i));p.name=f,p.label=h,n.fields.splice(a+1,0,p)}),renameField:(r,s)=>t().setSchema(n=>{const a=n.fields.findIndex(d=>d.name===r);if(a<0)return;const i=Mn((s??r).trim()||"campo"),l=new Set(n.fields.map(d=>d.name).filter(Boolean));l.delete(r);const c=Xe(i,l);n.fields[a].name=c,n.layout.forEach(d=>{d.type==="rows"&&d.sections.forEach(u=>u.rows.forEach(f=>f.columns.forEach(h=>{h.fields&&(h.fields=h.fields.map(p=>p===r?c:p))}))),d.type==="tabs"&&d.tabs.forEach(u=>u.sections.forEach(f=>f.rows.forEach(h=>h.columns.forEach(p=>{p.fields&&(p.fields=p.fields.map(v=>v===r?c:v))}))))})}),addSection:r=>t().setSchema(s=>{const n=_e(s);if(!n)return;const a={sectionTitle:r??"Nueva sección",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]};n.sections.push(a)}),renameSection:(r,s)=>t().setSchema(n=>{const a=_e(n);if(!a)return;const i=a.sections[r];i&&(i.sectionTitle=(s??"").trim()||"Sección")}),moveSection:(r,s,n)=>e(a=>{const i=[...a.schema.layout],l=i[r];if(!l||l.type!=="rows")return a;const c=[...l.sections],[d]=c.splice(s,1),u=Math.max(0,Math.min(n,c.length));return c.splice(u,0,d),i[r]={...l,sections:c},{schema:{...a.schema,layout:i}}}),removeSection:r=>t().setSchema(s=>{const n=_e(s);if(!n||r<0||r>=n.sections.length)return;const a=[...n.sections];a.splice(r,1),n.sections=a}),duplicateSection:r=>t().setSchema(s=>{const n=_e(s);if(!n)return;const a=n.sections[r];if(!a)return;const i=JSON.parse(JSON.stringify(a)),l=(a.sectionTitle||"Sección").toString(),c=n.sections.map(f=>f.sectionTitle||""),d=new Set(c);let u=l;if(d.has(u)){let f=2;for(;d.has(`${l} (${f})`);)f++;u=`${l} (${f})`}i.sectionTitle=u,n.sections.splice(r+1,0,i)}),addRowsBlockAt:(r,s)=>t().setSchema(n=>{const a=Math.max(0,Math.min(r,n.layout.length));n.layout.splice(a,0,kf(s))}),addTabsContainerAt:r=>t().setSchema(s=>{const n=Math.max(0,Math.min(r,s.layout.length));s.layout.splice(n,0,Nf())}),moveLayoutNode:(r,s)=>t().setSchema(n=>{const a=n.layout.length;if(r<0||r>=a)return;const i=Math.max(0,Math.min(s,a-1));if(r===i)return;const l=[...n.layout],[c]=l.splice(r,1);l.splice(i,0,c),n.layout=l}),removeLayoutNode:r=>t().setSchema(s=>{if(r<0||r>=s.layout.length)return;const n=[...s.layout];n.splice(r,1),s.layout=n}),addTabsContainer:()=>t().setSchema(r=>{const s={type:"tabs",tabs:[{key:"tab1",label:"Pestaña 1",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]},{key:"tab2",label:"Pestaña 2",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}]};r.layout.push(s)}),addTabAfter:r=>t().setSchema(s=>{const n=$e(s,r);if(!n)return;const a=s.layout[n.nodeIdx],i="Nueva pestaña",l=new Set(a.tabs.map(f=>f.label));let c=i,d=2;for(;l.has(c);)c=`${i} (${d++})`;const u={key:`tab_${Date.now().toString(36)}`,label:c,sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]};a.tabs.splice(n.tabIdx+1,0,u)}),removeTab:r=>t().setSchema(s=>{const n=$e(s,r);if(!n)return;const a=s.layout[n.nodeIdx];a.tabs.length<=1||a.tabs.splice(n.tabIdx,1)}),renameTab:(r,s)=>t().setSchema(n=>{const a=$e(n,r);if(!a)return;const i=n.layout[a.nodeIdx];i.tabs[a.tabIdx].label=(s??"").trim()||"Pestaña"}),moveTab:(r,s,n)=>e(a=>{const i=[...a.schema.layout],l=i[r];if(!l||l.type!=="tabs")return a;const c=[...l.tabs],[d]=c.splice(s,1),u=Math.max(0,Math.min(n,c.length));return c.splice(u,0,d),i[r]={...l,tabs:c},{schema:{...a.schema,layout:i}}}),moveTabSection:(r,s,n,a)=>e(i=>{const l=[...i.schema.layout],c=l[r];if(!c||c.type!=="tabs")return i;const d=c.tabs.find(v=>v.key===s);if(!d)return i;const u=[...d.sections],[f]=u.splice(n,1),h=Math.max(0,Math.min(a,u.length));u.splice(h,0,f);const p=c.tabs.map(v=>v.key===s?{...v,sections:u}:v);return l[r]={...c,tabs:p},{schema:{...i.schema,layout:l}}}),addSectionToTab:(r,s)=>t().setSchema(n=>{const a=$e(n,r);if(!a)return;n.layout[a.nodeIdx].tabs[a.tabIdx].sections.push({sectionTitle:s??"Nueva sección",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]})}),addRowToTabSection:(r,s)=>t().setSchema(n=>{var l;const a=$e(n,r);if(!a)return;(l=n.layout[a.nodeIdx].tabs[a.tabIdx].sections[s])==null||l.rows.push({title:"",columns:[{width:"w-full",fields:[]}]})}),renameTabSection:(r,s,n)=>t().setSchema(a=>{const i=$e(a,r);if(!i)return;const c=a.layout[i.nodeIdx].tabs[i.tabIdx].sections[s];c&&(c.sectionTitle=(n??"").trim()||"Sección")}),setTabRowColumns:(r,s,n,a)=>t().setSchema(i=>{var p,v;const l=$e(i,r);if(!l)return;const d=(v=(p=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[s])==null?void 0:p.rows)==null?void 0:v[n];if(!d)return;const u=(d.columns??[]).flatMap(g=>g.fields??[]),f=rn(a),h=Array.from({length:a},(g,x)=>({width:f[x],fields:[]}));u.forEach((g,x)=>h[x%a].fields.push(g)),d.columns=h}),addColumnToTabRow:(r,s,n)=>t().setSchema(a=>{var d,u;const i=$e(a,r);if(!i)return;const c=(u=(d=a.layout[i.nodeIdx].tabs[i.tabIdx].sections[s])==null?void 0:d.rows)==null?void 0:u[n];c&&c.columns.push({width:"w-1/2",fields:[]})}),removeTabColumn:(r,s,n,a)=>t().setSchema(i=>{var v,g;const l=$e(i,r);if(!l)return;const d=(g=(v=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[s])==null?void 0:v.rows)==null?void 0:g[n];if(!d)return;const u=d.columns??[];if(!u[a])return;const f=u[a],h=a>0?a-1:u[a+1]?a+1:-1,p=[...u];p.splice(a,1),h>=0&&p[h]&&(p[h].fields=[...p[h].fields??[],...f.fields??[]]),d.columns=p}),placeFieldInTabColumn:(r,s,n,a,i)=>t().setSchema(l=>{const c=$e(l,s);if(!c)return;const u=l.layout[c.nodeIdx].tabs[c.tabIdx].sections[n].rows[a].columns[i];let f=r;if(ir(l,r)){const h=l.fields.findIndex(p=>p.name===r);if(h>=0){const p=l.fields[h],{baseName:v,baseLabel:g}=Qe(p),x=new Set(l.fields.map(T=>T.name).filter(Boolean)),m=new Set(l.fields.map(T=>T.label??"").filter(Boolean));f=Xe(v,x);const w=ot(g,m),y=JSON.parse(JSON.stringify(p));y.name=f,y.label=w,l.fields.splice(h+1,0,y)}}u.fields=[...u.fields??[],f]}),moveFieldInTab:(r,s)=>t().setSchema(n=>{var p,v,g,x;const a=$e(n,r.tabKey);if(!a)return;const i=n.layout[a.nodeIdx],l=(v=(p=i.tabs[a.tabIdx].sections[r.s])==null?void 0:p.rows[r.r])==null?void 0:v.columns[r.c],c=(x=(g=i.tabs[a.tabIdx].sections[s.s])==null?void 0:g.rows[s.r])==null?void 0:x.columns[s.c];if(!l||!c)return;const d=[...l.fields??[]];if(r.idx<0||r.idx>=d.length)return;const[u]=d.splice(r.idx,1);l.fields=d;const f=[...c.fields??[]],h=s.idx===void 0?f.length:Math.max(0,Math.min(s.idx,f.length));f.splice(h,0,u),c.fields=f}),removeFieldFromTabLayout:r=>t().setSchema(s=>{var c,d;const n=$e(s,r.tabKey);if(!n)return;const i=(d=(c=s.layout[n.nodeIdx].tabs[n.tabIdx].sections[r.s])==null?void 0:c.rows[r.r])==null?void 0:d.columns[r.c];if(!i||!i.fields||r.idx<0||r.idx>=i.fields.length)return;const l=[...i.fields];l.splice(r.idx,1),i.fields=l}),moveRowInSection:(r,s,n)=>t().setSchema(a=>{const i=_e(a);if(!i)return;const l=i.sections[r];if(!l)return;const c=[...l.rows];if(s<0||s>=c.length)return;const d=Math.max(0,Math.min(n,c.length-1));if(s===d)return;const[u]=c.splice(s,1);c.splice(d,0,u),l.rows=c}),duplicateRowInSection:(r,s)=>t().setSchema(n=>{const a=_e(n);if(!a)return;const i=a.sections[r];if(!i)return;const l=i.rows[s];if(!l)return;const c=JSON.parse(JSON.stringify(l));i.rows.splice(s+1,0,c)}),removeRowFromSection:(r,s)=>t().setSchema(n=>{const a=_e(n);if(!a)return;const i=a.sections[r];if(!i)return;const l=[...i.rows];s<0||s>=l.length||(l.splice(s,1),l.length===0&&l.push({title:"",columns:[{width:"w-full",fields:[]}]}),i.rows=l)}),setRowColumnsPreset:(r,s,n)=>t().setSchema(a=>{var d,u;const i=_e(a);if(!i)return;const l=(u=(d=i.sections[r])==null?void 0:d.rows)==null?void 0:u[s];if(!l)return;const c=sn[n];c&&nn(l,c)}),setRowResponsive:(r,s,n)=>t().setSchema(a=>{var p,v;const i=_e(a);if(!i)return;const l=(v=(p=i.sections[Number(r)])==null?void 0:p.rows)==null?void 0:v[Number(s)];if(!l)return;const c=Math.max(n.desktop.count??1,n.tablet.count??1,n.mobile.count??1),d=(l.columns??[]).flatMap(g=>g.fields??[]),u=on(d,c),f=(g,x,m)=>x<(m??0)?dr((g==null?void 0:g[x])??0):null,h=Array.from({length:c},(g,x)=>{const m=f(n.mobile.widths,x,n.mobile.count),w=f(n.tablet.widths,x,n.tablet.count),y=f(n.desktop.widths,x,n.desktop.count);return{width:an(m,w,y),fields:u[x]??[]}});l.columns=h}),setRowColumnsAt:(r,s,n,a)=>t().setSchema(i=>{var h,p;const l=mt(i,r);if(!l)return;const c=(p=(h=l.sections[s])==null?void 0:h.rows)==null?void 0:p[n];if(!c)return;const d=(c.columns??[]).flatMap(v=>v.fields??[]),u=rn(a),f=Array.from({length:a},(v,g)=>({width:u[g],fields:[]}));d.forEach((v,g)=>f[g%a].fields.push(v)),c.columns=f}),addColumnToRowAt:(r,s,n)=>t().setSchema(a=>{var l,c,d,u;const i=mt(a,r);i&&((u=(d=(c=(l=i.sections[s])==null?void 0:l.rows)==null?void 0:c[n])==null?void 0:d.columns)==null||u.push({width:"w-1/2",fields:[]}))}),removeColumnAt:(r,s,n,a)=>t().setSchema(i=>{var p,v;const l=mt(i,r);if(!l)return;const c=(v=(p=l.sections[s])==null?void 0:p.rows)==null?void 0:v[n];if(!c)return;const d=c.columns??[];if(!d[a])return;const u=d[a],f=a>0?a-1:d[a+1]?a+1:-1,h=[...d];h.splice(a,1),f>=0&&h[f]&&(h[f].fields=[...h[f].fields??[],...u.fields??[]]),c.columns=h}),setRowColumnsPresetAt:(r,s,n,a)=>t().setSchema(i=>{var u,f;const l=mt(i,r);if(!l)return;const c=(f=(u=l.sections[s])==null?void 0:u.rows)==null?void 0:f[n];if(!c)return;const d=sn[a];d&&nn(c,d)}),setRowResponsiveAt:(r,s,n,a)=>t().setSchema(i=>{var v,g;const l=mt(i,r);if(!l)return;const c=(g=(v=l.sections[Number(s)])==null?void 0:v.rows)==null?void 0:g[Number(n)];if(!c)return;const d=Math.max(a.desktop.count??1,a.tablet.count??1,a.mobile.count??1),u=(x,m,w)=>m<(w??0)?dr((x==null?void 0:x[m])??0):null,f=Ef(c,d),h=f.flatMap(x=>x.fields??[]),p=on(h,d);for(let x=0;x<d;x++){const m=u(a.mobile.widths,x,a.mobile.count),w=u(a.tablet.widths,x,a.tablet.count),y=u(a.desktop.widths,x,a.desktop.count);f[x].width=an(m,w,y),f[x].fields=p[x]??[]}}),placeFieldInColumnAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var v,g,x,m;const d=mt(c,r);if(!d)return;const u=(m=(x=(g=(v=d.sections[n])==null?void 0:v.rows)==null?void 0:g[a])==null?void 0:x.columns)==null?void 0:m[i];if(!u)return;let f=s;if(ir(c,s)){const w=c.fields.findIndex(y=>y.name===s);if(w>=0){const y=c.fields[w],{baseName:T,baseLabel:N}=Qe(y),_=new Set(c.fields.map(V=>V.name).filter(Boolean)),A=new Set(c.fields.map(V=>V.label??"").filter(Boolean));f=Xe(T,_);const S=ot(N,A),$=JSON.parse(JSON.stringify(y));$.name=f,$.label=S,c.fields.splice(w+1,0,$)}}const h=[...u.fields??[]],p=l===void 0?h.length:Math.max(0,Math.min(l,h.length));h.splice(p,0,f),u.fields=h}),moveFieldAt:(r,s,n,a)=>t().setSchema(i=>{var g,x,m,w,y,T,N,_;const l=mt(i,r),c=mt(i,n);if(!l||!c)return;const d=(w=(m=(x=(g=l.sections[s.s])==null?void 0:g.rows)==null?void 0:x[s.r])==null?void 0:m.columns)==null?void 0:w[s.c],u=(_=(N=(T=(y=c.sections[a.s])==null?void 0:y.rows)==null?void 0:T[a.r])==null?void 0:N.columns)==null?void 0:_[a.c];if(!d||!u)return;const f=[...d.fields??[]];if(s.idx<0||s.idx>=f.length)return;const[h]=f.splice(s.idx,1);d.fields=f;const p=[...u.fields??[]],v=a.idx===void 0?p.length:Math.max(0,Math.min(a.idx,p.length));p.splice(v,0,h),u.fields=p}),removeFieldFromLayoutAt:(r,s)=>t().setSchema(n=>{var c,d,u,f;const a=mt(n,r);if(!a)return;const i=(f=(u=(d=(c=a.sections[s.s])==null?void 0:c.rows)==null?void 0:d[s.r])==null?void 0:u.columns)==null?void 0:f[s.c];if(!i||!i.fields||s.idx<0||s.idx>=i.fields.length)return;const l=[...i.fields];l.splice(s.idx,1),i.fields=l}),insertExistingFieldAtAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var v,g,x,m;const d=mt(c,r);if(!d)return;const u=(m=(x=(g=(v=d.sections[n])==null?void 0:v.rows)==null?void 0:g[a])==null?void 0:x.columns)==null?void 0:m[i];if(!u)return;let f=s;if(ir(c,s)){const w=c.fields.findIndex(y=>y.name===s);if(w>=0){const y=c.fields[w],{baseName:T,baseLabel:N}=Qe(y),_=new Set(c.fields.map(z=>z.name).filter(Boolean)),A=new Set(c.fields.map(z=>z.label??"").filter(Boolean)),S=Xe(T,_),$=ot(N,A),V=JSON.parse(JSON.stringify(y));V.name=S,V.label=$,c.fields.splice(w+1,0,V),f=S}}const h=[...u.fields??[]],p=Math.max(0,Math.min(l,h.length));h.splice(p,0,f),u.fields=h}),addFieldAndPlaceAtAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var T,N,_,A;const{baseName:d,baseLabel:u}=Qe(s),f=new Set(c.fields.map(S=>S.name).filter(Boolean)),h=new Set(c.fields.map(S=>S.label??"").filter(Boolean)),p=Xe(d,f),v=ot(u,h),g=JSON.parse(JSON.stringify(s));g.name=p,g.label||(g.label=v),c.fields.push(g);const x=mt(c,r);if(!x)return;const m=(A=(_=(N=(T=x.sections[n])==null?void 0:T.rows)==null?void 0:N[a])==null?void 0:_.columns)==null?void 0:A[i];if(!m)return;const w=[...m.fields??[]],y=Math.max(0,Math.min(l,w.length));w.splice(y,0,p),m.fields=w}),setTabRowResponsive:(r,s,n,a)=>t().setSchema(i=>{var g,x;const l=$e(i,r);if(!l)return;const d=(x=(g=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[Number(s)])==null?void 0:g.rows)==null?void 0:x[Number(n)];if(!d)return;const u=Math.max(a.desktop.count??1,a.tablet.count??1,a.mobile.count??1),f=(d.columns??[]).flatMap(m=>m.fields??[]),h=on(f,u),p=(m,w,y)=>w<(y??0)?dr((m==null?void 0:m[w])??0):null,v=Array.from({length:u},(m,w)=>{const y=p(a.mobile.widths,w,a.mobile.count),T=p(a.tablet.widths,w,a.tablet.count),N=p(a.desktop.widths,w,a.desktop.count);return{width:an(y,T,N),fields:h[w]??[]}});d.columns=v}),moveTabRow:(r,s,n,a)=>t().setSchema(i=>{const l=$e(i,r);if(!l)return;const d=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[s];if(!d)return;const u=[...d.rows];if(n<0||n>=u.length)return;const f=Math.max(0,Math.min(a,u.length-1));if(n===f)return;const[h]=u.splice(n,1);u.splice(f,0,h),d.rows=u}),duplicateTabRow:(r,s,n)=>t().setSchema(a=>{const i=$e(a,r);if(!i)return;const c=a.layout[i.nodeIdx].tabs[i.tabIdx].sections[s];if(!c)return;const d=c.rows[n];if(!d)return;const u=JSON.parse(JSON.stringify(d));c.rows.splice(n+1,0,u)}),removeTabRow:(r,s,n)=>t().setSchema(a=>{const i=$e(a,r);if(!i)return;const c=a.layout[i.nodeIdx].tabs[i.tabIdx].sections[s];if(!c)return;const d=[...c.rows];n<0||n>=d.length||(d.splice(n,1),d.length===0&&d.push({title:"",columns:[{width:"w-full",fields:[]}]}),c.rows=d)}),setTabRowColumnsPreset:(r,s,n,a)=>t().setSchema(i=>{var f,h;const l=$e(i,r);if(!l)return;const d=(h=(f=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[s])==null?void 0:f.rows)==null?void 0:h[n];if(!d)return;const u=sn[a];u&&nn(d,u)}),addRowToSection:r=>t().setSchema(s=>{const n=_e(s);n&&n.sections[r].rows.push({title:"",columns:[{width:"w-full",fields:[]}]})}),addColumnToRow:(r,s)=>t().setSchema(n=>{const a=_e(n);a&&a.sections[r].rows[s].columns.push({width:"w-1/2",fields:[]})}),setRowColumns:(r,s,n)=>t().setSchema(a=>{const i=_e(a);if(!i)return;const l=i.sections[r].rows[s],c=(l.columns??[]).flatMap(f=>f.fields??[]),d=rn(n),u=Array.from({length:n},(f,h)=>({width:d[h],fields:[]}));c.forEach((f,h)=>u[h%n].fields.push(f)),l.columns=u}),removeColumn:(r,s,n)=>t().setSchema(a=>{const i=_e(a);if(!i)return;const l=i.sections[r].rows[s],c=l.columns??[];if(!c[n])return;const d=c[n],u=n>0?n-1:c[n+1]?n+1:-1,f=[...c];f.splice(n,1),u>=0&&f[u]&&(f[u].fields=[...f[u].fields??[],...d.fields??[]]),l.columns=f}),placeFieldInColumn:(r,s,n,a)=>t().setSchema(i=>{const l=_e(i);if(!l)return;const c=l.sections[s].rows[n].columns[a];let d=r;if(ir(i,r)){const u=i.fields.findIndex(f=>f.name===r);if(u>=0){const f=i.fields[u],{baseName:h,baseLabel:p}=Qe(f),v=new Set(i.fields.map(y=>y.name).filter(Boolean)),g=new Set(i.fields.map(y=>y.label??"").filter(Boolean)),x=Xe(h,v),m=ot(p,g),w=JSON.parse(JSON.stringify(f));w.name=x,w.label=m,i.fields.splice(u+1,0,w),d=x}}c.fields=[...c.fields??[],d]}),moveField:(r,s)=>t().setSchema(n=>{var h,p,v,g;const a=_e(n);if(!a)return;const i=(p=(h=a.sections[r.s])==null?void 0:h.rows[r.r])==null?void 0:p.columns[r.c],l=(g=(v=a.sections[s.s])==null?void 0:v.rows[s.r])==null?void 0:g.columns[s.c];if(!i||!l)return;const c=[...i.fields??[]];if(r.idx<0||r.idx>=c.length)return;const[d]=c.splice(r.idx,1);i.fields=c;const u=[...l.fields??[]],f=s.idx===void 0?u.length:Math.max(0,Math.min(s.idx,u.length));u.splice(f,0,d),l.fields=u}),removeFieldFromLayout:r=>t().setSchema(s=>{var l,c;const n=_e(s);if(!n)return;const a=(c=(l=n.sections[r.s])==null?void 0:l.rows[r.r])==null?void 0:c.columns[r.c];if(!a||!a.fields||r.idx<0||r.idx>=a.fields.length)return;const i=[...a.fields];i.splice(r.idx,1),a.fields=i}),addFieldAndPlace:(r,s,n,a)=>t().setSchema(i=>{const{baseName:l,baseLabel:c}=Qe(r),d=new Set(i.fields.map(x=>x.name).filter(Boolean)),u=new Set(i.fields.map(x=>x.label??"").filter(Boolean)),f=Xe(l,d),h=ot(c,u),p=JSON.parse(JSON.stringify(r));p.name=f,p.label||(p.label=h),i.fields.push(p);const v=_e(i);if(!v)return;const g=v.sections[s].rows[n].columns[a];g.fields=[...g.fields??[],f]}),moveFieldWithinColumn:(r,s,n,a,i)=>t().setSchema(l=>{var p,v,g,x;const c=_e(l);if(!c)return;const d=(x=(g=(v=(p=c.sections[r])==null?void 0:p.rows)==null?void 0:v[s])==null?void 0:g.columns)==null?void 0:x[n];if(!d)return;const u=[...d.fields??[]];if(a<0||a>=u.length)return;const[f]=u.splice(a,1),h=Math.max(0,Math.min(i,u.length));u.splice(h,0,f),d.fields=u}),insertExistingFieldAt:(r,s,n,a,i)=>t().setSchema(l=>{var p,v,g,x;const c=_e(l);if(!c)return;const d=(x=(g=(v=(p=c.sections[s])==null?void 0:p.rows)==null?void 0:v[n])==null?void 0:g.columns)==null?void 0:x[a];if(!d)return;let u=r;if(ir(l,r)){const m=l.fields.findIndex(w=>w.name===r);if(m>=0){const w=l.fields[m],{baseName:y,baseLabel:T}=Qe(w),N=new Set(l.fields.map(V=>V.name).filter(Boolean)),_=new Set(l.fields.map(V=>V.label??"").filter(Boolean)),A=Xe(y,N),S=ot(T,_),$=JSON.parse(JSON.stringify(w));$.name=A,$.label=S,l.fields.splice(m+1,0,$),u=A}}const f=[...d.fields??[]],h=Math.max(0,Math.min(i,f.length));f.splice(h,0,u),d.fields=f}),addFieldAndPlaceAt:(r,s,n,a,i)=>t().setSchema(l=>{var y,T,N,_;const{baseName:c,baseLabel:d}=Qe(r),u=new Set(l.fields.map(A=>A.name).filter(Boolean)),f=new Set(l.fields.map(A=>A.label??"").filter(Boolean)),h=Xe(c,u),p=ot(d,f),v=JSON.parse(JSON.stringify(r));v.name=h,v.label||(v.label=p),l.fields.push(v);const g=_e(l);if(!g)return;const x=(_=(N=(T=(y=g.sections[s])==null?void 0:y.rows)==null?void 0:T[n])==null?void 0:N.columns)==null?void 0:_[a];if(!x)return;const m=[...x.fields??[]],w=Math.max(0,Math.min(i,m.length));m.splice(w,0,h),x.fields=m}),moveFieldWithinTab:(r,s,n,a,i,l)=>t().setSchema(c=>{var v,g,x,m;const d=$e(c,r);if(!d)return;const u=(m=(x=(g=(v=c.layout[d.nodeIdx].tabs[d.tabIdx].sections[s])==null?void 0:v.rows)==null?void 0:g[n])==null?void 0:x.columns)==null?void 0:m[a];if(!u)return;const f=[...u.fields??[]];if(i<0||i>=f.length)return;const[h]=f.splice(i,1),p=Math.max(0,Math.min(l,f.length));f.splice(p,0,h),u.fields=f}),insertExistingFieldInTabAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var v,g,x,m;const d=$e(c,s);if(!d)return;const u=(m=(x=(g=(v=c.layout[d.nodeIdx].tabs[d.tabIdx].sections[n])==null?void 0:v.rows)==null?void 0:g[a])==null?void 0:x.columns)==null?void 0:m[i];if(!u)return;let f=r;if(ir(c,r)){const w=c.fields.findIndex(y=>y.name===r);if(w>=0){const y=c.fields[w],{baseName:T,baseLabel:N}=Qe(y),_=new Set(c.fields.map(z=>z.name).filter(Boolean)),A=new Set(c.fields.map(z=>z.label??"").filter(Boolean)),S=Xe(T,_),$=ot(N,A),V=JSON.parse(JSON.stringify(y));V.name=S,V.label=$,c.fields.splice(w+1,0,V),f=S}}const h=[...u.fields??[]],p=Math.max(0,Math.min(l,h.length));h.splice(p,0,f),u.fields=h}),addFieldAndPlaceInTabAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var T,N,_,A;const d=$e(c,s);if(!d)return;const{baseName:u,baseLabel:f}=Qe(r),h=new Set(c.fields.map(S=>S.name).filter(Boolean)),p=new Set(c.fields.map(S=>S.label??"").filter(Boolean)),v=Xe(u,h),g=ot(f,p),x=JSON.parse(JSON.stringify(r));x.name=v,x.label||(x.label=g),c.fields.push(x);const m=(A=(_=(N=(T=c.layout[d.nodeIdx].tabs[d.tabIdx].sections[n])==null?void 0:T.rows)==null?void 0:N[a])==null?void 0:_.columns)==null?void 0:A[i];if(!m)return;const w=[...m.fields??[]],y=Math.max(0,Math.min(l,w.length));w.splice(y,0,v),m.fields=w}),changeFieldType:(r,s)=>t().setSchema(n=>{const a=n.fields.findIndex(d=>d.name===r);if(a<0)return;const i=n.fields[a],c={...{name:i.name,label:i.label,width:i.width,size:i.size,info:i.info,disabled:i.disabled,visibleWhen:i.visibleWhen,disabledWhen:i.disabledWhen,clearWhen:i.clearWhen,validation:i.validation,placeholder:i.placeholder},type:s};switch(s){case"text":case"email":case"password":case"number":break;case"textarea":c.maxLength=i.maxLength??void 0,c.showCounter=i.showCounter??!1;break;case"select":c.options=Array.isArray(i.options)?i.options:[],c.multiple=!!i.multiple,c.loadOptions=i.loadOptions??void 0;break;case"checkbox":c.defaultValue=!!i.defaultValue,delete c.placeholder;break;case"date":c.showTime=!!i.showTime;break;case"file":c.maxFiles=i.maxFiles??1,c.accept=i.accept??"",delete c.placeholder;break}s!=="select"&&(delete c.options,delete c.multiple,delete c.loadOptions),s!=="textarea"&&(delete c.maxLength,delete c.showCounter),s!=="checkbox"&&delete c.defaultValue,s!=="date"&&delete c.showTime,s!=="file"&&(delete c.maxFiles,delete c.accept),n.fields[a]=c})}));function nn(e,t){const r=(e.columns??[]).flatMap(a=>a.fields??[]),s=t.length,n=t.map(a=>({width:a,fields:[]}));r.forEach((a,i)=>n[i%s].fields.push(a)),e.columns=n}function an(e,t,r){const s=[];return e===null?s.push("hidden"):s.push(`w-[${tn(dr(e))}%]`,"block"),t===null?s.push("md:hidden"):s.push(`md:w-[${tn(dr(t))}%]`,"md:block"),r===null?s.push("lg:hidden"):s.push(`lg:w-[${tn(dr(r))}%]`,"lg:block"),s.join(" ")}function Ef(e,t){const r=e.columns??[];if(r.length===t)return r;if(r.length<t){const n=t-r.length,a=[...r];for(let i=0;i<n;i++)a.push({width:"w-[100%]",fields:[]});return e.columns=a,a}const s=r.slice(0,t);for(let n=t;n<r.length;n++)s[t-1].fields=[...s[t-1].fields??[],...r[n].fields??[]];return e.columns=s,s}function on(e,t){const r=Array.from({length:t},()=>[]);return e.forEach((s,n)=>r[n%t].push(s)),r}const Is=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function br(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ta(e){return"nodeType"in e}function Ye(e){var t,r;return e?br(e)?e:ta(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function ra(e){const{Document:t}=Ye(e);return e instanceof t}function Br(e){return br(e)?!1:e instanceof Ye(e).HTMLElement}function el(e){return e instanceof Ye(e).SVGElement}function gr(e){return e?br(e)?e.document:ta(e)?ra(e)?e:Br(e)||el(e)?e.ownerDocument:document:document:document}const _t=Is?b.useLayoutEffect:b.useEffect;function Vs(e){const t=b.useRef(e);return _t(()=>{t.current=e}),b.useCallback(function(){for(var r=arguments.length,s=new Array(r),n=0;n<r;n++)s[n]=arguments[n];return t.current==null?void 0:t.current(...s)},[])}function Cf(){const e=b.useRef(null),t=b.useCallback((s,n)=>{e.current=setInterval(s,n)},[]),r=b.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Rr(e,t){t===void 0&&(t=[e]);const r=b.useRef(e);return _t(()=>{r.current!==e&&(r.current=e)},t),r}function Ur(e,t){const r=b.useRef();return b.useMemo(()=>{const s=e(r.current);return r.current=s,s},[...t])}function Es(e){const t=Vs(e),r=b.useRef(null),s=b.useCallback(n=>{n!==r.current&&(t==null||t(n,r.current)),r.current=n},[]);return[r,s]}function Cs(e){const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}let ln={};function Bs(e,t){return b.useMemo(()=>{if(t)return t;const r=ln[e]==null?0:ln[e]+1;return ln[e]=r,e+"-"+r},[e,t])}function tl(e){return function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];return s.reduce((a,i)=>{const l=Object.entries(i);for(const[c,d]of l){const u=a[c];u!=null&&(a[c]=u+e*d)}return a},{...t})}}const ur=tl(1),As=tl(-1);function Af(e){return"clientX"in e&&"clientY"in e}function sa(e){if(!e)return!1;const{KeyboardEvent:t}=Ye(e.target);return t&&e instanceof t}function Tf(e){if(!e)return!1;const{TouchEvent:t}=Ye(e.target);return t&&e instanceof t}function Ts(e){if(Tf(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Af(e)?{x:e.clientX,y:e.clientY}:null}const Dr=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Dr.Translate.toString(e),Dr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:s}=e;return t+" "+r+"ms "+s}}}),lo="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function _f(e){return e.matches(lo)?e:e.querySelector(lo)}const Ff={display:"none"};function Of(e){let{id:t,value:r}=e;return b.createElement("div",{id:t,style:Ff},r)}function Rf(e){let{id:t,announcement:r,ariaLiveType:s="assertive"}=e;const n={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return b.createElement("div",{id:t,style:n,role:"status","aria-live":s,"aria-atomic":!0},r)}function Df(){const[e,t]=b.useState("");return{announce:b.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const rl=b.createContext(null);function Mf(e){const t=b.useContext(rl);b.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function $f(){const[e]=b.useState(()=>new Set),t=b.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[b.useCallback(s=>{let{type:n,event:a}=s;e.forEach(i=>{var l;return(l=i[n])==null?void 0:l.call(i,a)})},[e]),t]}const Lf={draggable:`
61
+ `,children:[o.jsx(Vn,{className:"w-5 h-5 text-[var(--color-ds-text-secondary)] hover:text-[var(--color-ds-text-primary)]"}),o.jsx("span",{className:"sr-only",children:"Cerrar modal"})]})]}),o.jsx("div",{className:"px-6 py-6 text-[var(--color-ds-text-primary)]",children:s}),n&&o.jsx("div",{className:"px-6 py-4 border-t border-[var(--color-ds-border-muted)] bg-[var(--color-ds-background-surface)]",children:n})]})})]}),document.body):null),Qn=({items:e,selected:t,onSelect:r,level:s=0})=>{const[n,a]=b.useState(new Set),i=l=>{const c=new Set(n);s===0?(c.clear(),n.has(l)||c.add(l)):c.has(l)?c.delete(l):c.add(l),a(c)};return o.jsx("ul",{className:se(s>0?"mt-1":"mt-0"),children:e.map(l=>{var v;const c=l.value===t,d=n.has(l.value),u=["pl-2","pl-2","pl-2"][s]||"pl-4",f=s===0?d||c?"bg-[var(--color-ds-background-accent)] text-[var(--color-ds-text-on-accent)] rounded-r-lg":"text-[var(--color-ds-text-primary)] hover:bg-[var(--color-ds-background-surface)]":c?"bg-[var(--color-ds-background-surface)] text-[var(--color-ds-text-primary)]":"text-[var(--color-ds-text-primary)] hover:bg-[var(--color-ds-background-surface)]",p=s===0&&(d||c)?"text-[var(--color-ds-text-on-accent)]":"text-[var(--color-ds-text-secondary)]",h=!!((v=l.children)!=null&&v.length);return o.jsxs("li",{children:[o.jsxs("button",{type:"button",onClick:()=>h?i(l.value):r(l.value),"aria-expanded":h?d:void 0,className:se("w-full flex items-center justify-between h-8 transition-colors",u,f),children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[s===0&&l.icon&&o.jsx(l.icon,{className:"w-5 h-5 ml-2"}),o.jsx("span",{className:"text-ds-sm",children:l.label})]}),h&&(d?o.jsx(Rs,{className:se("w-4 h-4",p)}):o.jsx($o,{className:se("w-4 h-4",p)}))]}),h&&o.jsx("div",{className:se("overflow-hidden transition-[max-height] duration-300 ease-in-out","border-l-1 border-[var(--color-ds-background-accent)] ml-6",d?"max-h-screen":"max-h-0"),children:o.jsx(Qn,{items:l.children,selected:t,onSelect:r,level:s+1})})]},l.value)})})},tf="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20250%20250'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2029.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.0%20Build%20186)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23FFFFFF;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='st0'%20d='M101.7,82.72c1.6.57,3.25,1.09,4.98,1.53,11.93,3.07,17.85,7.44,17.85,13.01,0,2.72-1.14,5-3.43,6.86-2.29,1.86-5.14,2.79-8.57,2.79s-6.49-1.13-8.9-3.36c-2.62,6.82-6.19,13.16-10.51,18.91,5.53,3.09,11.9,4.68,19.13,4.68,10.14,0,18.64-3,25.43-9.01,3.7-3.24,6.35-6.96,8.02-11.11,1.77,3.2,4.03,6.17,6.81,8.9,7.64,7.51,17.28,11.22,28.78,11.22,9.14,0,17.21-2.43,24.21-7.22,2.24-1.55,4.24-3.27,6.05-5.14l-14.05-13.73h-.14c-2.57,4.29-8.57,7.44-15.64,7.44-8.78,0-15.5-5.22-17.85-13.58h57.06c.36-1.57.57-3.79.57-6.58,0-11.37-3.86-20.73-11.5-28.24-7.71-7.44-17.28-11.15-28.71-11.15s-21.14,3.72-28.78,11.15c-5.19,5.09-8.59,11.03-10.26,17.78-1.11-1.42-2.37-2.71-3.78-3.83-6.07-4.79-12.07-7.36-20.64-9.73-11-2.93-16.5-7.08-16.5-12.58,0-2.51,1-4.65,3.07-6.37,2.07-1.71,4.57-2.57,7.57-2.57,3.21,0,5.93,1,8,3,2.07,2,3.14,4.5,3.14,7.5h23.21c0-8.79-3.29-16.08-9.78-21.95-6.5-5.86-14.71-8.79-24.57-8.79s-17.44,2.77-23.89,8.31C74.82,12.54,53.44.47,29.27,0v24.08c27.07.77,48.86,23.04,48.86,50.32s-21.79,49.55-48.86,50.32v24.08c37.54-.72,68.34-29.42,72.44-66.08ZM181.29,67.38c8.21,0,15,5.08,17.21,13.3h-34.5c2.57-8.22,8.93-13.3,17.28-13.3Z'/%3e%3cpath%20class='st0'%20d='M29.35,160.65v29.07h10.94c4.12,0,7.57-1.38,10.31-4.16,2.74-2.76,4.12-6.21,4.12-10.39s-1.38-7.61-4.12-10.39c-2.74-2.76-6.19-4.14-10.31-4.14h-10.94ZM52.1,175.17c0,3.46-1.14,6.34-3.39,8.64-2.25,2.3-5.07,3.46-8.46,3.46h-8.36v-24.17h8.36c3.39,0,6.21,1.15,8.46,3.46,2.25,2.3,3.39,5.18,3.39,8.62Z'/%3e%3cpath%20class='st0'%20d='M60.61,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3crect%20class='st0'%20x='57.63'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M64.15,168.24v29.48h2.41v-13.19c.85,1.77,2.09,3.17,3.69,4.18,1.6,1.01,3.41,1.52,5.44,1.52,3.11,0,5.7-1.07,7.75-3.23,2.05-2.16,3.07-4.83,3.07-8.04s-1.04-5.86-3.09-8.02c-2.05-2.14-4.63-3.21-7.73-3.21-2.03,0-3.84.49-5.44,1.5-1.6,1.01-2.84,2.41-3.69,4.18v-5.16h-2.41ZM69.06,172.62c1.64-1.69,3.73-2.53,6.23-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36c-1.66,1.71-3.73,2.55-6.23,2.55s-4.59-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33Z'/%3e%3cpath%20class='st0'%20d='M107.73,189.71v-21.48h-2.42v12.59c0,2.1-.65,3.79-1.97,5.08-1.32,1.3-3.05,1.95-5.18,1.95s-3.69-.64-4.93-1.91c-1.26-1.28-1.89-2.96-1.89-5.04v-12.67h-2.4v13.35c0,2.61.79,4.69,2.35,6.27,1.56,1.58,3.61,2.37,6.15,2.37,3.65-.02,6.27-1.52,7.85-4.53v4.01h2.42Z'/%3e%3cpolygon%20class='st0'%20points='117.35%20189.71%20117.35%20170.46%20122.55%20170.46%20122.55%20168.24%20117.35%20168.24%20117.35%20161.9%20114.94%20162.38%20114.94%20168.24%20110.01%20168.24%20110.01%20170.46%20114.94%20170.46%20114.94%20189.71%20117.35%20189.71'/%3e%3cpath%20class='st0'%20d='M144.27,189.71v-21.48h-2.42v5.12c-.87-1.75-2.13-3.13-3.73-4.14-1.6-1.01-3.41-1.5-5.4-1.5-3.08,0-5.64,1.07-7.69,3.21-2.05,2.16-3.09,4.83-3.09,8.02s1.04,5.88,3.09,8.04c2.05,2.16,4.63,3.23,7.69,3.23,1.99,0,3.79-.51,5.4-1.52,1.6-1.01,2.84-2.39,3.73-4.13v5.14h2.42ZM139.36,185.31c-1.66,1.71-3.73,2.55-6.23,2.55s-4.53-.84-6.19-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.19-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36Z'/%3e%3cpath%20class='st0'%20d='M158.18,170.09c2.09,0,3.9.62,5.46,1.85,1.54,1.23,2.56,2.84,3.02,4.83h2.5c-.47-2.63-1.73-4.79-3.73-6.5-2.03-1.71-4.44-2.55-7.25-2.55-3.19,0-5.84,1.07-8,3.21-2.15,2.16-3.23,4.83-3.23,8.02s1.08,5.88,3.23,8.04c2.13,2.16,4.81,3.23,8,3.23,2.8,0,5.22-.84,7.25-2.55,2.01-1.71,3.27-3.87,3.73-6.52h-2.5c-.47,2-1.48,3.62-3.02,4.85-1.56,1.23-3.37,1.85-5.46,1.85-2.5,0-4.57-.84-6.23-2.55-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3crect%20class='st0'%20x='171.72'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M174.71,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3cpath%20class='st0'%20d='M176.86,178.95c0,3.21,1.08,5.88,3.23,8.04,2.15,2.16,4.83,3.23,8.02,3.23s5.85-1.07,7.98-3.23c2.13-2.16,3.19-4.83,3.19-8.04s-1.06-5.86-3.19-8.02c-2.13-2.14-4.79-3.21-7.98-3.21s-5.86,1.07-8.02,3.21c-2.15,2.16-3.23,4.83-3.23,8.02ZM188.09,170.09c2.5,0,4.57.84,6.21,2.53,1.64,1.71,2.48,3.8,2.48,6.33s-.83,4.65-2.48,6.36c-1.64,1.71-3.71,2.55-6.21,2.55s-4.57-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3cpolygon%20class='st0'%20points='194.03%20160.01%20190.83%20160.01%20186.46%20165.15%20189.08%20165.15%20194.03%20160.01'/%3e%3cpath%20class='st0'%20d='M221.5,189.71v-13.02c0-2.69-.81-4.86-2.44-6.5-1.64-1.65-3.79-2.47-6.45-2.47-3.75,0-6.68,1.67-8.22,4.71v-4.2h-2.42v21.48h2.42v-12.22c0-2.22.69-4.01,2.07-5.37,1.38-1.36,3.19-2.04,5.44-2.04s3.92.66,5.24,2c1.32,1.34,1.97,3.11,1.97,5.33v12.3h2.4Z'/%3e%3cpath%20class='st0'%20d='M57.27,225.24c-2.82-2.23-5.61-3.43-9.59-4.53-5.11-1.37-7.66-3.3-7.66-5.87,0-1.17.46-2.17,1.43-2.97.96-.8,2.12-1.2,3.52-1.2,1.49,0,2.75.47,3.72,1.4.96.93,1.46,2.1,1.46,3.5h10.78c0-4.1-1.53-7.5-4.55-10.23-3.02-2.73-6.83-4.1-11.42-4.1s-8.23,1.33-11.25,4c-3.02,2.67-4.51,6-4.51,10s1.26,7.4,3.75,9.73c2.49,2.37,5.68,4.03,9.56,5.03,5.54,1.43,8.29,3.47,8.29,6.06,0,1.27-.53,2.33-1.59,3.2-1.06.87-2.39,1.3-3.98,1.3s-3.05-.53-4.18-1.6c-1.16-1.07-1.73-2.37-1.73-3.93h-10.82c0,4.3,1.59,7.86,4.78,10.7,3.15,2.83,7.1,4.26,11.81,4.26s8.66-1.4,11.81-4.2c3.15-2.77,4.71-6.26,4.71-10.43,0-4.43-1.56-7.9-4.35-10.13Z'/%3e%3cpolygon%20class='st0'%20points='118.26%20236.54%20110.23%20214.38%2098.88%20214.38%20113.02%20249.17%20123.21%20249.17%20137.28%20214.38%20126.19%20214.38%20118.26%20236.54'/%3e%3crect%20class='st0'%20x='139.25'%20y='214.38'%20width='9.92'%20height='34.79'/%3e%3cpath%20class='st0'%20d='M144.2,199.53c-1.72,0-3.18.57-4.35,1.73-1.16,1.17-1.76,2.6-1.76,4.33s.6,3.23,1.76,4.4c1.16,1.17,2.62,1.73,4.35,1.73s3.25-.57,4.45-1.73c1.16-1.17,1.76-2.63,1.76-4.4s-.6-3.17-1.76-4.33c-1.19-1.17-2.69-1.73-4.45-1.73Z'/%3e%3crect%20class='st0'%20x='154.93'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3crect%20class='st0'%20x='170.61'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3cpath%20class='st0'%20d='M211.58,214.38v3.8c-2.82-3.1-6.34-4.63-10.49-4.63-4.75,0-8.73,1.73-11.91,5.2-3.22,3.5-4.81,7.83-4.81,13s1.59,9.53,4.81,13.03c3.19,3.5,7.17,5.23,11.91,5.23,4.18-.03,7.67-1.57,10.49-4.67v3.83h9.92v-34.79h-9.92ZM209.19,237.9c-1.63,1.63-3.65,2.47-6.11,2.47s-4.41-.83-6.01-2.47c-1.63-1.63-2.42-3.7-2.42-6.17s.8-4.5,2.42-6.13c1.59-1.63,3.58-2.43,6.01-2.43s4.45.8,6.07,2.43c1.63,1.63,2.42,3.7,2.42,6.13s-.8,4.53-2.39,6.17Z'/%3e%3cpath%20class='st0'%20d='M82.34,213.54c-5.34,0-9.82,1.73-13.37,5.2-3.55,3.5-5.34,7.83-5.34,13s1.79,9.53,5.34,13.03c3.55,3.5,8.03,5.23,13.37,5.23,4.25,0,8-1.13,11.25-3.37,1.05-.73,1.99-1.55,2.84-2.43l-6.5-6.37h-.13c-1.19,2-3.98,3.47-7.27,3.47-4.08,0-7.2-2.43-8.29-6.33h26.51c.17-.73.27-1.77.27-3.07,0-5.3-1.79-9.66-5.34-13.16-3.58-3.47-8.03-5.2-13.34-5.2ZM74.31,228.34c1.19-3.83,4.15-6.2,8.03-6.2s6.97,2.37,8,6.2h-16.03Z'/%3e%3c/svg%3e",rf="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Capa_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20250%20250'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2029.0.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.0%20Build%20186)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23005751;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='st0'%20d='M101.7,82.72c1.6.57,3.25,1.09,4.98,1.53,11.93,3.07,17.85,7.44,17.85,13.01,0,2.72-1.14,5-3.43,6.86-2.29,1.86-5.14,2.79-8.57,2.79s-6.49-1.13-8.9-3.36c-2.62,6.82-6.19,13.16-10.51,18.91,5.53,3.09,11.9,4.68,19.13,4.68,10.14,0,18.64-3,25.43-9.01,3.7-3.24,6.35-6.96,8.02-11.11,1.77,3.2,4.03,6.17,6.81,8.9,7.64,7.51,17.28,11.22,28.78,11.22,9.14,0,17.21-2.43,24.21-7.22,2.24-1.55,4.24-3.27,6.05-5.14l-14.05-13.73h-.14c-2.57,4.29-8.57,7.44-15.64,7.44-8.78,0-15.5-5.22-17.85-13.58h57.06c.36-1.57.57-3.79.57-6.58,0-11.37-3.86-20.73-11.5-28.24-7.71-7.44-17.28-11.15-28.71-11.15s-21.14,3.72-28.78,11.15c-5.19,5.09-8.59,11.03-10.26,17.78-1.11-1.42-2.37-2.71-3.78-3.83-6.07-4.79-12.07-7.36-20.64-9.73-11-2.93-16.5-7.08-16.5-12.58,0-2.51,1-4.65,3.07-6.37,2.07-1.71,4.57-2.57,7.57-2.57,3.21,0,5.93,1,8,3,2.07,2,3.14,4.5,3.14,7.5h23.21c0-8.79-3.29-16.08-9.78-21.95-6.5-5.86-14.71-8.79-24.57-8.79s-17.44,2.77-23.89,8.31C74.82,12.54,53.44.47,29.27,0v24.08c27.07.77,48.86,23.04,48.86,50.32s-21.79,49.55-48.86,50.32v24.08c37.54-.72,68.34-29.42,72.44-66.08ZM181.29,67.38c8.21,0,15,5.08,17.21,13.3h-34.5c2.57-8.22,8.93-13.3,17.28-13.3Z'/%3e%3cpath%20class='st0'%20d='M29.35,160.65v29.07h10.94c4.12,0,7.57-1.38,10.31-4.16,2.74-2.76,4.12-6.21,4.12-10.39s-1.38-7.61-4.12-10.39c-2.74-2.76-6.19-4.14-10.31-4.14h-10.94ZM52.1,175.17c0,3.46-1.14,6.34-3.39,8.64-2.25,2.3-5.07,3.46-8.46,3.46h-8.36v-24.17h8.36c3.39,0,6.21,1.15,8.46,3.46,2.25,2.3,3.39,5.18,3.39,8.62Z'/%3e%3cpath%20class='st0'%20d='M60.61,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3crect%20class='st0'%20x='57.63'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M64.15,168.24v29.48h2.41v-13.19c.85,1.77,2.09,3.17,3.69,4.18,1.6,1.01,3.41,1.52,5.44,1.52,3.11,0,5.7-1.07,7.75-3.23,2.05-2.16,3.07-4.83,3.07-8.04s-1.04-5.86-3.09-8.02c-2.05-2.14-4.63-3.21-7.73-3.21-2.03,0-3.84.49-5.44,1.5-1.6,1.01-2.84,2.41-3.69,4.18v-5.16h-2.41ZM69.06,172.62c1.64-1.69,3.73-2.53,6.23-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36c-1.66,1.71-3.73,2.55-6.23,2.55s-4.59-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33Z'/%3e%3cpath%20class='st0'%20d='M107.73,189.71v-21.48h-2.42v12.59c0,2.1-.65,3.79-1.97,5.08-1.32,1.3-3.05,1.95-5.18,1.95s-3.69-.64-4.93-1.91c-1.26-1.28-1.89-2.96-1.89-5.04v-12.67h-2.4v13.35c0,2.61.79,4.69,2.35,6.27,1.56,1.58,3.61,2.37,6.15,2.37,3.65-.02,6.27-1.52,7.85-4.53v4.01h2.42Z'/%3e%3cpolygon%20class='st0'%20points='117.35%20189.71%20117.35%20170.46%20122.55%20170.46%20122.55%20168.24%20117.35%20168.24%20117.35%20161.9%20114.94%20162.38%20114.94%20168.24%20110.01%20168.24%20110.01%20170.46%20114.94%20170.46%20114.94%20189.71%20117.35%20189.71'/%3e%3cpath%20class='st0'%20d='M144.27,189.71v-21.48h-2.42v5.12c-.87-1.75-2.13-3.13-3.73-4.14-1.6-1.01-3.41-1.5-5.4-1.5-3.08,0-5.64,1.07-7.69,3.21-2.05,2.16-3.09,4.83-3.09,8.02s1.04,5.88,3.09,8.04c2.05,2.16,4.63,3.23,7.69,3.23,1.99,0,3.79-.51,5.4-1.52,1.6-1.01,2.84-2.39,3.73-4.13v5.14h2.42ZM139.36,185.31c-1.66,1.71-3.73,2.55-6.23,2.55s-4.53-.84-6.19-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.19-2.53s4.57.84,6.23,2.53c1.66,1.71,2.5,3.8,2.5,6.33s-.83,4.65-2.5,6.36Z'/%3e%3cpath%20class='st0'%20d='M158.18,170.09c2.09,0,3.9.62,5.46,1.85,1.54,1.23,2.56,2.84,3.02,4.83h2.5c-.47-2.63-1.73-4.79-3.73-6.5-2.03-1.71-4.44-2.55-7.25-2.55-3.19,0-5.84,1.07-8,3.21-2.15,2.16-3.23,4.83-3.23,8.02s1.08,5.88,3.23,8.04c2.13,2.16,4.81,3.23,8,3.23,2.8,0,5.22-.84,7.25-2.55,2.01-1.71,3.27-3.87,3.73-6.52h-2.5c-.47,2-1.48,3.62-3.02,4.85-1.56,1.23-3.37,1.85-5.46,1.85-2.5,0-4.57-.84-6.23-2.55-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3crect%20class='st0'%20x='171.72'%20y='168.24'%20width='2.42'%20height='21.48'/%3e%3cpath%20class='st0'%20d='M174.71,161.41c0-.97-.79-1.73-1.79-1.73s-1.75.76-1.75,1.73.79,1.77,1.75,1.77,1.79-.76,1.79-1.77Z'/%3e%3cpath%20class='st0'%20d='M176.86,178.95c0,3.21,1.08,5.88,3.23,8.04,2.15,2.16,4.83,3.23,8.02,3.23s5.85-1.07,7.98-3.23c2.13-2.16,3.19-4.83,3.19-8.04s-1.06-5.86-3.19-8.02c-2.13-2.14-4.79-3.21-7.98-3.21s-5.86,1.07-8.02,3.21c-2.15,2.16-3.23,4.83-3.23,8.02ZM188.09,170.09c2.5,0,4.57.84,6.21,2.53,1.64,1.71,2.48,3.8,2.48,6.33s-.83,4.65-2.48,6.36c-1.64,1.71-3.71,2.55-6.21,2.55s-4.57-.84-6.23-2.55c-1.66-1.71-2.5-3.83-2.5-6.36s.83-4.63,2.5-6.33c1.66-1.69,3.73-2.53,6.23-2.53Z'/%3e%3cpolygon%20class='st0'%20points='194.03%20160.01%20190.83%20160.01%20186.46%20165.15%20189.08%20165.15%20194.03%20160.01'/%3e%3cpath%20class='st0'%20d='M221.5,189.71v-13.02c0-2.69-.81-4.86-2.44-6.5-1.64-1.65-3.79-2.47-6.45-2.47-3.75,0-6.68,1.67-8.22,4.71v-4.2h-2.42v21.48h2.42v-12.22c0-2.22.69-4.01,2.07-5.37,1.38-1.36,3.19-2.04,5.44-2.04s3.92.66,5.24,2c1.32,1.34,1.97,3.11,1.97,5.33v12.3h2.4Z'/%3e%3cpath%20class='st0'%20d='M57.27,225.24c-2.82-2.23-5.61-3.43-9.59-4.53-5.11-1.37-7.66-3.3-7.66-5.87,0-1.17.46-2.17,1.43-2.97.96-.8,2.12-1.2,3.52-1.2,1.49,0,2.75.47,3.72,1.4.96.93,1.46,2.1,1.46,3.5h10.78c0-4.1-1.53-7.5-4.55-10.23-3.02-2.73-6.83-4.1-11.42-4.1s-8.23,1.33-11.25,4c-3.02,2.67-4.51,6-4.51,10s1.26,7.4,3.75,9.73c2.49,2.37,5.68,4.03,9.56,5.03,5.54,1.43,8.29,3.47,8.29,6.06,0,1.27-.53,2.33-1.59,3.2-1.06.87-2.39,1.3-3.98,1.3s-3.05-.53-4.18-1.6c-1.16-1.07-1.73-2.37-1.73-3.93h-10.82c0,4.3,1.59,7.86,4.78,10.7,3.15,2.83,7.1,4.26,11.81,4.26s8.66-1.4,11.81-4.2c3.15-2.77,4.71-6.26,4.71-10.43,0-4.43-1.56-7.9-4.35-10.13Z'/%3e%3cpolygon%20class='st0'%20points='118.26%20236.54%20110.23%20214.38%2098.88%20214.38%20113.02%20249.17%20123.21%20249.17%20137.28%20214.38%20126.19%20214.38%20118.26%20236.54'/%3e%3crect%20class='st0'%20x='139.25'%20y='214.38'%20width='9.92'%20height='34.79'/%3e%3cpath%20class='st0'%20d='M144.2,199.53c-1.72,0-3.18.57-4.35,1.73-1.16,1.17-1.76,2.6-1.76,4.33s.6,3.23,1.76,4.4c1.16,1.17,2.62,1.73,4.35,1.73s3.25-.57,4.45-1.73c1.16-1.17,1.76-2.63,1.76-4.4s-.6-3.17-1.76-4.33c-1.19-1.17-2.69-1.73-4.45-1.73Z'/%3e%3crect%20class='st0'%20x='154.93'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3crect%20class='st0'%20x='170.61'%20y='200.02'%20width='9.92'%20height='49.15'/%3e%3cpath%20class='st0'%20d='M211.58,214.38v3.8c-2.82-3.1-6.34-4.63-10.49-4.63-4.75,0-8.73,1.73-11.91,5.2-3.22,3.5-4.81,7.83-4.81,13s1.59,9.53,4.81,13.03c3.19,3.5,7.17,5.23,11.91,5.23,4.18-.03,7.67-1.57,10.49-4.67v3.83h9.92v-34.79h-9.92ZM209.19,237.9c-1.63,1.63-3.65,2.47-6.11,2.47s-4.41-.83-6.01-2.47c-1.63-1.63-2.42-3.7-2.42-6.17s.8-4.5,2.42-6.13c1.59-1.63,3.58-2.43,6.01-2.43s4.45.8,6.07,2.43c1.63,1.63,2.42,3.7,2.42,6.13s-.8,4.53-2.39,6.17Z'/%3e%3cpath%20class='st0'%20d='M82.34,213.54c-5.34,0-9.82,1.73-13.37,5.2-3.55,3.5-5.34,7.83-5.34,13s1.79,9.53,5.34,13.03c3.55,3.5,8.03,5.23,13.37,5.23,4.25,0,8-1.13,11.25-3.37,1.05-.73,1.99-1.55,2.84-2.43l-6.5-6.37h-.13c-1.19,2-3.98,3.47-7.27,3.47-4.08,0-7.2-2.43-8.29-6.33h26.51c.17-.73.27-1.77.27-3.07,0-5.3-1.79-9.66-5.34-13.16-3.58-3.47-8.03-5.2-13.34-5.2ZM74.31,228.34c1.19-3.83,4.15-6.2,8.03-6.2s6.97,2.37,8,6.2h-16.03Z'/%3e%3c/svg%3e",Wi=({appName:e,orgName:t,username:r,footerText:s,navItems:n,selectedNav:a,onSelectNav:i,width:l="200px"})=>{const{theme:c}=Ui(),d=c==="dark"?tf:rf;return o.jsxs("aside",{className:"flex flex-col h-screen bg-[var(--color-ds-background-page)]",style:{width:l},children:[o.jsxs("div",{className:"flex gap-1 flex-col items-center py-4 space-y-1",children:[o.jsx("img",{src:d,alt:"Logo Diputación",className:"w-20 h-20"}),o.jsx("span",{className:"text-[var(--color-ds-text-primary)] text-ds-lg ",children:e}),o.jsx("span",{className:"text-ds-sm text-[var(--color-ds-text-secondary)]",children:t}),o.jsx("span",{className:"text-ds-sm text-[var(--color-ds-text-secondary)]",children:r}),o.jsx("div",{className:"w-1/5 h-0.5 rounded-full bg-[var(--color-ds-background-accent)] mt-2"})]}),o.jsx("nav",{className:"flex-1 overflow-auto pt-3",children:o.jsx(Qn,{items:n,selected:a,onSelect:i})}),o.jsx("div",{className:"px-4 w-full py-3",children:o.jsx("span",{className:"text-ds-sm w-full text-center text-[var(--color-ds-text-secondary)]",children:s})})]})};function sf({hideSidebar:e=!1,sidebar:t,header:r,children:s}){return o.jsxs("div",{className:"flex h-screen overflow-hidden bg-[var(--color-ds-background-page)]",children:[!e&&o.jsx(Wi,{...t}),o.jsxs("div",{className:`flex-1 flex flex-col overflow-auto [scrollbar-gutter:stable_both-edges] ${e?"px-0":"px-10"}`,children:[o.jsx(qi,{...r}),o.jsx("main",{className:"flex-1",children:s})]})]})}function nf({columns:e,data:t,loadData:r,loading:s,idAccessor:n,multiSelect:a=!1,onSelectionChange:i,pageSize:l=10,initialSort:c,onSort:d,className:u,onRowDoubleClick:f}){const p=t!==void 0,[h,v]=b.useState([]),[x,g]=b.useState(!1),m=b.useRef(null);b.useEffect(()=>{var I;if(!r||p)return;(I=m.current)==null||I.abort();const k=new AbortController;return m.current=k,g(!0),r().then(U=>{k.signal.aborted||v(U)}).finally(()=>{k.signal.aborted||g(!1)}),()=>k.abort()},[r,p]);const w=b.useMemo(()=>p?t:h,[t,h,p]),y=s??(r?x:!1),[T,N]=b.useState(new Set),[_,A]=b.useState(1),[S,$]=b.useState(c==null?void 0:c.sortBy),[V,z]=b.useState((c==null?void 0:c.sortDir)??"asc"),q=k=>typeof n=="function"?n(k):k[n],D=b.useRef(null);b.useEffect(()=>{D.current!==w&&(N(new Set),A(1),D.current=w)},[w]);const P=b.useMemo(()=>{if(!S)return w;const k=V==="asc"?1:-1;return[...w].sort((I,U)=>{const G=I[S],ee=U[S];return G==null?-k:ee==null||G>ee?k:G<ee?-k:0})},[w,S,V]),E=Math.max(1,Math.ceil(P.length/l)),te=b.useMemo(()=>{const k=(_-1)*l;return P.slice(k,k+l)},[P,_,l]),ne=k=>{const I=new Set(T);I.has(k)?I.delete(k):I.add(k),N(I),i==null||i(w.filter(U=>I.has(q(U))))},K=()=>{const k=te.every(U=>T.has(q(U))),I=new Set(T);te.forEach(U=>{k?I.delete(q(U)):I.add(q(U))}),N(I),i==null||i(w.filter(U=>I.has(q(U))))},le=k=>{if(!k.sortable)return;const I=typeof k.accessor=="string"?k.accessor:k.sortKey;if(S===I){const U=V==="asc"?"desc":"asc";z(U),d==null||d(I,U)}else $(I),z("asc"),d==null||d(I,"asc");A(1)},C=()=>y?o.jsx("tbody",{children:Array.from({length:l}).map((k,I)=>o.jsxs("tr",{children:[a&&o.jsx("td",{children:o.jsx(Xt,{width:"1rem",height:"1rem",variant:"circle"})}),e.map((U,G)=>o.jsx("td",{children:o.jsx(Xt,{width:"100%",height:"1em",variant:"rect"})},G))]},I))}):te.length?o.jsx("tbody",{children:te.map(k=>{const I=q(k);return o.jsxs("tr",{className:se("hover:bg-gray-50",f&&"cursor-pointer select-none"),onDoubleClick:f?()=>f(k):void 0,title:f?"Doble clic para abrir":void 0,children:[a&&o.jsx("td",{children:o.jsx("input",{type:"checkbox",checked:T.has(I),onChange:()=>ne(I),onDoubleClick:U=>U.stopPropagation()})}),e.map((U,G)=>{const ee=U.render?U.render(k):typeof U.accessor=="function"?U.accessor(k):k[U.accessor];return o.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-sm",children:ee},G)})]},I)})}):o.jsx("tbody",{children:o.jsx("tr",{children:o.jsx("td",{colSpan:e.length+(a?1:0),children:"No hay datos"})})});return o.jsxs("div",{className:se("w-full overflow-auto",u),children:[o.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[o.jsx("thead",{className:"bg-gray-50",children:o.jsxs("tr",{children:[a&&o.jsx("th",{children:o.jsx("input",{type:"checkbox",checked:te.length>0&&te.every(k=>T.has(q(k))),onChange:K,onDoubleClick:k=>k.stopPropagation()})}),e.map(k=>{const I=typeof k.accessor=="string"?k.accessor:k.header,U=S===(typeof k.accessor=="string"?k.accessor:k.sortKey);return o.jsx("th",{className:se("px-4 py-2 text-left text-sm font-medium text-gray-700",k.width),onClick:()=>le(k),children:o.jsxs("div",{className:"inline-flex items-center space-x-1 cursor-pointer",children:[o.jsx("span",{children:k.header}),k.sortable&&o.jsx("span",{className:"text-xs",children:U?V==="asc"?"▲":"▼":"⇵"})]})},I)})]})}),C()]}),o.jsxs("div",{className:"flex items-center justify-between py-2 px-4",children:[o.jsx("span",{className:"text-sm text-gray-700",children:y?"Cargando...":`Página ${_} de ${E}`}),o.jsxs("div",{className:"space-x-2",children:[o.jsx(ie,{size:"sm",variant:"outline",disabled:y||_<=1,onClick:()=>A(k=>Math.max(1,k-1)),children:"Prev"}),o.jsx(ie,{size:"sm",variant:"outline",disabled:y||_>=E,onClick:()=>A(k=>Math.min(E,k+1)),children:"Next"})]})]})]})}function Ki({control:e,name:t,rules:r,defaultValue:s=!1,checked:n,onChange:a,disabled:i=!1,label:l,labelPosition:c="right",errorMessage:d="",className:u}){const f=b.useId();if(e&&t)return o.jsx(gt,{name:t,control:e,rules:r,defaultValue:s,render:({field:h,fieldState:v})=>{var x;return o.jsx(Ki,{checked:h.value,onChange:h.onChange,disabled:i,label:l,labelPosition:c,errorMessage:((x=v.error)==null?void 0:x.message)||"",className:u})}});const p=!!n;return o.jsxs("div",{className:se("flex flex-col",u),children:[o.jsxs("label",{className:se("inline-flex items-center space-x-3 select-none",i&&"opacity-50 cursor-not-allowed"),htmlFor:f,children:[l&&c==="left"&&o.jsx("span",{className:"text-ds-md text-[var(--color-ds-text-primary)]",children:l}),o.jsx("button",{id:f,type:"button",role:"switch","aria-checked":p,disabled:i,onClick:()=>!i&&(a==null?void 0:a(!p)),className:se("relative inline-flex items-center h-8 w-16","bg-[var(--color-ds-background-accent)] rounded-full transition-colors duration-200","focus:outline-none "),children:o.jsx("div",{className:se("absolute h-6 w-6 bg-[var(--color-ds-background-page)] rounded-full shadow transform transition-transform duration-200",p?"translate-x-9":"translate-x-1")})}),l&&c==="right"&&o.jsx("span",{className:"text-ds-md text-[var(--color-ds-text-primary)]",children:l})]}),o.jsx("div",{className:"pt-1 min-h-[18px] w-full",children:d?o.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:d}):o.jsx("span",{"aria-hidden":"true",children:" "})})]})}function Gi({items:e,value:t,onValueChange:r,multiple:s=!0,dense:n=!1,className:a}){const i=b.useMemo(()=>e.filter(v=>v.defaultOpen&&!v.disabled).map(v=>v.id),[e]),[l,c]=b.useState(i),d=t??l,u=v=>{r?r(v):c(v)},f=(v,x)=>{x&&u(s?d.includes(v)?d.filter(g=>g!==v):[...d,v]:d.includes(v)?[]:[v])},p=(v,x,g)=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),f(x,g))},h=n?"py-1":"py-2";return o.jsx("div",{className:["divide-y","divide-[var(--color-ds-border-default-50)]",a].filter(Boolean).join(" "),children:e.map(v=>{const x=d.includes(v.id),g=!v.disabled;return o.jsxs("section",{"aria-disabled":v.disabled||void 0,children:[o.jsxs("button",{type:"button",onClick:()=>f(v.id,g),onKeyDown:m=>p(m,v.id,g),"aria-expanded":x,className:["w-full flex items-center justify-between gap-2 text-left select-none",h,"text-[var(--color-ds-text-primary)]",v.disabled?"opacity-60 cursor-not-allowed":"hover:bg-[color-mix(in_srgb,var(--color-ds-background-surface)_80%,transparent)]"].join(" "),children:[o.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[v.leftAdornment&&o.jsx("span",{className:"shrink-0",children:v.leftAdornment}),o.jsx("span",{className:"font-medium truncate",children:v.title})]}),o.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[v.actions,o.jsx(Rs,{className:["h-4 w-4 transition-transform",x?"rotate-180":"",v.disabled?"opacity-40":""].join(" ")})]})]}),x&&o.jsx("div",{className:[n?"py-1":"py-2"].join(" "),children:v.content})]},v.id)})})}const ro=e=>{let t;const r=new Set,s=(d,u)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const p=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),r.forEach(h=>h(t,p))}},n=()=>t,l={setState:s,getState:n,getInitialState:()=>c,subscribe:d=>(r.add(d),()=>r.delete(d))},c=t=e(s,n,l);return l},af=e=>e?ro(e):ro,of=e=>e;function lf(e,t=of){const r=b.useSyncExternalStore(e.subscribe,b.useCallback(()=>t(e.getState()),[e,t]),b.useCallback(()=>t(e.getInitialState()),[e,t]));return b.useDebugValue(r),r}const so=e=>{const t=af(e),r=s=>lf(t,s);return Object.assign(r,t),r},cf=e=>e?so(e):so;var Ji=Symbol.for("immer-nothing"),no=Symbol.for("immer-draftable"),ct=Symbol.for("immer-state"),df=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function st(e,...t){if(process.env.NODE_ENV!=="production"){const r=df[e],s=typeof r=="function"?r.apply(null,t):r;throw new Error(`[Immer] ${s}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var fr=Object.getPrototypeOf;function mr(e){return!!e&&!!e[ct]}function Qt(e){var t;return e?Zi(e)||Array.isArray(e)||!!e[no]||!!((t=e.constructor)!=null&&t[no])||Br(e)||zs(e):!1}var uf=Object.prototype.constructor.toString();function Zi(e){if(!e||typeof e!="object")return!1;const t=fr(e);if(t===null)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===uf}function Ns(e,t){Ps(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,s)=>t(s,r,e))}function Ps(e){const t=e[ct];return t?t.type_:Array.isArray(e)?1:Br(e)?2:zs(e)?3:0}function _n(e,t){return Ps(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Yi(e,t,r){const s=Ps(e);s===2?e.set(t,r):s===3?e.add(r):e[t]=r}function ff(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Br(e){return e instanceof Map}function zs(e){return e instanceof Set}function Gt(e){return e.copy_||e.base_}function Fn(e,t){if(Br(e))return new Map(e);if(zs(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Zi(e);if(t===!0||t==="class_only"&&!r){const s=Object.getOwnPropertyDescriptors(e);delete s[ct];let n=Reflect.ownKeys(s);for(let a=0;a<n.length;a++){const i=n[a],l=s[i];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(s[i]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[i]})}return Object.create(fr(e),s)}else{const s=fr(e);if(s!==null&&r)return{...e};const n=Object.create(s);return Object.assign(n,e)}}function ea(e,t=!1){return Is(e)||mr(e)||!Qt(e)||(Ps(e)>1&&Object.defineProperties(e,{set:{value:os},add:{value:os},clear:{value:os},delete:{value:os}}),Object.freeze(e),t&&Object.values(e).forEach(r=>ea(r,!0))),e}function os(){st(2)}function Is(e){return Object.isFrozen(e)}var mf={};function er(e){const t=mf[e];return t||st(0,e),t}var Or;function Hi(){return Or}function hf(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ao(e,t){t&&(er("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function On(e){Rn(e),e.drafts_.forEach(pf),e.drafts_=null}function Rn(e){e===Or&&(Or=e.parent_)}function oo(e){return Or=hf(Or,e)}function pf(e){const t=e[ct];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function io(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[ct].modified_&&(On(t),st(4)),Qt(e)&&(e=Ss(t,e),t.parent_||Es(t,e)),t.patches_&&er("Patches").generateReplacementPatches_(r[ct].base_,e,t.patches_,t.inversePatches_)):e=Ss(t,r,[]),On(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ji?e:void 0}function Ss(e,t,r){if(Is(t))return t;const s=t[ct];if(!s)return Ns(t,(n,a)=>lo(e,s,t,n,a,r)),t;if(s.scope_!==e)return t;if(!s.modified_)return Es(e,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;const n=s.copy_;let a=n,i=!1;s.type_===3&&(a=new Set(n),n.clear(),i=!0),Ns(a,(l,c)=>lo(e,s,n,l,c,r,i)),Es(e,n,!1),r&&e.patches_&&er("Patches").generatePatches_(s,r,e.patches_,e.inversePatches_)}return s.copy_}function lo(e,t,r,s,n,a,i){if(process.env.NODE_ENV!=="production"&&n===r&&st(5),mr(n)){const l=a&&t&&t.type_!==3&&!_n(t.assigned_,s)?a.concat(s):void 0,c=Ss(e,n,l);if(Yi(r,s,c),mr(c))e.canAutoFreeze_=!1;else return}else i&&r.add(n);if(Qt(n)&&!Is(n)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ss(e,n),(!t||!t.scope_.parent_)&&typeof s!="symbol"&&(Br(r)?r.has(s):Object.prototype.propertyIsEnumerable.call(r,s))&&Es(e,n)}}function Es(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ea(t,r)}function bf(e,t){const r=Array.isArray(e),s={type_:r?1:0,scope_:t?t.scope_:Hi(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let n=s,a=ta;r&&(n=[s],a=Rr);const{revoke:i,proxy:l}=Proxy.revocable(n,a);return s.draft_=l,s.revoke_=i,l}var ta={get(e,t){if(t===ct)return e;const r=Gt(e);if(!_n(r,t))return gf(e,r,t);const s=r[t];return e.finalized_||!Qt(s)?s:s===en(e.base_,t)?(tn(e),e.copy_[t]=Mn(s,e)):s},has(e,t){return t in Gt(e)},ownKeys(e){return Reflect.ownKeys(Gt(e))},set(e,t,r){const s=Xi(Gt(e),t);if(s!=null&&s.set)return s.set.call(e.draft_,r),!0;if(!e.modified_){const n=en(Gt(e),t),a=n==null?void 0:n[ct];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(ff(r,n)&&(r!==void 0||_n(e.base_,t)))return!0;tn(e),Dn(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return en(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,tn(e),Dn(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Gt(e),s=Reflect.getOwnPropertyDescriptor(r,t);return s&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:s.enumerable,value:r[t]}},defineProperty(){st(11)},getPrototypeOf(e){return fr(e.base_)},setPrototypeOf(){st(12)}},Rr={};Ns(ta,(e,t)=>{Rr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Rr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&st(13),Rr.set.call(this,e,t,void 0)};Rr.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&st(14),ta.set.call(this,e[0],t,r,e[0])};function en(e,t){const r=e[ct];return(r?Gt(r):e)[t]}function gf(e,t,r){var n;const s=Xi(t,r);return s?"value"in s?s.value:(n=s.get)==null?void 0:n.call(e.draft_):void 0}function Xi(e,t){if(!(t in e))return;let r=fr(e);for(;r;){const s=Object.getOwnPropertyDescriptor(r,t);if(s)return s;r=fr(r)}}function Dn(e){e.modified_||(e.modified_=!0,e.parent_&&Dn(e.parent_))}function tn(e){e.copy_||(e.copy_=Fn(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var xf=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,s)=>{if(typeof t=="function"&&typeof r!="function"){const a=r;r=t;const i=this;return function(c=a,...d){return i.produce(c,u=>r.call(this,u,...d))}}typeof r!="function"&&st(6),s!==void 0&&typeof s!="function"&&st(7);let n;if(Qt(t)){const a=oo(this),i=Mn(t,void 0);let l=!0;try{n=r(i),l=!1}finally{l?On(a):Rn(a)}return ao(a,s),io(n,a)}else if(!t||typeof t!="object"){if(n=r(t),n===void 0&&(n=t),n===Ji&&(n=void 0),this.autoFreeze_&&ea(n,!0),s){const a=[],i=[];er("Patches").generateReplacementPatches_(t,n,a,i),s(a,i)}return n}else st(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(i,...l)=>this.produceWithPatches(i,c=>t(c,...l));let s,n;return[this.produce(t,r,(i,l)=>{s=i,n=l}),s,n]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Qt(e)||st(8),mr(e)&&(e=vf(e));const t=oo(this),r=Mn(e,void 0);return r[ct].isManual_=!0,Rn(t),r}finishDraft(e,t){const r=e&&e[ct];(!r||!r.isManual_)&&st(9);const{scope_:s}=r;return ao(s,t),io(void 0,s)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(n.path.length===0&&n.op==="replace"){e=n.value;break}}r>-1&&(t=t.slice(r+1));const s=er("Patches").applyPatches_;return mr(e)?s(e,t):this.produce(e,n=>s(n,t))}};function Mn(e,t){const r=Br(e)?er("MapSet").proxyMap_(e,t):zs(e)?er("MapSet").proxySet_(e,t):bf(e,t);return(t?t.scope_:Hi()).drafts_.push(r),r}function vf(e){return mr(e)||st(10,e),Qi(e)}function Qi(e){if(!Qt(e)||Is(e))return e;const t=e[ct];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Fn(e,t.scope_.immer_.useStrictShallowCopy_)}else r=Fn(e,!0);return Ns(r,(s,n)=>{Yi(r,s,Qi(n))}),t&&(t.finalized_=!1),r}var yf=new xf,wf=yf.produce;const rn=e=>Number(e.toFixed(2)),dr=e=>Math.max(0,Math.min(100,e??0)),jf={text:{name:"text",label:"Texto"},number:{name:"number",label:"Número"},email:{name:"email",label:"Email"},select:{name:"select",label:"Select"},checkbox:{name:"checkbox",label:"Checkbox"},date:{name:"date",label:"Fecha"},textarea:{name:"textarea",label:"Textarea"},file:{name:"file",label:"Archivo"}},_e=e=>e.layout.find(t=>t.type==="rows"),mt=(e,t)=>{if(t==null)return _e(e);const r=e.layout[t];return r&&r.type==="rows"?r:_e(e)},sn=e=>e<=1?["w-full"]:e===2?["w-1/2","w-1/2"]:e===3?["w-1/3","w-1/3","w-1/3"]:Array.from({length:e},()=>"flex-1"),nn={1:["w-full"],2:["w-1/2","w-1/2"],3:["w-1/3","w-1/3","w-1/3"],4:["w-1/4","w-1/4","w-1/4","w-1/4"],"1/3-2/3":["w-1/3","w-2/3"],"2/3-1/3":["w-2/3","w-1/3"],"1/4-3/4":["w-1/4","w-3/4"],"3/4-1/4":["w-3/4","w-1/4"]},$e=(e,t)=>{for(let r=0;r<e.layout.length;r++){const s=e.layout[r];if((s==null?void 0:s.type)!=="tabs")continue;const n=s.tabs.findIndex(a=>a.key===t);if(n>=0)return{nodeIdx:r,tabIdx:n}}return null},kf=e=>{const t=[];return e.layout.forEach(r=>{r.type==="rows"&&r.sections.forEach(s=>s.rows.forEach(n=>n.columns.forEach(a=>(a.fields??[]).forEach(i=>t.push(i))))),r.type==="tabs"&&r.tabs.forEach(s=>s.sections.forEach(n=>n.rows.forEach(a=>a.columns.forEach(i=>(i.fields??[]).forEach(l=>t.push(l))))))}),t},Nf=e=>({type:"rows",sections:[{sectionTitle:e??"Sección",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}),Sf=()=>({type:"tabs",tabs:[{key:`tab_${Date.now().toString(36)}_1`,label:"Pestaña 1",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]},{key:`tab_${Date.now().toString(36)}_2`,label:"Pestaña 2",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}]}),ir=(e,t)=>kf(e).includes(t),$n=e=>e.replace(/(?:_copy)+$/i,"").replace(/_(\d+)$/i,""),el=e=>e.replace(/\s\((\d+)\)$/i,""),Xe=(e,t)=>{const r=e||"campo";if(!t.has(r))return r;let s=2;for(;t.has(`${r}_${s}`);)s++;return`${r}_${s}`},ot=(e,t)=>{const r=e||"Campo";if(!t.has(r))return r;let s=2;for(;t.has(`${r} (${s})`);)s++;return`${r} (${s})`},Qe=e=>{const t=(e.type??"text").toString(),r=jf[t]??{name:"campo",label:"Campo"},s=e.name?$n(e.name):r.name,n=e.label?el(e.label):r.label;return{baseName:s,baseLabel:n}},Ef={layout:[{type:"rows",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}],fields:[],onSubmit:async()=>{},successMessage:"Guardado",errorMessage:"Error"},J=cf((e,t)=>({schema:Ef,selection:{kind:"none"},past:[],future:[],setSchema:r=>{const s=t().schema,n=wf(s,r),a=n;e(i=>({...i,schema:a,past:[...i.past,s],future:[]}))},setSelection:r=>e({selection:r}),undo:()=>e(r=>r.past.length?{schema:r.past[r.past.length-1],past:r.past.slice(0,-1),future:[r.schema,...r.future]}:r),redo:()=>e(r=>r.future.length?{schema:r.future[0],past:[...r.past,r.schema],future:r.future.slice(1)}:r),resetHistory:()=>e(r=>({past:[],future:[]})),addField:r=>t().setSchema(s=>{const{baseName:n,baseLabel:a}=Qe(r),i=new Set(s.fields.map(u=>u.name).filter(Boolean)),l=new Set(s.fields.map(u=>u.label??"").filter(Boolean)),c=Xe(n,i),d=ot(a,l);r.name=c,r.label||(r.label=d),s.fields.push(r)}),addFieldAt:(r,s)=>t().setSchema(n=>{const{baseName:a,baseLabel:i}=Qe(r),l=new Set(n.fields.map(p=>p.name).filter(Boolean)),c=new Set(n.fields.map(p=>p.label??"").filter(Boolean)),d=Xe(a,l),u=ot(i,c);r.name=d,r.label||(r.label=u);const f=Math.max(0,Math.min(s??n.fields.length,n.fields.length));n.fields.splice(f,0,r)}),removeField:r=>t().setSchema(s=>{s.fields=s.fields.filter(n=>n.name!==r),s.layout.forEach(n=>{n.type==="rows"&&n.sections.forEach(a=>a.rows.forEach(i=>i.columns.forEach(l=>{l.fields=(l.fields??[]).filter(c=>c!==r)}))),n.type==="tabs"&&n.tabs.forEach(a=>a.sections.forEach(i=>i.rows.forEach(l=>l.columns.forEach(c=>{c.fields=(c.fields??[]).filter(d=>d!==r)}))))})}),updateField:(r,s)=>t().setSchema(n=>{const a=n.fields.findIndex(i=>i.name===r);a>=0&&s(n.fields[a])}),duplicateField:(r,s)=>t().setSchema(n=>{const a=n.fields.findIndex(v=>v.name===r);if(a<0)return;const i=n.fields[a],l=$n((s==null?void 0:s.trim())||i.name||""),c=el(i.label??""),d=new Set(n.fields.map(v=>v.name).filter(Boolean)),u=new Set(n.fields.map(v=>v.label??"").filter(Boolean)),f=Xe(l||Qe(i).baseName,d),p=ot(c||Qe(i).baseLabel,u),h=JSON.parse(JSON.stringify(i));h.name=f,h.label=p,n.fields.splice(a+1,0,h)}),renameField:(r,s)=>t().setSchema(n=>{const a=n.fields.findIndex(d=>d.name===r);if(a<0)return;const i=$n((s??r).trim()||"campo"),l=new Set(n.fields.map(d=>d.name).filter(Boolean));l.delete(r);const c=Xe(i,l);n.fields[a].name=c,n.layout.forEach(d=>{d.type==="rows"&&d.sections.forEach(u=>u.rows.forEach(f=>f.columns.forEach(p=>{p.fields&&(p.fields=p.fields.map(h=>h===r?c:h))}))),d.type==="tabs"&&d.tabs.forEach(u=>u.sections.forEach(f=>f.rows.forEach(p=>p.columns.forEach(h=>{h.fields&&(h.fields=h.fields.map(v=>v===r?c:v))}))))})}),addSection:r=>t().setSchema(s=>{const n=_e(s);if(!n)return;const a={sectionTitle:r??"Nueva sección",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]};n.sections.push(a)}),renameSection:(r,s)=>t().setSchema(n=>{const a=_e(n);if(!a)return;const i=a.sections[r];i&&(i.sectionTitle=(s??"").trim()||"Sección")}),moveSection:(r,s,n)=>e(a=>{const i=[...a.schema.layout],l=i[r];if(!l||l.type!=="rows")return a;const c=[...l.sections],[d]=c.splice(s,1),u=Math.max(0,Math.min(n,c.length));return c.splice(u,0,d),i[r]={...l,sections:c},{schema:{...a.schema,layout:i}}}),removeSection:r=>t().setSchema(s=>{const n=_e(s);if(!n||r<0||r>=n.sections.length)return;const a=[...n.sections];a.splice(r,1),n.sections=a}),duplicateSection:r=>t().setSchema(s=>{const n=_e(s);if(!n)return;const a=n.sections[r];if(!a)return;const i=JSON.parse(JSON.stringify(a)),l=(a.sectionTitle||"Sección").toString(),c=n.sections.map(f=>f.sectionTitle||""),d=new Set(c);let u=l;if(d.has(u)){let f=2;for(;d.has(`${l} (${f})`);)f++;u=`${l} (${f})`}i.sectionTitle=u,n.sections.splice(r+1,0,i)}),addRowsBlockAt:(r,s)=>t().setSchema(n=>{const a=Math.max(0,Math.min(r,n.layout.length));n.layout.splice(a,0,Nf(s))}),addTabsContainerAt:r=>t().setSchema(s=>{const n=Math.max(0,Math.min(r,s.layout.length));s.layout.splice(n,0,Sf())}),moveLayoutNode:(r,s)=>t().setSchema(n=>{const a=n.layout.length;if(r<0||r>=a)return;const i=Math.max(0,Math.min(s,a-1));if(r===i)return;const l=[...n.layout],[c]=l.splice(r,1);l.splice(i,0,c),n.layout=l}),removeLayoutNode:r=>t().setSchema(s=>{if(r<0||r>=s.layout.length)return;const n=[...s.layout];n.splice(r,1),s.layout=n}),addTabsContainer:()=>t().setSchema(r=>{const s={type:"tabs",tabs:[{key:"tab1",label:"Pestaña 1",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]},{key:"tab2",label:"Pestaña 2",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}]};r.layout.push(s)}),addTabAfter:r=>t().setSchema(s=>{const n=$e(s,r);if(!n)return;const a=s.layout[n.nodeIdx],i="Nueva pestaña",l=new Set(a.tabs.map(f=>f.label));let c=i,d=2;for(;l.has(c);)c=`${i} (${d++})`;const u={key:`tab_${Date.now().toString(36)}`,label:c,sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]};a.tabs.splice(n.tabIdx+1,0,u)}),removeTab:r=>t().setSchema(s=>{const n=$e(s,r);if(!n)return;const a=s.layout[n.nodeIdx];a.tabs.length<=1||a.tabs.splice(n.tabIdx,1)}),renameTab:(r,s)=>t().setSchema(n=>{const a=$e(n,r);if(!a)return;const i=n.layout[a.nodeIdx];i.tabs[a.tabIdx].label=(s??"").trim()||"Pestaña"}),moveTab:(r,s,n)=>e(a=>{const i=[...a.schema.layout],l=i[r];if(!l||l.type!=="tabs")return a;const c=[...l.tabs],[d]=c.splice(s,1),u=Math.max(0,Math.min(n,c.length));return c.splice(u,0,d),i[r]={...l,tabs:c},{schema:{...a.schema,layout:i}}}),moveTabSection:(r,s,n,a)=>e(i=>{const l=[...i.schema.layout],c=l[r];if(!c||c.type!=="tabs")return i;const d=c.tabs.find(v=>v.key===s);if(!d)return i;const u=[...d.sections],[f]=u.splice(n,1),p=Math.max(0,Math.min(a,u.length));u.splice(p,0,f);const h=c.tabs.map(v=>v.key===s?{...v,sections:u}:v);return l[r]={...c,tabs:h},{schema:{...i.schema,layout:l}}}),addSectionToTab:(r,s)=>t().setSchema(n=>{const a=$e(n,r);if(!a)return;n.layout[a.nodeIdx].tabs[a.tabIdx].sections.push({sectionTitle:s??"Nueva sección",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]})}),addRowToTabSection:(r,s)=>t().setSchema(n=>{var l;const a=$e(n,r);if(!a)return;(l=n.layout[a.nodeIdx].tabs[a.tabIdx].sections[s])==null||l.rows.push({title:"",columns:[{width:"w-full",fields:[]}]})}),renameTabSection:(r,s,n)=>t().setSchema(a=>{const i=$e(a,r);if(!i)return;const c=a.layout[i.nodeIdx].tabs[i.tabIdx].sections[s];c&&(c.sectionTitle=(n??"").trim()||"Sección")}),setTabRowColumns:(r,s,n,a)=>t().setSchema(i=>{var h,v;const l=$e(i,r);if(!l)return;const d=(v=(h=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[s])==null?void 0:h.rows)==null?void 0:v[n];if(!d)return;const u=(d.columns??[]).flatMap(x=>x.fields??[]),f=sn(a),p=Array.from({length:a},(x,g)=>({width:f[g],fields:[]}));u.forEach((x,g)=>p[g%a].fields.push(x)),d.columns=p}),addColumnToTabRow:(r,s,n)=>t().setSchema(a=>{var d,u;const i=$e(a,r);if(!i)return;const c=(u=(d=a.layout[i.nodeIdx].tabs[i.tabIdx].sections[s])==null?void 0:d.rows)==null?void 0:u[n];c&&c.columns.push({width:"w-1/2",fields:[]})}),removeTabColumn:(r,s,n,a)=>t().setSchema(i=>{var v,x;const l=$e(i,r);if(!l)return;const d=(x=(v=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[s])==null?void 0:v.rows)==null?void 0:x[n];if(!d)return;const u=d.columns??[];if(!u[a])return;const f=u[a],p=a>0?a-1:u[a+1]?a+1:-1,h=[...u];h.splice(a,1),p>=0&&h[p]&&(h[p].fields=[...h[p].fields??[],...f.fields??[]]),d.columns=h}),placeFieldInTabColumn:(r,s,n,a,i)=>t().setSchema(l=>{const c=$e(l,s);if(!c)return;const u=l.layout[c.nodeIdx].tabs[c.tabIdx].sections[n].rows[a].columns[i];let f=r;if(ir(l,r)){const p=l.fields.findIndex(h=>h.name===r);if(p>=0){const h=l.fields[p],{baseName:v,baseLabel:x}=Qe(h),g=new Set(l.fields.map(T=>T.name).filter(Boolean)),m=new Set(l.fields.map(T=>T.label??"").filter(Boolean));f=Xe(v,g);const w=ot(x,m),y=JSON.parse(JSON.stringify(h));y.name=f,y.label=w,l.fields.splice(p+1,0,y)}}u.fields=[...u.fields??[],f]}),moveFieldInTab:(r,s)=>t().setSchema(n=>{var h,v,x,g;const a=$e(n,r.tabKey);if(!a)return;const i=n.layout[a.nodeIdx],l=(v=(h=i.tabs[a.tabIdx].sections[r.s])==null?void 0:h.rows[r.r])==null?void 0:v.columns[r.c],c=(g=(x=i.tabs[a.tabIdx].sections[s.s])==null?void 0:x.rows[s.r])==null?void 0:g.columns[s.c];if(!l||!c)return;const d=[...l.fields??[]];if(r.idx<0||r.idx>=d.length)return;const[u]=d.splice(r.idx,1);l.fields=d;const f=[...c.fields??[]],p=s.idx===void 0?f.length:Math.max(0,Math.min(s.idx,f.length));f.splice(p,0,u),c.fields=f}),removeFieldFromTabLayout:r=>t().setSchema(s=>{var c,d;const n=$e(s,r.tabKey);if(!n)return;const i=(d=(c=s.layout[n.nodeIdx].tabs[n.tabIdx].sections[r.s])==null?void 0:c.rows[r.r])==null?void 0:d.columns[r.c];if(!i||!i.fields||r.idx<0||r.idx>=i.fields.length)return;const l=[...i.fields];l.splice(r.idx,1),i.fields=l}),moveRowInSection:(r,s,n)=>t().setSchema(a=>{const i=_e(a);if(!i)return;const l=i.sections[r];if(!l)return;const c=[...l.rows];if(s<0||s>=c.length)return;const d=Math.max(0,Math.min(n,c.length-1));if(s===d)return;const[u]=c.splice(s,1);c.splice(d,0,u),l.rows=c}),duplicateRowInSection:(r,s)=>t().setSchema(n=>{const a=_e(n);if(!a)return;const i=a.sections[r];if(!i)return;const l=i.rows[s];if(!l)return;const c=JSON.parse(JSON.stringify(l));i.rows.splice(s+1,0,c)}),removeRowFromSection:(r,s)=>t().setSchema(n=>{const a=_e(n);if(!a)return;const i=a.sections[r];if(!i)return;const l=[...i.rows];s<0||s>=l.length||(l.splice(s,1),l.length===0&&l.push({title:"",columns:[{width:"w-full",fields:[]}]}),i.rows=l)}),setRowColumnsPreset:(r,s,n)=>t().setSchema(a=>{var d,u;const i=_e(a);if(!i)return;const l=(u=(d=i.sections[r])==null?void 0:d.rows)==null?void 0:u[s];if(!l)return;const c=nn[n];c&&an(l,c)}),setRowResponsive:(r,s,n)=>t().setSchema(a=>{var h,v;const i=_e(a);if(!i)return;const l=(v=(h=i.sections[Number(r)])==null?void 0:h.rows)==null?void 0:v[Number(s)];if(!l)return;const c=Math.max(n.desktop.count??1,n.tablet.count??1,n.mobile.count??1),d=(l.columns??[]).flatMap(x=>x.fields??[]),u=ln(d,c),f=(x,g,m)=>g<(m??0)?dr((x==null?void 0:x[g])??0):null,p=Array.from({length:c},(x,g)=>{const m=f(n.mobile.widths,g,n.mobile.count),w=f(n.tablet.widths,g,n.tablet.count),y=f(n.desktop.widths,g,n.desktop.count);return{width:on(m,w,y),fields:u[g]??[]}});l.columns=p}),setRowColumnsAt:(r,s,n,a)=>t().setSchema(i=>{var p,h;const l=mt(i,r);if(!l)return;const c=(h=(p=l.sections[s])==null?void 0:p.rows)==null?void 0:h[n];if(!c)return;const d=(c.columns??[]).flatMap(v=>v.fields??[]),u=sn(a),f=Array.from({length:a},(v,x)=>({width:u[x],fields:[]}));d.forEach((v,x)=>f[x%a].fields.push(v)),c.columns=f}),addColumnToRowAt:(r,s,n)=>t().setSchema(a=>{var l,c,d,u;const i=mt(a,r);i&&((u=(d=(c=(l=i.sections[s])==null?void 0:l.rows)==null?void 0:c[n])==null?void 0:d.columns)==null||u.push({width:"w-1/2",fields:[]}))}),removeColumnAt:(r,s,n,a)=>t().setSchema(i=>{var h,v;const l=mt(i,r);if(!l)return;const c=(v=(h=l.sections[s])==null?void 0:h.rows)==null?void 0:v[n];if(!c)return;const d=c.columns??[];if(!d[a])return;const u=d[a],f=a>0?a-1:d[a+1]?a+1:-1,p=[...d];p.splice(a,1),f>=0&&p[f]&&(p[f].fields=[...p[f].fields??[],...u.fields??[]]),c.columns=p}),setRowColumnsPresetAt:(r,s,n,a)=>t().setSchema(i=>{var u,f;const l=mt(i,r);if(!l)return;const c=(f=(u=l.sections[s])==null?void 0:u.rows)==null?void 0:f[n];if(!c)return;const d=nn[a];d&&an(c,d)}),setRowResponsiveAt:(r,s,n,a)=>t().setSchema(i=>{var v,x;const l=mt(i,r);if(!l)return;const c=(x=(v=l.sections[Number(s)])==null?void 0:v.rows)==null?void 0:x[Number(n)];if(!c)return;const d=Math.max(a.desktop.count??1,a.tablet.count??1,a.mobile.count??1),u=(g,m,w)=>m<(w??0)?dr((g==null?void 0:g[m])??0):null,f=Cf(c,d),p=f.flatMap(g=>g.fields??[]),h=ln(p,d);for(let g=0;g<d;g++){const m=u(a.mobile.widths,g,a.mobile.count),w=u(a.tablet.widths,g,a.tablet.count),y=u(a.desktop.widths,g,a.desktop.count);f[g].width=on(m,w,y),f[g].fields=h[g]??[]}}),placeFieldInColumnAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var v,x,g,m;const d=mt(c,r);if(!d)return;const u=(m=(g=(x=(v=d.sections[n])==null?void 0:v.rows)==null?void 0:x[a])==null?void 0:g.columns)==null?void 0:m[i];if(!u)return;let f=s;if(ir(c,s)){const w=c.fields.findIndex(y=>y.name===s);if(w>=0){const y=c.fields[w],{baseName:T,baseLabel:N}=Qe(y),_=new Set(c.fields.map(V=>V.name).filter(Boolean)),A=new Set(c.fields.map(V=>V.label??"").filter(Boolean));f=Xe(T,_);const S=ot(N,A),$=JSON.parse(JSON.stringify(y));$.name=f,$.label=S,c.fields.splice(w+1,0,$)}}const p=[...u.fields??[]],h=l===void 0?p.length:Math.max(0,Math.min(l,p.length));p.splice(h,0,f),u.fields=p}),moveFieldAt:(r,s,n,a)=>t().setSchema(i=>{var x,g,m,w,y,T,N,_;const l=mt(i,r),c=mt(i,n);if(!l||!c)return;const d=(w=(m=(g=(x=l.sections[s.s])==null?void 0:x.rows)==null?void 0:g[s.r])==null?void 0:m.columns)==null?void 0:w[s.c],u=(_=(N=(T=(y=c.sections[a.s])==null?void 0:y.rows)==null?void 0:T[a.r])==null?void 0:N.columns)==null?void 0:_[a.c];if(!d||!u)return;const f=[...d.fields??[]];if(s.idx<0||s.idx>=f.length)return;const[p]=f.splice(s.idx,1);d.fields=f;const h=[...u.fields??[]],v=a.idx===void 0?h.length:Math.max(0,Math.min(a.idx,h.length));h.splice(v,0,p),u.fields=h}),removeFieldFromLayoutAt:(r,s)=>t().setSchema(n=>{var c,d,u,f;const a=mt(n,r);if(!a)return;const i=(f=(u=(d=(c=a.sections[s.s])==null?void 0:c.rows)==null?void 0:d[s.r])==null?void 0:u.columns)==null?void 0:f[s.c];if(!i||!i.fields||s.idx<0||s.idx>=i.fields.length)return;const l=[...i.fields];l.splice(s.idx,1),i.fields=l}),insertExistingFieldAtAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var v,x,g,m;const d=mt(c,r);if(!d)return;const u=(m=(g=(x=(v=d.sections[n])==null?void 0:v.rows)==null?void 0:x[a])==null?void 0:g.columns)==null?void 0:m[i];if(!u)return;let f=s;if(ir(c,s)){const w=c.fields.findIndex(y=>y.name===s);if(w>=0){const y=c.fields[w],{baseName:T,baseLabel:N}=Qe(y),_=new Set(c.fields.map(z=>z.name).filter(Boolean)),A=new Set(c.fields.map(z=>z.label??"").filter(Boolean)),S=Xe(T,_),$=ot(N,A),V=JSON.parse(JSON.stringify(y));V.name=S,V.label=$,c.fields.splice(w+1,0,V),f=S}}const p=[...u.fields??[]],h=Math.max(0,Math.min(l,p.length));p.splice(h,0,f),u.fields=p}),addFieldAndPlaceAtAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var T,N,_,A;const{baseName:d,baseLabel:u}=Qe(s),f=new Set(c.fields.map(S=>S.name).filter(Boolean)),p=new Set(c.fields.map(S=>S.label??"").filter(Boolean)),h=Xe(d,f),v=ot(u,p),x=JSON.parse(JSON.stringify(s));x.name=h,x.label||(x.label=v),c.fields.push(x);const g=mt(c,r);if(!g)return;const m=(A=(_=(N=(T=g.sections[n])==null?void 0:T.rows)==null?void 0:N[a])==null?void 0:_.columns)==null?void 0:A[i];if(!m)return;const w=[...m.fields??[]],y=Math.max(0,Math.min(l,w.length));w.splice(y,0,h),m.fields=w}),setTabRowResponsive:(r,s,n,a)=>t().setSchema(i=>{var x,g;const l=$e(i,r);if(!l)return;const d=(g=(x=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[Number(s)])==null?void 0:x.rows)==null?void 0:g[Number(n)];if(!d)return;const u=Math.max(a.desktop.count??1,a.tablet.count??1,a.mobile.count??1),f=(d.columns??[]).flatMap(m=>m.fields??[]),p=ln(f,u),h=(m,w,y)=>w<(y??0)?dr((m==null?void 0:m[w])??0):null,v=Array.from({length:u},(m,w)=>{const y=h(a.mobile.widths,w,a.mobile.count),T=h(a.tablet.widths,w,a.tablet.count),N=h(a.desktop.widths,w,a.desktop.count);return{width:on(y,T,N),fields:p[w]??[]}});d.columns=v}),moveTabRow:(r,s,n,a)=>t().setSchema(i=>{const l=$e(i,r);if(!l)return;const d=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[s];if(!d)return;const u=[...d.rows];if(n<0||n>=u.length)return;const f=Math.max(0,Math.min(a,u.length-1));if(n===f)return;const[p]=u.splice(n,1);u.splice(f,0,p),d.rows=u}),duplicateTabRow:(r,s,n)=>t().setSchema(a=>{const i=$e(a,r);if(!i)return;const c=a.layout[i.nodeIdx].tabs[i.tabIdx].sections[s];if(!c)return;const d=c.rows[n];if(!d)return;const u=JSON.parse(JSON.stringify(d));c.rows.splice(n+1,0,u)}),removeTabRow:(r,s,n)=>t().setSchema(a=>{const i=$e(a,r);if(!i)return;const c=a.layout[i.nodeIdx].tabs[i.tabIdx].sections[s];if(!c)return;const d=[...c.rows];n<0||n>=d.length||(d.splice(n,1),d.length===0&&d.push({title:"",columns:[{width:"w-full",fields:[]}]}),c.rows=d)}),setTabRowColumnsPreset:(r,s,n,a)=>t().setSchema(i=>{var f,p;const l=$e(i,r);if(!l)return;const d=(p=(f=i.layout[l.nodeIdx].tabs[l.tabIdx].sections[s])==null?void 0:f.rows)==null?void 0:p[n];if(!d)return;const u=nn[a];u&&an(d,u)}),addRowToSection:r=>t().setSchema(s=>{const n=_e(s);n&&n.sections[r].rows.push({title:"",columns:[{width:"w-full",fields:[]}]})}),addColumnToRow:(r,s)=>t().setSchema(n=>{const a=_e(n);a&&a.sections[r].rows[s].columns.push({width:"w-1/2",fields:[]})}),setRowColumns:(r,s,n)=>t().setSchema(a=>{const i=_e(a);if(!i)return;const l=i.sections[r].rows[s],c=(l.columns??[]).flatMap(f=>f.fields??[]),d=sn(n),u=Array.from({length:n},(f,p)=>({width:d[p],fields:[]}));c.forEach((f,p)=>u[p%n].fields.push(f)),l.columns=u}),removeColumn:(r,s,n)=>t().setSchema(a=>{const i=_e(a);if(!i)return;const l=i.sections[r].rows[s],c=l.columns??[];if(!c[n])return;const d=c[n],u=n>0?n-1:c[n+1]?n+1:-1,f=[...c];f.splice(n,1),u>=0&&f[u]&&(f[u].fields=[...f[u].fields??[],...d.fields??[]]),l.columns=f}),placeFieldInColumn:(r,s,n,a)=>t().setSchema(i=>{const l=_e(i);if(!l)return;const c=l.sections[s].rows[n].columns[a];let d=r;if(ir(i,r)){const u=i.fields.findIndex(f=>f.name===r);if(u>=0){const f=i.fields[u],{baseName:p,baseLabel:h}=Qe(f),v=new Set(i.fields.map(y=>y.name).filter(Boolean)),x=new Set(i.fields.map(y=>y.label??"").filter(Boolean)),g=Xe(p,v),m=ot(h,x),w=JSON.parse(JSON.stringify(f));w.name=g,w.label=m,i.fields.splice(u+1,0,w),d=g}}c.fields=[...c.fields??[],d]}),moveField:(r,s)=>t().setSchema(n=>{var p,h,v,x;const a=_e(n);if(!a)return;const i=(h=(p=a.sections[r.s])==null?void 0:p.rows[r.r])==null?void 0:h.columns[r.c],l=(x=(v=a.sections[s.s])==null?void 0:v.rows[s.r])==null?void 0:x.columns[s.c];if(!i||!l)return;const c=[...i.fields??[]];if(r.idx<0||r.idx>=c.length)return;const[d]=c.splice(r.idx,1);i.fields=c;const u=[...l.fields??[]],f=s.idx===void 0?u.length:Math.max(0,Math.min(s.idx,u.length));u.splice(f,0,d),l.fields=u}),removeFieldFromLayout:r=>t().setSchema(s=>{var l,c;const n=_e(s);if(!n)return;const a=(c=(l=n.sections[r.s])==null?void 0:l.rows[r.r])==null?void 0:c.columns[r.c];if(!a||!a.fields||r.idx<0||r.idx>=a.fields.length)return;const i=[...a.fields];i.splice(r.idx,1),a.fields=i}),addFieldAndPlace:(r,s,n,a)=>t().setSchema(i=>{const{baseName:l,baseLabel:c}=Qe(r),d=new Set(i.fields.map(g=>g.name).filter(Boolean)),u=new Set(i.fields.map(g=>g.label??"").filter(Boolean)),f=Xe(l,d),p=ot(c,u),h=JSON.parse(JSON.stringify(r));h.name=f,h.label||(h.label=p),i.fields.push(h);const v=_e(i);if(!v)return;const x=v.sections[s].rows[n].columns[a];x.fields=[...x.fields??[],f]}),moveFieldWithinColumn:(r,s,n,a,i)=>t().setSchema(l=>{var h,v,x,g;const c=_e(l);if(!c)return;const d=(g=(x=(v=(h=c.sections[r])==null?void 0:h.rows)==null?void 0:v[s])==null?void 0:x.columns)==null?void 0:g[n];if(!d)return;const u=[...d.fields??[]];if(a<0||a>=u.length)return;const[f]=u.splice(a,1),p=Math.max(0,Math.min(i,u.length));u.splice(p,0,f),d.fields=u}),insertExistingFieldAt:(r,s,n,a,i)=>t().setSchema(l=>{var h,v,x,g;const c=_e(l);if(!c)return;const d=(g=(x=(v=(h=c.sections[s])==null?void 0:h.rows)==null?void 0:v[n])==null?void 0:x.columns)==null?void 0:g[a];if(!d)return;let u=r;if(ir(l,r)){const m=l.fields.findIndex(w=>w.name===r);if(m>=0){const w=l.fields[m],{baseName:y,baseLabel:T}=Qe(w),N=new Set(l.fields.map(V=>V.name).filter(Boolean)),_=new Set(l.fields.map(V=>V.label??"").filter(Boolean)),A=Xe(y,N),S=ot(T,_),$=JSON.parse(JSON.stringify(w));$.name=A,$.label=S,l.fields.splice(m+1,0,$),u=A}}const f=[...d.fields??[]],p=Math.max(0,Math.min(i,f.length));f.splice(p,0,u),d.fields=f}),addFieldAndPlaceAt:(r,s,n,a,i)=>t().setSchema(l=>{var y,T,N,_;const{baseName:c,baseLabel:d}=Qe(r),u=new Set(l.fields.map(A=>A.name).filter(Boolean)),f=new Set(l.fields.map(A=>A.label??"").filter(Boolean)),p=Xe(c,u),h=ot(d,f),v=JSON.parse(JSON.stringify(r));v.name=p,v.label||(v.label=h),l.fields.push(v);const x=_e(l);if(!x)return;const g=(_=(N=(T=(y=x.sections[s])==null?void 0:y.rows)==null?void 0:T[n])==null?void 0:N.columns)==null?void 0:_[a];if(!g)return;const m=[...g.fields??[]],w=Math.max(0,Math.min(i,m.length));m.splice(w,0,p),g.fields=m}),moveFieldWithinTab:(r,s,n,a,i,l)=>t().setSchema(c=>{var v,x,g,m;const d=$e(c,r);if(!d)return;const u=(m=(g=(x=(v=c.layout[d.nodeIdx].tabs[d.tabIdx].sections[s])==null?void 0:v.rows)==null?void 0:x[n])==null?void 0:g.columns)==null?void 0:m[a];if(!u)return;const f=[...u.fields??[]];if(i<0||i>=f.length)return;const[p]=f.splice(i,1),h=Math.max(0,Math.min(l,f.length));f.splice(h,0,p),u.fields=f}),insertExistingFieldInTabAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var v,x,g,m;const d=$e(c,s);if(!d)return;const u=(m=(g=(x=(v=c.layout[d.nodeIdx].tabs[d.tabIdx].sections[n])==null?void 0:v.rows)==null?void 0:x[a])==null?void 0:g.columns)==null?void 0:m[i];if(!u)return;let f=r;if(ir(c,r)){const w=c.fields.findIndex(y=>y.name===r);if(w>=0){const y=c.fields[w],{baseName:T,baseLabel:N}=Qe(y),_=new Set(c.fields.map(z=>z.name).filter(Boolean)),A=new Set(c.fields.map(z=>z.label??"").filter(Boolean)),S=Xe(T,_),$=ot(N,A),V=JSON.parse(JSON.stringify(y));V.name=S,V.label=$,c.fields.splice(w+1,0,V),f=S}}const p=[...u.fields??[]],h=Math.max(0,Math.min(l,p.length));p.splice(h,0,f),u.fields=p}),addFieldAndPlaceInTabAt:(r,s,n,a,i,l)=>t().setSchema(c=>{var T,N,_,A;const d=$e(c,s);if(!d)return;const{baseName:u,baseLabel:f}=Qe(r),p=new Set(c.fields.map(S=>S.name).filter(Boolean)),h=new Set(c.fields.map(S=>S.label??"").filter(Boolean)),v=Xe(u,p),x=ot(f,h),g=JSON.parse(JSON.stringify(r));g.name=v,g.label||(g.label=x),c.fields.push(g);const m=(A=(_=(N=(T=c.layout[d.nodeIdx].tabs[d.tabIdx].sections[n])==null?void 0:T.rows)==null?void 0:N[a])==null?void 0:_.columns)==null?void 0:A[i];if(!m)return;const w=[...m.fields??[]],y=Math.max(0,Math.min(l,w.length));w.splice(y,0,v),m.fields=w}),changeFieldType:(r,s)=>t().setSchema(n=>{const a=n.fields.findIndex(d=>d.name===r);if(a<0)return;const i=n.fields[a],c={...{name:i.name,label:i.label,width:i.width,size:i.size,info:i.info,disabled:i.disabled,visibleWhen:i.visibleWhen,disabledWhen:i.disabledWhen,clearWhen:i.clearWhen,validation:i.validation,placeholder:i.placeholder},type:s};switch(s){case"text":case"email":case"password":case"number":break;case"textarea":c.maxLength=i.maxLength??void 0,c.showCounter=i.showCounter??!1;break;case"select":c.options=Array.isArray(i.options)?i.options:[],c.multiple=!!i.multiple,c.loadOptions=i.loadOptions??void 0;break;case"checkbox":c.defaultValue=!!i.defaultValue,delete c.placeholder;break;case"date":c.showTime=!!i.showTime;break;case"file":c.maxFiles=i.maxFiles??1,c.accept=i.accept??"",delete c.placeholder;break}s!=="select"&&(delete c.options,delete c.multiple,delete c.loadOptions),s!=="textarea"&&(delete c.maxLength,delete c.showCounter),s!=="checkbox"&&delete c.defaultValue,s!=="date"&&delete c.showTime,s!=="file"&&(delete c.maxFiles,delete c.accept),n.fields[a]=c})}));function an(e,t){const r=(e.columns??[]).flatMap(a=>a.fields??[]),s=t.length,n=t.map(a=>({width:a,fields:[]}));r.forEach((a,i)=>n[i%s].fields.push(a)),e.columns=n}function on(e,t,r){const s=[];return e===null?s.push("hidden"):s.push(`w-[${rn(dr(e))}%]`,"block"),t===null?s.push("md:hidden"):s.push(`md:w-[${rn(dr(t))}%]`,"md:block"),r===null?s.push("lg:hidden"):s.push(`lg:w-[${rn(dr(r))}%]`,"lg:block"),s.join(" ")}function Cf(e,t){const r=e.columns??[];if(r.length===t)return r;if(r.length<t){const n=t-r.length,a=[...r];for(let i=0;i<n;i++)a.push({width:"w-[100%]",fields:[]});return e.columns=a,a}const s=r.slice(0,t);for(let n=t;n<r.length;n++)s[t-1].fields=[...s[t-1].fields??[],...r[n].fields??[]];return e.columns=s,s}function ln(e,t){const r=Array.from({length:t},()=>[]);return e.forEach((s,n)=>r[n%t].push(s)),r}const Vs=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function br(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ra(e){return"nodeType"in e}function Ye(e){var t,r;return e?br(e)?e:ra(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function sa(e){const{Document:t}=Ye(e);return e instanceof t}function Ur(e){return br(e)?!1:e instanceof Ye(e).HTMLElement}function tl(e){return e instanceof Ye(e).SVGElement}function gr(e){return e?br(e)?e.document:ra(e)?sa(e)?e:Ur(e)||tl(e)?e.ownerDocument:document:document:document}const _t=Vs?b.useLayoutEffect:b.useEffect;function Bs(e){const t=b.useRef(e);return _t(()=>{t.current=e}),b.useCallback(function(){for(var r=arguments.length,s=new Array(r),n=0;n<r;n++)s[n]=arguments[n];return t.current==null?void 0:t.current(...s)},[])}function Af(){const e=b.useRef(null),t=b.useCallback((s,n)=>{e.current=setInterval(s,n)},[]),r=b.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function Dr(e,t){t===void 0&&(t=[e]);const r=b.useRef(e);return _t(()=>{r.current!==e&&(r.current=e)},t),r}function qr(e,t){const r=b.useRef();return b.useMemo(()=>{const s=e(r.current);return r.current=s,s},[...t])}function Cs(e){const t=Bs(e),r=b.useRef(null),s=b.useCallback(n=>{n!==r.current&&(t==null||t(n,r.current)),r.current=n},[]);return[r,s]}function As(e){const t=b.useRef();return b.useEffect(()=>{t.current=e},[e]),t.current}let cn={};function Us(e,t){return b.useMemo(()=>{if(t)return t;const r=cn[e]==null?0:cn[e]+1;return cn[e]=r,e+"-"+r},[e,t])}function rl(e){return function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];return s.reduce((a,i)=>{const l=Object.entries(i);for(const[c,d]of l){const u=a[c];u!=null&&(a[c]=u+e*d)}return a},{...t})}}const ur=rl(1),Ts=rl(-1);function Tf(e){return"clientX"in e&&"clientY"in e}function na(e){if(!e)return!1;const{KeyboardEvent:t}=Ye(e.target);return t&&e instanceof t}function _f(e){if(!e)return!1;const{TouchEvent:t}=Ye(e.target);return t&&e instanceof t}function _s(e){if(_f(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Tf(e)?{x:e.clientX,y:e.clientY}:null}const Mr=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[Mr.Translate.toString(e),Mr.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:s}=e;return t+" "+r+"ms "+s}}}),co="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ff(e){return e.matches(co)?e:e.querySelector(co)}const Of={display:"none"};function Rf(e){let{id:t,value:r}=e;return b.createElement("div",{id:t,style:Of},r)}function Df(e){let{id:t,announcement:r,ariaLiveType:s="assertive"}=e;const n={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return b.createElement("div",{id:t,style:n,role:"status","aria-live":s,"aria-atomic":!0},r)}function Mf(){const[e,t]=b.useState("");return{announce:b.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const sl=b.createContext(null);function $f(e){const t=b.useContext(sl);b.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Lf(){const[e]=b.useState(()=>new Set),t=b.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[b.useCallback(s=>{let{type:n,event:a}=s;e.forEach(i=>{var l;return(l=i[n])==null?void 0:l.call(i,a)})},[e]),t]}const Pf={draggable:`
62
62
  To pick up a draggable item, press the space bar.
63
63
  While dragging, use the arrow keys to move the item.
64
64
  Press space again to drop the item in its new position, or press escape to cancel.
65
- `},Pf={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function zf(e){let{announcements:t=Pf,container:r,hiddenTextDescribedById:s,screenReaderInstructions:n=Lf}=e;const{announce:a,announcement:i}=Df(),l=Bs("DndLiveRegion"),[c,d]=b.useState(!1);if(b.useEffect(()=>{d(!0)},[]),Mf(b.useMemo(()=>({onDragStart(f){let{active:h}=f;a(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;t.onDragMove&&a(t.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;a(t.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;a(t.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;a(t.onDragCancel({active:h,over:p}))}}),[a,t])),!c)return null;const u=b.createElement(b.Fragment,null,b.createElement(Of,{id:s,value:n.draggable}),b.createElement(Rf,{id:l,announcement:i}));return r?Jt.createPortal(u,r):u}var Ve;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ve||(Ve={}));function _s(){}function co(e,t){return b.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function If(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return b.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const xt=Object.freeze({x:0,y:0});function Vf(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bf(e,t){const r=Ts(e);if(!r)return"0 0";const s={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return s.x+"% "+s.y+"%"}function Uf(e,t){let{data:{value:r}}=e,{data:{value:s}}=t;return r-s}function qf(e,t){let{data:{value:r}}=e,{data:{value:s}}=t;return s-r}function Wf(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function uo(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const Kf=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:s}=e;const n=uo(t,t.left,t.top),a=[];for(const i of s){const{id:l}=i,c=r.get(l);if(c){const d=Vf(uo(c),n);a.push({id:l,data:{droppableContainer:i,value:d}})}}return a.sort(Uf)};function Gf(e,t){const r=Math.max(t.top,e.top),s=Math.max(t.left,e.left),n=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=n-s,l=a-r;if(s<n&&r<a){const c=t.width*t.height,d=e.width*e.height,u=i*l,f=u/(c+d-u);return Number(f.toFixed(4))}return 0}const sl=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:s}=e;const n=[];for(const a of s){const{id:i}=a,l=r.get(i);if(l){const c=Gf(l,t);c>0&&n.push({id:i,data:{droppableContainer:a,value:c}})}}return n.sort(qf)};function Jf(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function nl(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:xt}function Zf(e){return function(r){for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;a<s;a++)n[a-1]=arguments[a];return n.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...r})}}const Yf=Zf(1);function al(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Hf(e,t,r){const s=al(t);if(!s)return e;const{scaleX:n,scaleY:a,x:i,y:l}=s,c=e.left-i-(1-n)*parseFloat(r),d=e.top-l-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),u=n?e.width/n:e.width,f=a?e.height/a:e.height;return{width:u,height:f,top:d,right:c+u,bottom:d+f,left:c}}const Xf={ignoreTransform:!1};function qr(e,t){t===void 0&&(t=Xf);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=Ye(e).getComputedStyle(e);d&&(r=Hf(r,d,u))}const{top:s,left:n,width:a,height:i,bottom:l,right:c}=r;return{top:s,left:n,width:a,height:i,bottom:l,right:c}}function fo(e){return qr(e,{ignoreTransform:!0})}function Qf(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function em(e,t){return t===void 0&&(t=Ye(e).getComputedStyle(e)),t.position==="fixed"}function tm(e,t){t===void 0&&(t=Ye(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(n=>{const a=t[n];return typeof a=="string"?r.test(a):!1})}function na(e,t){const r=[];function s(n){if(t!=null&&r.length>=t||!n)return r;if(ra(n)&&n.scrollingElement!=null&&!r.includes(n.scrollingElement))return r.push(n.scrollingElement),r;if(!Br(n)||el(n)||r.includes(n))return r;const a=Ye(e).getComputedStyle(n);return n!==e&&tm(n,a)&&r.push(n),em(n,a)?r:s(n.parentNode)}return e?s(e):r}function ol(e){const[t]=na(e,1);return t??null}function cn(e){return!Is||!e?null:br(e)?e:ta(e)?ra(e)||e===gr(e).scrollingElement?window:Br(e)?e:null:null}function il(e){return br(e)?e.scrollX:e.scrollLeft}function ll(e){return br(e)?e.scrollY:e.scrollTop}function $n(e){return{x:il(e),y:ll(e)}}var Be;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Be||(Be={}));function cl(e){return!Is||!e?!1:e===document.scrollingElement}function dl(e){const t={x:0,y:0},r=cl(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},n=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=s.y,l=e.scrollLeft>=s.x;return{isTop:n,isLeft:a,isBottom:i,isRight:l,maxScroll:s,minScroll:t}}const rm={x:.2,y:.2};function sm(e,t,r,s,n){let{top:a,left:i,right:l,bottom:c}=r;s===void 0&&(s=10),n===void 0&&(n=rm);const{isTop:d,isBottom:u,isLeft:f,isRight:h}=dl(e),p={x:0,y:0},v={x:0,y:0},g={height:t.height*n.y,width:t.width*n.x};return!d&&a<=t.top+g.height?(p.y=Be.Backward,v.y=s*Math.abs((t.top+g.height-a)/g.height)):!u&&c>=t.bottom-g.height&&(p.y=Be.Forward,v.y=s*Math.abs((t.bottom-g.height-c)/g.height)),!h&&l>=t.right-g.width?(p.x=Be.Forward,v.x=s*Math.abs((t.right-g.width-l)/g.width)):!f&&i<=t.left+g.width&&(p.x=Be.Backward,v.x=s*Math.abs((t.left+g.width-i)/g.width)),{direction:p,speed:v}}function nm(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}const{top:t,left:r,right:s,bottom:n}=e.getBoundingClientRect();return{top:t,left:r,right:s,bottom:n,width:e.clientWidth,height:e.clientHeight}}function ul(e){return e.reduce((t,r)=>ur(t,$n(r)),xt)}function am(e){return e.reduce((t,r)=>t+il(r),0)}function om(e){return e.reduce((t,r)=>t+ll(r),0)}function fl(e,t){if(t===void 0&&(t=qr),!e)return;const{top:r,left:s,bottom:n,right:a}=t(e);ol(e)&&(n<=0||a<=0||r>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const im=[["x",["left","right"],am],["y",["top","bottom"],om]];class aa{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=na(r),n=ul(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,l]of im)for(const c of i)Object.defineProperty(this,c,{get:()=>{const d=l(s),u=n[a]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Cr{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...r)})},this.target=t}add(t,r,s){var n;(n=this.target)==null||n.addEventListener(t,r,s),this.listeners.push([t,r,s])}}function lm(e){const{EventTarget:t}=Ye(e);return e instanceof t?e:gr(e)}function dn(e,t){const r=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+s**2)>t:"x"in t&&"y"in t?r>t.x&&s>t.y:"x"in t?r>t.x:"y"in t?s>t.y:!1}var ut;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ut||(ut={}));function mo(e){e.preventDefault()}function cm(e){e.stopPropagation()}var Ae;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ae||(Ae={}));const ml={start:[Ae.Space,Ae.Enter],cancel:[Ae.Esc],end:[Ae.Space,Ae.Enter,Ae.Tab]},dm=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Ae.Right:return{...r,x:r.x+25};case Ae.Left:return{...r,x:r.x-25};case Ae.Down:return{...r,y:r.y+25};case Ae.Up:return{...r,y:r.y-25}}};class oa{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new Cr(gr(r)),this.windowListeners=new Cr(Ye(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ut.Resize,this.handleCancel),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ut.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,s=t.node.current;s&&fl(s),r(xt)}handleKeyDown(t){if(sa(t)){const{active:r,context:s,options:n}=this.props,{keyboardCodes:a=ml,coordinateGetter:i=dm,scrollBehavior:l="smooth"}=n,{code:c}=t;if(a.end.includes(c)){this.handleEnd(t);return}if(a.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=s.current,u=d?{x:d.left,y:d.top}:xt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=i(t,{active:r,context:s.current,currentCoordinates:u});if(f){const h=As(f,u),p={x:0,y:0},{scrollableAncestors:v}=s.current;for(const g of v){const x=t.code,{isTop:m,isRight:w,isLeft:y,isBottom:T,maxScroll:N,minScroll:_}=dl(g),A=nm(g),S={x:Math.min(x===Ae.Right?A.right-A.width/2:A.right,Math.max(x===Ae.Right?A.left:A.left+A.width/2,f.x)),y:Math.min(x===Ae.Down?A.bottom-A.height/2:A.bottom,Math.max(x===Ae.Down?A.top:A.top+A.height/2,f.y))},$=x===Ae.Right&&!w||x===Ae.Left&&!y,V=x===Ae.Down&&!T||x===Ae.Up&&!m;if($&&S.x!==f.x){const z=g.scrollLeft+h.x,q=x===Ae.Right&&z<=N.x||x===Ae.Left&&z>=_.x;if(q&&!h.y){g.scrollTo({left:z,behavior:l});return}q?p.x=g.scrollLeft-z:p.x=x===Ae.Right?g.scrollLeft-N.x:g.scrollLeft-_.x,p.x&&g.scrollBy({left:-p.x,behavior:l});break}else if(V&&S.y!==f.y){const z=g.scrollTop+h.y,q=x===Ae.Down&&z<=N.y||x===Ae.Up&&z>=_.y;if(q&&!h.x){g.scrollTo({top:z,behavior:l});return}q?p.y=g.scrollTop-z:p.y=x===Ae.Down?g.scrollTop-N.y:g.scrollTop-_.y,p.y&&g.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,ur(As(f,this.referenceCoordinates),p))}}}handleMove(t,r){const{onMove:s}=this.props;t.preventDefault(),s(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}oa.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:s=ml,onActivation:n}=t,{active:a}=r;const{code:i}=e.nativeEvent;if(s.start.includes(i)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),n==null||n({event:e.nativeEvent}),!0)}return!1}}];function ho(e){return!!(e&&"distance"in e)}function po(e){return!!(e&&"delay"in e)}class ia{constructor(t,r,s){var n;s===void 0&&(s=lm(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:i}=a;this.props=t,this.events=r,this.document=gr(i),this.documentListeners=new Cr(this.document),this.listeners=new Cr(s),this.windowListeners=new Cr(Ye(i)),this.initialCoordinates=(n=Ts(a))!=null?n:xt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ut.Resize,this.handleCancel),this.windowListeners.add(ut.DragStart,mo),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),this.windowListeners.add(ut.ContextMenu,mo),this.documentListeners.add(ut.Keydown,this.handleKeydown),r){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(po(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(ho(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:s,onPending:n}=this.props;n(s,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(ut.Click,cm,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ut.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:s,initialCoordinates:n,props:a}=this,{onMove:i,options:{activationConstraint:l}}=a;if(!n)return;const c=(r=Ts(t))!=null?r:xt,d=As(n,c);if(!s&&l){if(ho(l)){if(l.tolerance!=null&&dn(d,l.tolerance))return this.handleCancel();if(dn(d,l.distance))return this.handleStart()}if(po(l)&&dn(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===Ae.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const um={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class la extends ia{constructor(t){const{event:r}=t,s=gr(r.target);super(t,um,s)}}la.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:s}=t;return!r.isPrimary||r.button!==0?!1:(s==null||s({event:r}),!0)}}];const fm={move:{name:"mousemove"},end:{name:"mouseup"}};var Ln;(function(e){e[e.RightClick=2]="RightClick"})(Ln||(Ln={}));class mm extends ia{constructor(t){super(t,fm,gr(t.event.target))}}mm.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:s}=t;return r.button===Ln.RightClick?!1:(s==null||s({event:r}),!0)}}];const un={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class hm extends ia{constructor(t){super(t,un)}static setup(){return window.addEventListener(un.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(un.move.name,t)};function t(){}}}hm.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:s}=t;const{touches:n}=r;return n.length>1?!1:(s==null||s({event:r}),!0)}}];var Ar;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ar||(Ar={}));var Fs;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Fs||(Fs={}));function pm(e){let{acceleration:t,activator:r=Ar.Pointer,canScroll:s,draggingRect:n,enabled:a,interval:i=5,order:l=Fs.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:h}=e;const p=gm({delta:f,disabled:!a}),[v,g]=Cf(),x=b.useRef({x:0,y:0}),m=b.useRef({x:0,y:0}),w=b.useMemo(()=>{switch(r){case Ar.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Ar.DraggableRect:return n}},[r,n,c]),y=b.useRef(null),T=b.useCallback(()=>{const _=y.current;if(!_)return;const A=x.current.x*m.current.x,S=x.current.y*m.current.y;_.scrollBy(A,S)},[]),N=b.useMemo(()=>l===Fs.TreeOrder?[...d].reverse():d,[l,d]);b.useEffect(()=>{if(!a||!d.length||!w){g();return}for(const _ of N){if((s==null?void 0:s(_))===!1)continue;const A=d.indexOf(_),S=u[A];if(!S)continue;const{direction:$,speed:V}=sm(_,S,w,t,h);for(const z of["x","y"])p[z][$[z]]||(V[z]=0,$[z]=0);if(V.x>0||V.y>0){g(),y.current=_,v(T,i),x.current=V,m.current=$;return}}x.current={x:0,y:0},m.current={x:0,y:0},g()},[t,T,s,g,a,i,JSON.stringify(w),JSON.stringify(p),v,d,N,u,JSON.stringify(h)])}const bm={x:{[Be.Backward]:!1,[Be.Forward]:!1},y:{[Be.Backward]:!1,[Be.Forward]:!1}};function gm(e){let{delta:t,disabled:r}=e;const s=Cs(t);return Ur(n=>{if(r||!s||!n)return bm;const a={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[Be.Backward]:n.x[Be.Backward]||a.x===-1,[Be.Forward]:n.x[Be.Forward]||a.x===1},y:{[Be.Backward]:n.y[Be.Backward]||a.y===-1,[Be.Forward]:n.y[Be.Forward]||a.y===1}}},[r,t,s])}function xm(e,t){const r=t!=null?e.get(t):void 0,s=r?r.node.current:null;return Ur(n=>{var a;return t==null?null:(a=s??n)!=null?a:null},[s,t])}function vm(e,t){return b.useMemo(()=>e.reduce((r,s)=>{const{sensor:n}=s,a=n.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,s)}));return[...r,...a]},[]),[e,t])}var Mr;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Mr||(Mr={}));var Pn;(function(e){e.Optimized="optimized"})(Pn||(Pn={}));const bo=new Map;function ym(e,t){let{dragging:r,dependencies:s,config:n}=t;const[a,i]=b.useState(null),{frequency:l,measure:c,strategy:d}=n,u=b.useRef(e),f=x(),h=Rr(f),p=b.useCallback(function(m){m===void 0&&(m=[]),!h.current&&i(w=>w===null?m:w.concat(m.filter(y=>!w.includes(y))))},[h]),v=b.useRef(null),g=Ur(m=>{if(f&&!r)return bo;if(!m||m===bo||u.current!==e||a!=null){const w=new Map;for(let y of e){if(!y)continue;if(a&&a.length>0&&!a.includes(y.id)&&y.rect.current){w.set(y.id,y.rect.current);continue}const T=y.node.current,N=T?new aa(c(T),T):null;y.rect.current=N,N&&w.set(y.id,N)}return w}return m},[e,a,r,f,c]);return b.useEffect(()=>{u.current=e},[e]),b.useEffect(()=>{f||p()},[r,f]),b.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),b.useEffect(()=>{f||typeof l!="number"||v.current!==null||(v.current=setTimeout(()=>{p(),v.current=null},l))},[l,f,p,...s]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:a!=null};function x(){switch(d){case Mr.Always:return!1;case Mr.BeforeDragging:return r;default:return!r}}}function ca(e,t){return Ur(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function wm(e,t){return ca(e,t)}function jm(e){let{callback:t,disabled:r}=e;const s=Vs(t),n=b.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(s)},[s,r]);return b.useEffect(()=>()=>n==null?void 0:n.disconnect(),[n]),n}function Us(e){let{callback:t,disabled:r}=e;const s=Vs(t),n=b.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(s)},[r]);return b.useEffect(()=>()=>n==null?void 0:n.disconnect(),[n]),n}function km(e){return new aa(qr(e),e)}function go(e,t,r){t===void 0&&(t=km);const[s,n]=b.useState(null);function a(){n(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??r)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const i=jm({callback(c){if(e)for(const d of c){const{type:u,target:f}=d;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),l=Us({callback:a});return _t(()=>{a(),e?(l==null||l.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),i==null||i.disconnect())},[e]),s}function Nm(e){const t=ca(e);return nl(e,t)}const xo=[];function Sm(e){const t=b.useRef(e),r=Ur(s=>e?s&&s!==xo&&e&&t.current&&e.parentNode===t.current.parentNode?s:na(e):xo,[e]);return b.useEffect(()=>{t.current=e},[e]),r}function Em(e){const[t,r]=b.useState(null),s=b.useRef(e),n=b.useCallback(a=>{const i=cn(a.target);i&&r(l=>l?(l.set(i,$n(i)),new Map(l)):null)},[]);return b.useEffect(()=>{const a=s.current;if(e!==a){i(a);const l=e.map(c=>{const d=cn(c);return d?(d.addEventListener("scroll",n,{passive:!0}),[d,$n(d)]):null}).filter(c=>c!=null);r(l.length?new Map(l):null),s.current=e}return()=>{i(e),i(a)};function i(l){l.forEach(c=>{const d=cn(c);d==null||d.removeEventListener("scroll",n)})}},[n,e]),b.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>ur(a,i),xt):ul(e):xt,[e,t])}function vo(e,t){t===void 0&&(t=[]);const r=b.useRef(null);return b.useEffect(()=>{r.current=null},t),b.useEffect(()=>{const s=e!==xt;s&&!r.current&&(r.current=e),!s&&r.current&&(r.current=null)},[e]),r.current?As(e,r.current):xt}function Cm(e){b.useEffect(()=>{if(!Is)return;const t=e.map(r=>{let{sensor:s}=r;return s.setup==null?void 0:s.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function Am(e,t){return b.useMemo(()=>e.reduce((r,s)=>{let{eventName:n,handler:a}=s;return r[n]=i=>{a(i,t)},r},{}),[e,t])}function hl(e){return b.useMemo(()=>e?Qf(e):null,[e])}const yo=[];function Tm(e,t){t===void 0&&(t=qr);const[r]=e,s=hl(r?Ye(r):null),[n,a]=b.useState(yo);function i(){a(()=>e.length?e.map(c=>cl(c)?s:new aa(t(c),c)):yo)}const l=Us({callback:i});return _t(()=>{l==null||l.disconnect(),i(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),n}function pl(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Br(t)?t:e}function _m(e){let{measure:t}=e;const[r,s]=b.useState(null),n=b.useCallback(d=>{for(const{target:u}of d)if(Br(u)){s(f=>{const h=t(u);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),a=Us({callback:n}),i=b.useCallback(d=>{const u=pl(d);a==null||a.disconnect(),u&&(a==null||a.observe(u)),s(u?t(u):null)},[t,a]),[l,c]=Es(i);return b.useMemo(()=>({nodeRef:l,rect:r,setRef:c}),[r,l,c])}const Fm=[{sensor:la,options:{}},{sensor:oa,options:{}}],Om={current:{}},ps={draggable:{measure:fo},droppable:{measure:fo,strategy:Mr.WhileDragging,frequency:Pn.Optimized},dragOverlay:{measure:qr}};class Tr extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,s;return(r=(s=this.get(t))==null?void 0:s.node.current)!=null?r:void 0}}const Rm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Tr,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:_s},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ps,measureDroppableContainers:_s,windowRect:null,measuringScheduled:!1},bl={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:_s,draggableNodes:new Map,over:null,measureDroppableContainers:_s},Wr=b.createContext(bl),gl=b.createContext(Rm);function Dm(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Tr}}}function Mm(e,t){switch(t.type){case Ve.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ve.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ve.DragEnd:case Ve.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ve.RegisterDroppable:{const{element:r}=t,{id:s}=r,n=new Tr(e.droppable.containers);return n.set(s,r),{...e,droppable:{...e.droppable,containers:n}}}case Ve.SetDroppableDisabled:{const{id:r,key:s,disabled:n}=t,a=e.droppable.containers.get(r);if(!a||s!==a.key)return e;const i=new Tr(e.droppable.containers);return i.set(r,{...a,disabled:n}),{...e,droppable:{...e.droppable,containers:i}}}case Ve.UnregisterDroppable:{const{id:r,key:s}=t,n=e.droppable.containers.get(r);if(!n||s!==n.key)return e;const a=new Tr(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function $m(e){let{disabled:t}=e;const{active:r,activatorEvent:s,draggableNodes:n}=b.useContext(Wr),a=Cs(s),i=Cs(r==null?void 0:r.id);return b.useEffect(()=>{if(!t&&!s&&a&&i!=null){if(!sa(a)||document.activeElement===a.target)return;const l=n.get(i);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const f=_f(u);if(f){f.focus();break}}})}},[s,t,n,i,a]),null}function xl(e,t){let{transform:r,...s}=t;return e!=null&&e.length?e.reduce((n,a)=>a({transform:n,...s}),r):r}function Lm(e){return b.useMemo(()=>({draggable:{...ps.draggable,...e==null?void 0:e.draggable},droppable:{...ps.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ps.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Pm(e){let{activeNode:t,measure:r,initialRect:s,config:n=!0}=e;const a=b.useRef(!1),{x:i,y:l}=typeof n=="boolean"?{x:n,y:n}:n;_t(()=>{if(!i&&!l||!t){a.current=!1;return}if(a.current||!s)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const u=r(d),f=nl(u,s);if(i||(f.x=0),l||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=ol(d);h&&h.scrollBy({top:f.y,left:f.x})}},[t,i,l,s,r])}const qs=b.createContext({...xt,scaleX:1,scaleY:1});var zt;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(zt||(zt={}));const zm=b.memo(function(t){var r,s,n,a;let{id:i,accessibility:l,autoScroll:c=!0,children:d,sensors:u=Fm,collisionDetection:f=sl,measuring:h,modifiers:p,...v}=t;const g=b.useReducer(Mm,void 0,Dm),[x,m]=g,[w,y]=$f(),[T,N]=b.useState(zt.Uninitialized),_=T===zt.Initialized,{draggable:{active:A,nodes:S,translate:$},droppable:{containers:V}}=x,z=A!=null?S.get(A):null,q=b.useRef({initial:null,translated:null}),D=b.useMemo(()=>{var B;return A!=null?{id:A,data:(B=z==null?void 0:z.data)!=null?B:Om,rect:q}:null},[A,z]),P=b.useRef(null),[E,te]=b.useState(null),[ne,K]=b.useState(null),le=Rr(v,Object.values(v)),C=Bs("DndDescribedBy",i),k=b.useMemo(()=>V.getEnabled(),[V]),I=Lm(h),{droppableRects:U,measureDroppableContainers:G,measuringScheduled:ee}=ym(k,{dragging:_,dependencies:[$.x,$.y],config:I.droppable}),M=xm(S,A),W=b.useMemo(()=>ne?Ts(ne):null,[ne]),me=Q(),be=wm(M,I.draggable.measure);Pm({activeNode:A!=null?S.get(A):null,config:me.layoutShiftCompensation,initialRect:be,measure:I.draggable.measure});const de=go(M,I.draggable.measure,be),ke=go(M?M.parentElement:null),ge=b.useRef({activatorEvent:null,active:null,activeNode:M,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:V,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=V.getNodeFor((r=ge.current.over)==null?void 0:r.id),fe=_m({measure:I.dragOverlay.measure}),pe=(s=fe.nodeRef.current)!=null?s:M,ye=_?(n=fe.rect)!=null?n:de:null,ce=!!(fe.nodeRef.current&&fe.rect),Se=Nm(ce?null:de),Te=hl(pe?Ye(pe):null),j=Sm(_?he??M:null),F=Tm(j),R=xl(p,{transform:{x:$.x-Se.x,y:$.y-Se.y,scaleX:1,scaleY:1},activatorEvent:ne,active:D,activeNodeRect:de,containerNodeRect:ke,draggingNodeRect:ye,over:ge.current.over,overlayNodeRect:fe.rect,scrollableAncestors:j,scrollableAncestorRects:F,windowRect:Te}),X=W?ur(W,$):null,Y=Em(j),Z=vo(Y),ue=vo(Y,[de]),xe=ur(R,Z),je=ye?Yf(ye,R):null,Fe=D&&je?f({active:D,collisionRect:je,droppableRects:U,droppableContainers:k,pointerCoordinates:X}):null,vt=Wf(Fe,"id"),[Me,Vt]=b.useState(null),Ft=ce?R:ur(R,ue),Ot=Jf(Ft,(a=Me==null?void 0:Me.rect)!=null?a:null,de),Rt=b.useRef(null),Dt=b.useCallback((B,Ne)=>{let{sensor:Le,options:Oe}=Ne;if(P.current==null)return;const He=S.get(P.current);if(!He)return;const We=B.nativeEvent,Ke=new Le({active:P.current,activeNode:He,event:We,options:Oe,context:ge,onAbort(Pe){if(!S.get(Pe))return;const{onDragAbort:at}=le.current,ft={id:Pe};at==null||at(ft),w({type:"onDragAbort",event:ft})},onPending(Pe,yt,at,ft){if(!S.get(Pe))return;const{onDragPending:Ut}=le.current,wt={id:Pe,constraint:yt,initialCoordinates:at,offset:ft};Ut==null||Ut(wt),w({type:"onDragPending",event:wt})},onStart(Pe){const yt=P.current;if(yt==null)return;const at=S.get(yt);if(!at)return;const{onDragStart:ft}=le.current,Bt={activatorEvent:We,active:{id:yt,data:at.data,rect:q}};Jt.unstable_batchedUpdates(()=>{ft==null||ft(Bt),N(zt.Initializing),m({type:Ve.DragStart,initialCoordinates:Pe,active:yt}),w({type:"onDragStart",event:Bt}),te(Rt.current),K(We)})},onMove(Pe){m({type:Ve.DragMove,coordinates:Pe})},onEnd:Ge(Ve.DragEnd),onCancel:Ge(Ve.DragCancel)});Rt.current=Ke;function Ge(Pe){return async function(){const{active:at,collisions:ft,over:Bt,scrollAdjustedTranslate:Ut}=ge.current;let wt=null;if(at&&Ut){const{cancelDrop:qt}=le.current;wt={activatorEvent:We,active:at,collisions:ft,delta:Ut,over:Bt},Pe===Ve.DragEnd&&typeof qt=="function"&&await Promise.resolve(qt(wt))&&(Pe=Ve.DragCancel)}P.current=null,Jt.unstable_batchedUpdates(()=>{m({type:Pe}),N(zt.Uninitialized),Vt(null),te(null),K(null),Rt.current=null;const qt=Pe===Ve.DragEnd?"onDragEnd":"onDragCancel";if(wt){const xr=le.current[qt];xr==null||xr(wt),w({type:qt,event:wt})}})}}},[S]),rr=b.useCallback((B,Ne)=>(Le,Oe)=>{const He=Le.nativeEvent,We=S.get(Oe);if(P.current!==null||!We||He.dndKit||He.defaultPrevented)return;const Ke={active:We};B(Le,Ne.options,Ke)===!0&&(He.dndKit={capturedBy:Ne.sensor},P.current=Oe,Dt(Le,Ne))},[S,Dt]),Mt=vm(u,rr);Cm(u),_t(()=>{de&&T===zt.Initializing&&N(zt.Initialized)},[de,T]),b.useEffect(()=>{const{onDragMove:B}=le.current,{active:Ne,activatorEvent:Le,collisions:Oe,over:He}=ge.current;if(!Ne||!Le)return;const We={active:Ne,activatorEvent:Le,collisions:Oe,delta:{x:xe.x,y:xe.y},over:He};Jt.unstable_batchedUpdates(()=>{B==null||B(We),w({type:"onDragMove",event:We})})},[xe.x,xe.y]),b.useEffect(()=>{const{active:B,activatorEvent:Ne,collisions:Le,droppableContainers:Oe,scrollAdjustedTranslate:He}=ge.current;if(!B||P.current==null||!Ne||!He)return;const{onDragOver:We}=le.current,Ke=Oe.get(vt),Ge=Ke&&Ke.rect.current?{id:Ke.id,rect:Ke.rect.current,data:Ke.data,disabled:Ke.disabled}:null,Pe={active:B,activatorEvent:Ne,collisions:Le,delta:{x:He.x,y:He.y},over:Ge};Jt.unstable_batchedUpdates(()=>{Vt(Ge),We==null||We(Pe),w({type:"onDragOver",event:Pe})})},[vt]),_t(()=>{ge.current={activatorEvent:ne,active:D,activeNode:M,collisionRect:je,collisions:Fe,droppableRects:U,draggableNodes:S,draggingNode:pe,draggingNodeRect:ye,droppableContainers:V,over:Me,scrollableAncestors:j,scrollAdjustedTranslate:xe},q.current={initial:ye,translated:je}},[D,M,Fe,je,S,pe,ye,U,V,Me,j,xe]),pm({...me,delta:$,draggingRect:je,pointerCoordinates:X,scrollableAncestors:j,scrollableAncestorRects:F});const O=b.useMemo(()=>({active:D,activeNode:M,activeNodeRect:de,activatorEvent:ne,collisions:Fe,containerNodeRect:ke,dragOverlay:fe,draggableNodes:S,droppableContainers:V,droppableRects:U,over:Me,measureDroppableContainers:G,scrollableAncestors:j,scrollableAncestorRects:F,measuringConfiguration:I,measuringScheduled:ee,windowRect:Te}),[D,M,de,ne,Fe,ke,fe,S,V,U,Me,G,j,F,I,ee,Te]),L=b.useMemo(()=>({activatorEvent:ne,activators:Mt,active:D,activeNodeRect:de,ariaDescribedById:{draggable:C},dispatch:m,draggableNodes:S,over:Me,measureDroppableContainers:G}),[ne,Mt,D,de,m,C,S,Me,G]);return b.createElement(rl.Provider,{value:y},b.createElement(Wr.Provider,{value:L},b.createElement(gl.Provider,{value:O},b.createElement(qs.Provider,{value:Ot},d)),b.createElement($m,{disabled:(l==null?void 0:l.restoreFocus)===!1})),b.createElement(zf,{...l,hiddenTextDescribedById:C}));function Q(){const B=(E==null?void 0:E.autoScrollEnabled)===!1,Ne=typeof c=="object"?c.enabled===!1:c===!1,Le=_&&!B&&!Ne;return typeof c=="object"?{...c,enabled:Le}:{enabled:Le}}}),Im=b.createContext(null),wo="button",Vm="Draggable";function Kr(e){let{id:t,data:r,disabled:s=!1,attributes:n}=e;const a=Bs(Vm),{activators:i,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:h}=b.useContext(Wr),{role:p=wo,roleDescription:v="draggable",tabIndex:g=0}=n??{},x=(c==null?void 0:c.id)===t,m=b.useContext(x?qs:Im),[w,y]=Es(),[T,N]=Es(),_=Am(i,t),A=Rr(r);_t(()=>(f.set(t,{id:t,key:a,node:w,activatorNode:T,data:A}),()=>{const $=f.get(t);$&&$.key===a&&f.delete(t)}),[f,t]);const S=b.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":s,"aria-pressed":x&&p===wo?!0:void 0,"aria-roledescription":v,"aria-describedby":u.draggable}),[s,p,g,x,v,u.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:S,isDragging:x,listeners:s?void 0:_,node:w,over:h,setNodeRef:y,setActivatorNodeRef:N,transform:m}}function Bm(){return b.useContext(gl)}const Um="Droppable",qm={timeout:25};function Gr(e){let{data:t,disabled:r=!1,id:s,resizeObserverConfig:n}=e;const a=Bs(Um),{active:i,dispatch:l,over:c,measureDroppableContainers:d}=b.useContext(Wr),u=b.useRef({disabled:r}),f=b.useRef(!1),h=b.useRef(null),p=b.useRef(null),{disabled:v,updateMeasurementsFor:g,timeout:x}={...qm,...n},m=Rr(g??s),w=b.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{d(Array.isArray(m.current)?m.current:[m.current]),p.current=null},x)},[x]),y=Us({callback:w,disabled:v||!i}),T=b.useCallback((S,$)=>{y&&($&&(y.unobserve($),f.current=!1),S&&y.observe(S))},[y]),[N,_]=Es(T),A=Rr(t);return b.useEffect(()=>{!y||!N.current||(y.disconnect(),f.current=!1,y.observe(N.current))},[N,y]),b.useEffect(()=>(l({type:Ve.RegisterDroppable,element:{id:s,key:a,disabled:r,node:N,rect:h,data:A}}),()=>l({type:Ve.UnregisterDroppable,key:a,id:s})),[s]),b.useEffect(()=>{r!==u.current.disabled&&(l({type:Ve.SetDroppableDisabled,id:s,key:a,disabled:r}),u.current.disabled=r)},[s,a,r,l]),{active:i,rect:h,isOver:(c==null?void 0:c.id)===s,node:N,over:c,setNodeRef:_}}function Wm(e){let{animation:t,children:r}=e;const[s,n]=b.useState(null),[a,i]=b.useState(null),l=Cs(r);return!r&&!s&&l&&n(l),_t(()=>{if(!a)return;const c=s==null?void 0:s.key,d=s==null?void 0:s.props.id;if(c==null||d==null){n(null);return}Promise.resolve(t(d,a)).then(()=>{n(null)})},[t,s,a]),b.createElement(b.Fragment,null,r,s?b.cloneElement(s,{ref:i}):null)}const Km={x:0,y:0,scaleX:1,scaleY:1};function Gm(e){let{children:t}=e;return b.createElement(Wr.Provider,{value:bl},b.createElement(qs.Provider,{value:Km},t))}const Jm={position:"fixed",touchAction:"none"},Zm=e=>sa(e)?"transform 250ms ease":void 0,Ym=b.forwardRef((e,t)=>{let{as:r,activatorEvent:s,adjustScale:n,children:a,className:i,rect:l,style:c,transform:d,transition:u=Zm}=e;if(!l)return null;const f=n?d:{...d,scaleX:1,scaleY:1},h={...Jm,width:l.width,height:l.height,top:l.top,left:l.left,transform:Dr.Transform.toString(f),transformOrigin:n&&s?Bf(s,l):void 0,transition:typeof u=="function"?u(s):u,...c};return b.createElement(r,{className:i,style:h,ref:t},a)}),Hm=e=>t=>{let{active:r,dragOverlay:s}=t;const n={},{styles:a,className:i}=e;if(a!=null&&a.active)for(const[l,c]of Object.entries(a.active))c!==void 0&&(n[l]=r.node.style.getPropertyValue(l),r.node.style.setProperty(l,c));if(a!=null&&a.dragOverlay)for(const[l,c]of Object.entries(a.dragOverlay))c!==void 0&&s.node.style.setProperty(l,c);return i!=null&&i.active&&r.node.classList.add(i.active),i!=null&&i.dragOverlay&&s.node.classList.add(i.dragOverlay),function(){for(const[c,d]of Object.entries(n))r.node.style.setProperty(c,d);i!=null&&i.active&&r.node.classList.remove(i.active)}},Xm=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Dr.Transform.toString(t)},{transform:Dr.Transform.toString(r)}]},Qm={duration:250,easing:"ease",keyframes:Xm,sideEffects:Hm({styles:{active:{opacity:"0"}}})};function eh(e){let{config:t,draggableNodes:r,droppableContainers:s,measuringConfiguration:n}=e;return Vs((a,i)=>{if(t===null)return;const l=r.get(a);if(!l)return;const c=l.node.current;if(!c)return;const d=pl(i);if(!d)return;const{transform:u}=Ye(i).getComputedStyle(i),f=al(u);if(!f)return;const h=typeof t=="function"?t:th(t);return fl(c,n.draggable.measure),h({active:{id:a,data:l.data,node:c,rect:n.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:i,rect:n.dragOverlay.measure(d)},droppableContainers:s,measuringConfiguration:n,transform:f})})}function th(e){const{duration:t,easing:r,sideEffects:s,keyframes:n}={...Qm,...e};return a=>{let{active:i,dragOverlay:l,transform:c,...d}=a;if(!t)return;const u={x:l.rect.left-i.rect.left,y:l.rect.top-i.rect.top},f={scaleX:c.scaleX!==1?i.rect.width*c.scaleX/l.rect.width:1,scaleY:c.scaleY!==1?i.rect.height*c.scaleY/l.rect.height:1},h={x:c.x-u.x,y:c.y-u.y,...f},p=n({...d,active:i,dragOverlay:l,transform:{initial:c,final:h}}),[v]=p,g=p[p.length-1];if(JSON.stringify(v)===JSON.stringify(g))return;const x=s==null?void 0:s({active:i,dragOverlay:l,...d}),m=l.node.animate(p,{duration:t,easing:r,fill:"forwards"});return new Promise(w=>{m.onfinish=()=>{x==null||x(),w()}})}}let jo=0;function rh(e){return b.useMemo(()=>{if(e!=null)return jo++,jo},[e])}const sh=b.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:s,style:n,transition:a,modifiers:i,wrapperElement:l="div",className:c,zIndex:d=999}=e;const{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:v,droppableContainers:g,dragOverlay:x,over:m,measuringConfiguration:w,scrollableAncestors:y,scrollableAncestorRects:T,windowRect:N}=Bm(),_=b.useContext(qs),A=rh(f==null?void 0:f.id),S=xl(i,{activatorEvent:u,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:x.rect,over:m,overlayNodeRect:x.rect,scrollableAncestors:y,scrollableAncestorRects:T,transform:_,windowRect:N}),$=ca(h),V=eh({config:s,draggableNodes:v,droppableContainers:g,measuringConfiguration:w}),z=$?x.setRef:void 0;return b.createElement(Gm,null,b.createElement(Wm,{animation:V},f&&A?b.createElement(Ym,{key:A,id:f.id,ref:z,as:l,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:$,style:{zIndex:d,...n},transform:S},r):null))});function nh(){return{label:"Texto",type:"text",width:"w-full md:w-1/2",placeholder:"Escribe…",size:"sm"}}function ah(){return{label:"Número",type:"number",width:"w-full md:w-1/3",placeholder:"0",size:"sm",validation:{required:!1}}}function oh(){return{label:"Email",type:"email",width:"w-full md:w-1/2",placeholder:"usuario@dominio.com",size:"sm"}}function ih(){return{label:"Selecciona una opción",type:"select",width:"w-full md:w-1/3",size:"sm",options:[{label:"Opción A",value:"A"},{label:"Opción B",value:"B"}]}}function lh(){return{label:"Aceptar condiciones",type:"checkbox",width:"w-full md:w-1/3",size:"sm",defaultValue:!1}}function ch(){return{label:"Comentario",type:"textarea",width:"w-full",size:"sm",maxLength:300,showCounter:!0,placeholder:"Escribe tu comentario…"}}function dh(){return{label:"Fecha",type:"date",width:"w-full md:w-1/3",size:"sm",showTime:!1}}function uh(){return{label:"Documento",type:"file",width:"w-full md:w-1/2",maxFiles:1,accept:".pdf,.doc,.docx"}}const fh={text:nh,number:ah,email:oh,select:ih,checkbox:lh,textarea:ch,date:dh,file:uh},mh=()=>o.jsx(we,{label:"Texto",placeholder:"Escribe…",size:"sm",reserveErrorSpace:!1}),hh=()=>o.jsx(we,{type:"number",label:"Número",placeholder:"0",size:"sm",reserveErrorSpace:!1}),ph=()=>o.jsx(we,{type:"email",label:"Email",placeholder:"usuario@dominio.com",size:"sm",reserveErrorSpace:!1}),bh=()=>o.jsx(rt,{label:"Select",options:[{label:"Opción A",value:"A"},{label:"Opción B",value:"B"}],size:"sm"}),gh=()=>o.jsx(dt,{label:"Aceptar condiciones",defaultValue:!1,name:"__prev_checkbox__"}),xh=()=>o.jsx($s,{label:"Comentario",placeholder:"Escribe tu comentario…",size:"sm",maxLength:120,showCounter:!0}),vh=()=>o.jsx(_r,{label:"Fecha",defaultValue:"",showTime:!1,name:"__prev_date__"}),yh=()=>o.jsxs("div",{children:[o.jsx("label",{className:"text-ds-xs block mb-1 opacity-80",children:"Documento"}),o.jsx("div",{className:"w-full rounded-xl border border-dashed p-4 text-ds-xs opacity-70",children:"Arrastra o selecciona archivo…"})]}),wh=()=>o.jsx("div",{className:"p-2 rounded-md bg-[var(--color-ds-background-page)]",children:o.jsx(zr,{options:[{label:"Tab 1",value:"t1"},{label:"Tab 2",value:"t2"}],value:"t1",onChange:()=>{},children:{t1:o.jsx("div",{className:"text-ds-sm opacity-80",children:"Contenido ejemplo 1"}),t2:o.jsx("div",{className:"text-ds-sm opacity-80",children:"Contenido ejemplo 2"})}})}),jh=()=>o.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",children:[o.jsx("div",{className:"px-3 py-2 border-b border-[var(--color-ds-border-default-50)] text-ds-sm",children:"Sección"}),o.jsx("div",{className:"p-3 text-ds-xs opacity-70",children:"Fila con 1 columna (w-full). Modifícala desde el lienzo."})]}),os=[{kind:"text",title:"Texto",category:"basics",renderPreview:o.jsx(mh,{}),detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Props: ",o.jsx("code",{children:"placeholder"}),", ",o.jsx("code",{children:"size"}),", ",o.jsx("code",{children:"width"}),", ",o.jsx("code",{children:"info"})]}),o.jsxs("li",{children:["Validación: ",o.jsx("code",{children:"required"}),", ",o.jsx("code",{children:"minLength"}),", ",o.jsx("code",{children:"maxLength"}),", ",o.jsx("code",{children:"pattern"})]})]})},{kind:"number",title:"Número",category:"basics",renderPreview:o.jsx(hh,{}),detail:o.jsx("ul",{className:"list-disc pl-4 space-y-1",children:o.jsxs("li",{children:["Validación: ",o.jsx("code",{children:"numberMin"}),", ",o.jsx("code",{children:"numberMax"}),", ",o.jsx("code",{children:"step"}),", ",o.jsx("code",{children:"integerOnly"}),", ",o.jsx("code",{children:"positiveOnly"})]})})},{kind:"email",title:"Email",category:"basics",renderPreview:o.jsx(ph,{}),detail:o.jsx("ul",{className:"list-disc pl-4 space-y-1",children:o.jsx("li",{children:"Preset de patrón disponible"})})},{kind:"select",title:"Select",category:"basics",renderPreview:o.jsx(bh,{}),hint:"Admite optionSource",detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Opciones: ",o.jsx("code",{children:"options"})," o ",o.jsx("code",{children:"optionSource"})]}),o.jsxs("li",{children:["Default: ",o.jsx("code",{children:"defaultSource"})]}),o.jsxs("li",{children:["Soporta ",o.jsx("code",{children:"multiple"})," y ",o.jsx("code",{children:"adapterCtx"})]})]})},{kind:"checkbox",title:"Checkbox",category:"basics",renderPreview:o.jsx(gh,{}),detail:o.jsx("ul",{className:"list-disc pl-4 space-y-1",children:o.jsxs("li",{children:["Devuelve ",o.jsx("code",{children:"boolean"})]})})},{kind:"date",title:"Fecha",category:"basics",renderPreview:o.jsx(vh,{}),detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Prop: ",o.jsx("code",{children:"showTime"})]}),o.jsxs("li",{children:["Validación: ",o.jsx("code",{children:"dateMin"}),", ",o.jsx("code",{children:"dateMax"}),", ",o.jsx("code",{children:"disallowPast"}),", ",o.jsx("code",{children:"disallowFuture"})]})]})},{kind:"textarea",title:"Textarea",category:"content",renderPreview:o.jsx(xh,{}),detail:o.jsx("ul",{className:"list-disc pl-4 space-y-1",children:o.jsxs("li",{children:["Props: ",o.jsx("code",{children:"maxLength"}),", ",o.jsx("code",{children:"showCounter"})]})})},{kind:"file",title:"Archivo",category:"content",renderPreview:o.jsx(yh,{}),detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Props: ",o.jsx("code",{children:"accept"}),", ",o.jsx("code",{children:"maxFiles"})]}),o.jsxs("li",{children:["Validación: ",o.jsx("code",{children:"fileMaxSizeMB"})]})]})},{kind:"section-layout",title:"Sección",category:"layout",renderPreview:o.jsx(jh,{}),isLayout:!0,hint:"Contenedor de layout",detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsx("li",{children:"Inserta un bloque de filas/columnas (rows) con una fila vacía."}),o.jsx("li",{children:"Después puedes añadir columnas y colocar campos."})]})},{kind:"tabs-layout",title:"Pestañas",category:"layout",renderPreview:o.jsx(wh,{}),isLayout:!0,hint:"Contenedor de layout (no es un campo)",detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Inserta un contenedor de ",o.jsx("code",{children:"tabs"})," en el layout."]}),o.jsx("li",{children:"Cada pestaña contiene sus propias secciones y filas."}),o.jsx("li",{children:"Útil para agrupar campos por temática."})]})}];function vl({title:e,onAdd:t,onInfo:r,dragging:s=!1}){return o.jsxs("div",{className:["hover:text-[var(--color-ds-text-on-accent)] relative",s?"opacity-70":""].join(" "),children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:t,className:["w-full rounded-xl p-2 text-left justify-start","border-dashed ring-1 ring-inset ring-[var(--color-ds-border-default-50)] hover:ring-[var(--color-ds-border-default)] hover:shadow-sm","cursor-grab active:cursor-grabbing"].join(" "),title:`Añadir ${e}`,"aria-label":`Añadir ${e}`,children:o.jsx("div",{className:"text-ds-sm",children:e})}),o.jsx("div",{className:"absolute top-1 right-1",children:o.jsx(Zn,{size:"sm",position:"right",ariaLabel:`Más info de ${e}`,onClick:r,children:o.jsxs("div",{className:"max-w-[240px]",children:["Pulsa para ver un ejemplo y detalles de ",o.jsx("strong",{children:e}),"."]})})})]})}function ko({kind:e,title:t,onAdd:r,onInfo:s}){const{attributes:n,listeners:a,setNodeRef:i,isDragging:l}=Kr({id:`palette:${e}:${t}`,data:{kind:"palette-field",factoryKind:e}});return o.jsx("div",{ref:i,...n,...a,role:"button","aria-label":`Arrastrar ${t}`,className:"touch-none select-none",children:o.jsx(vl,{title:t,onAdd:r,onInfo:s,dragging:l})})}function kh(){var g;const e=J(x=>x.addField),t=J(x=>x.addTabsContainerAt),r=J(x=>x.addRowsBlockAt),s=J(x=>x.schema),{show:n}=Ir(),[a,i]=b.useState(""),[l,c]=b.useState(null),d=b.useMemo(()=>os.filter(x=>x.category==="basics"&&x.title.toLowerCase().includes(a.toLowerCase())),[a]),u=b.useMemo(()=>os.filter(x=>x.category==="content"&&x.title.toLowerCase().includes(a.toLowerCase())),[a]),f=b.useMemo(()=>os.filter(x=>x.category==="layout"&&x.title.toLowerCase().includes(a.toLowerCase())),[a]),h=b.useMemo(()=>os.find(x=>x.kind===l)??null,[l]),p=b.useCallback(x=>{const m=fh[x];if(!m){n("Tipo de campo no soportado.","warning");return}const w=m();e(w),n(`Añadido “${w.label}”. Ahora arrástralo al formulario o usa “Colocar último campo”.`,"success")},[e,n]),v=b.useCallback(x=>{var w;const m=((w=s==null?void 0:s.layout)==null?void 0:w.length)??0;if(x==="section-layout"){typeof r=="function"?(r(m,"Nueva sección"),n("Sección añadida al layout.","success")):n("Acción addRowsBlockAt no disponible en el store.","warning");return}if(x==="tabs-layout"){typeof t=="function"?(t(m),n("Contenedor de pestañas añadido al layout.","success")):n("Acción addTabsContainerAt no disponible en el store.","warning");return}n("Tipo de layout no soportado.","warning")},[(g=s==null?void 0:s.layout)==null?void 0:g.length,r,t,n]);if(h){const x=!!h.isLayout;return o.jsxs("aside",{className:"border-r bg-[var(--color-ds-background-page)] custom-scroll min-h-0 text-[var(--color-ds-text-primary)]",children:[o.jsxs("div",{className:"px-4 py-3 border-b border-[var(--color-ds-border-default-50)] flex items-center",children:[o.jsx("h3",{className:"font-semibold text-[1rem] flex-1 truncate",children:h.title}),o.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>c(null),className:"ml-auto",children:"← Volver"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"border border-[var(--color-ds-border-default-50)] p-4 bg-[var(--color-ds-background-surface)]",children:h.renderPreview}),o.jsxs("div",{className:"p-2",children:[o.jsxs("div",{className:"flex items-center gap-2 justify-center mb-4",children:[o.jsx(ie,{size:"sm",variant:"primary",onClick:()=>x?v(h.kind):p(h.kind),title:"Añadir rápidamente",children:"Añadir al lienzo"}),o.jsx("span",{className:"text-ds-xs opacity-70",children:"o arrástrame al formulario"})]}),o.jsxs("div",{className:"rounded-xl border border-[var(--color-ds-border-default-50)] p-3",children:[o.jsxs("div",{className:"text-ds-sm text-[var(--color-ds-text-secondary)] mb-2",children:["Acerca de ",o.jsx("strong",{children:h.title})]}),o.jsxs("div",{className:"text-ds-sm space-y-2",children:[h.hint?o.jsx("div",{className:"opacity-80",children:h.hint}):null,h.detail]})]})]})]})]})}return o.jsxs("aside",{className:"bg-[var(--color-ds-background-page)] custom-scroll min-h-0 text-[var(--color-ds-text-primary)]",children:[o.jsxs("div",{className:"px-4 py-3 border-b border-[var(--color-ds-border-default-50)]",children:[o.jsx("h3",{className:"font-semibold text-[1rem]",children:"Paleta"}),o.jsxs("p",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm mt-1",children:["Clic en una tarjeta para ",o.jsx("strong",{children:"añadir"})," al catálogo, o ",o.jsx("strong",{children:"arrastra"})," al formulario para colocar. Usa el icono"," ",o.jsx(Lo,{className:"inline w-4 h-4 align-[-2px]"})," para ver detalles."]}),o.jsx("div",{className:"mt-3",children:o.jsx(we,{size:"sm",placeholder:"Buscar componente…",value:a,onChange:x=>i(x.target.value),reserveErrorSpace:!1})})]}),o.jsxs("div",{className:"p-4 space-y-6",children:[o.jsxs("section",{className:"space-y-3",children:[o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm font-medium",children:"Inputs básicos"}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.map(x=>o.jsx(ko,{kind:x.kind,title:x.title,onAdd:()=>p(x.kind),onInfo:()=>c(x.kind)},x.kind)),d.length===0&&o.jsx("div",{className:"col-span-2 text-ds-xs opacity-60",children:"No hay resultados."})]})]}),o.jsxs("section",{className:"space-y-3",children:[o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm font-medium",children:"Contenido"}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.map(x=>o.jsx(ko,{kind:x.kind,title:x.title,onAdd:()=>p(x.kind),onInfo:()=>c(x.kind)},x.kind)),u.length===0&&o.jsx("div",{className:"col-span-2 text-ds-xs opacity-60",children:"No hay resultados."})]})]}),o.jsxs("section",{className:"space-y-3",children:[o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm font-medium",children:"Estructura"}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[f.map(x=>o.jsx(vl,{title:x.title,onAdd:()=>x.isLayout?v(x.kind):p(x.kind),onInfo:()=>c(x.kind)},x.kind)),f.length===0&&o.jsx("div",{className:"col-span-2 text-ds-xs opacity-60",children:"No hay resultados."})]})]})]})]})}function yl(e){const t=e.trim();if(/^(true|false)$/i.test(t))return t.toLowerCase()==="true";const r=Number(t);return!Number.isNaN(r)&&t!==""?r:t}function Nh(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0).map(yl)}function is(e){return typeof e=="boolean"?e?"true":"false":typeof e=="number"?String(e):typeof e=="string"?e:""}const fn=(e,t)=>JSON.stringify(e??null)===JSON.stringify(t??null);function Sh({value:e,onChange:t,fieldOptions:r}){const s=b.useRef(t);b.useEffect(()=>{s.current=t},[t]);const[n,a]=b.useState((e==null?void 0:e.op)??"eq"),[i,l]=b.useState(e&&"field"in e&&typeof e.field=="string"?e.field:""),[c,d]=b.useState(e&&"value"in e?is(e.value):""),[u,f]=b.useState(e&&"values"in e&&Array.isArray(e.values)?e.values.map(is).join(","):""),h=(N={})=>{const _=N.op??n,A=N.field??i,S=N.val??c,$=N.vals??u;if(!A)return;if(_==="in"||_==="notIn"){const z=Nh($);return _==="in"?{op:"in",field:A,values:z}:{op:"notIn",field:A,values:z}}const V=S.trim()===""?"":yl(S);return{op:_,field:A,value:V}},p=()=>h({}),v=b.useRef(!1);b.useEffect(()=>{const N=p();if(fn(e,N))return;if(v.current=!0,!e){a("eq"),l(""),d(""),f(""),v.current=!1;return}const _=e.op??"eq";a(_),l("field"in e&&typeof e.field=="string"?e.field:""),_==="in"||_==="notIn"?(f("values"in e&&Array.isArray(e.values)?e.values.map(is).join(","):""),d("")):(f(""),d("value"in e?is(e.value):"")),v.current=!1},[e]);const g=b.useRef(void 0),x=b.useRef(null),m=N=>{v.current||N&&(fn(g.current,N)||(g.current=N,s.current(N)))},w=()=>{if(v.current)return;const N=p();N&&(fn(g.current,N)||(x.current&&window.clearTimeout(x.current),x.current=window.setTimeout(()=>{g.current=N,s.current(N)},200)))};b.useEffect(()=>()=>{x.current&&window.clearTimeout(x.current)},[]);const y=b.useMemo(()=>[{value:"eq",label:"igual a"},{value:"neq",label:"distinto de"},{value:"in",label:"en lista"},{value:"notIn",label:"no en lista"},{value:"gt",label:"mayor que"},{value:"gte",label:"mayor o igual"},{value:"lt",label:"menor que"},{value:"lte",label:"menor o igual"}],[]),T=b.useMemo(()=>[{label:"— campo —",value:""},...r],[r]);return o.jsxs("div",{className:"space-y-2",children:[o.jsx(rt,{label:"Operador",value:n,onChange:N=>{const _=N;a(_),_==="in"||_==="notIn"?d(""):f(""),m(h({op:_,val:_==="in"||_==="notIn"?"":c,vals:_==="in"||_==="notIn"?u:""}))},options:y,size:"sm",coerceFirstValid:!1,reserveErrorSpace:!1}),o.jsx(rt,{label:"Campo",value:i,onChange:N=>{const _=N;l(_),m(h({field:_}))},options:T,size:"sm",coerceFirstValid:!1,reserveErrorSpace:!1}),n==="in"||n==="notIn"?o.jsx(we,{size:"sm",label:"Valores (coma)",placeholder:"valor1, valor2, ...",value:u,onChange:N=>{f(N.target.value),w()},reserveErrorSpace:!1}):o.jsx(we,{size:"sm",label:"Valor",placeholder:"true/false, 123, texto",value:c,onChange:N=>{d(N.target.value),w()},reserveErrorSpace:!1})]})}const Eh=["w-full","w-1/2","w-1/3","w-2/3","w-1/4","w-3/4","w-full md:w-1/2","w-full md:w-1/3","w-full md:w-1/4"],Ch=["sm","md","lg"],Ah=[{value:"text",label:"Texto"},{value:"number",label:"Número"},{value:"email",label:"Email"},{value:"password",label:"Password"},{value:"textarea",label:"Textarea"},{value:"select",label:"Select"},{value:"checkbox",label:"Checkbox"},{value:"date",label:"Fecha"},{value:"file",label:"Archivo"}],Th=e=>(e==null?void 0:e.enabled)??!!(e!=null&&e.rule),No=(e,t)=>({...e??{},enabled:t}),_h=(e,t)=>({...e??{},rule:t}),Fh=(e,t)=>({...e??{},clearTo:t}),Oh=e=>{try{return JSON.stringify(e,null,2)}catch{return""}};async function Rh(){try{const e=await navigator.clipboard.readText(),t=JSON.parse(e);if(t&&typeof t=="object"&&"op"in t)return t}catch{}}function Dh(e){return typeof e=="number"||typeof e=="string"||e instanceof Date}function wl(e,t){if(!e)return{ok:!1,reason:"Sin regla"};if(!("op"in e))return{ok:!1,reason:"Operador inválido"};if(e.op==="and"||e.op==="or"){if(!Array.isArray(e.rules)||e.rules.length===0)return{ok:!1,reason:`Lista de reglas vacía en "${e.op}"`};for(const r of e.rules){const s=wl(r,t);if(!s.ok)return s}return{ok:!0}}if(!e.field||typeof e.field!="string")return{ok:!1,reason:"Campo no especificado"};if(!t.includes(e.field))return{ok:!1,reason:`Campo "${e.field}" no existe`};switch(e.op){case"eq":case"neq":return"value"in e?{ok:!0}:{ok:!1,reason:"Valor requerido"};case"in":case"notIn":return Array.isArray(e.values)&&e.values.length>0?{ok:!0}:{ok:!1,reason:"Lista de valores vacía"};case"gt":case"gte":case"lt":case"lte":return"value"in e?Dh(e.value)?{ok:!0}:{ok:!1,reason:"Valor no comparable (número, string o Date)"}:{ok:!1,reason:"Valor requerido"};default:return{ok:!1,reason:`Operador no soportado: ${e.op}`}}}function Mh(e,t){for(let r=0;r<e.layout.length;r++){const s=e.layout[r];if((s==null?void 0:s.type)!=="tabs")continue;const n=s.tabs.findIndex(a=>a.key===t);if(n>=0)return{nodeIdx:r,tabIdx:n,node:s,tab:s.tabs[n]}}return null}function $h(){var k,I,U,G,ee,M,W,me,be,de,ke,ge,he,fe,pe,ye,ce,Se,Te,j,F,R,X,Y,Z,ue,xe,je,Fe,vt,Me,Vt,Ft,Ot,Rt,Dt,rr,Mt;const e=J(O=>O.selection),t=J(O=>O.schema),r=J(O=>O.updateField),s=J(O=>O.removeField),n=J(O=>O.renameField),a=J(O=>O.duplicateField),i=J(O=>O.changeFieldType),l=J(O=>O.addTabAfter),c=J(O=>O.removeTab),d=J(O=>O.renameTab),u=J(O=>O.moveTab),f=J(O=>O.addSectionToTab),{services:h}=Ms(),{show:p}=Ir(),v=i??((O,L)=>r(O,Q=>{Q.type=L})),g=b.useMemo(()=>t.fields.map(O=>O.name).filter(Boolean).map(O=>({label:O,value:O})),[t.fields]),x=b.useMemo(()=>g.map(O=>O.value),[g]),m=b.useMemo(()=>{if(e.kind==="field")return t.fields.find(O=>O.name===e.name)},[e,t.fields]),w=(m==null?void 0:m.type)==="select",y=(m==null?void 0:m.type)==="textarea",T=(m==null?void 0:m.type)==="file",N=(m==null?void 0:m.type)==="date",_=(m==null?void 0:m.type)==="number",A=b.useMemo(()=>Object.keys((h==null?void 0:h.registry)??{}),[h]),S=b.useMemo(()=>[{label:"— ninguno —",value:""},...A.map(O=>({label:O,value:O}))],[A]),[$,V]=b.useState(!1),[z,q]=b.useState(null),[D,P]=b.useState([]),[E,te]=b.useState(""),ne=async()=>{var Q;const O=m==null?void 0:m.optionSource;if(!O){q("Debes elegir una clave en 'Option source'."),p("Elige la clave del adapter en 'Option source'.","warning");return}const L=(Q=h==null?void 0:h.registry)==null?void 0:Q[O];if(typeof L!="function"){q(`No existe un provider en services.registry["${O}"]`),p(`Provider no encontrado: ${O}`,"error");return}V(!0),q(null);try{let B;if(E.trim())try{B=JSON.parse(E)}catch{q("Contexto JSON inválido."),p("Contexto JSON inválido.","error"),V(!1);return}const Ne=B!=null?{getValues:()=>B}:void 0,Le=await Promise.resolve(L("",Ne)),Oe=Array.isArray(Le)?Le:[];P(Oe),p(Oe.length?`Cargadas ${Oe.length} opciones.`:"El adapter devolvió 0 opciones.",Oe.length?"success":"info")}catch(B){q((B==null?void 0:B.message)||String(B)),p("Error al cargar opciones desde adapter.","error")}finally{V(!1)}},K=()=>{m!=null&&m.name&&(r(m.name,O=>{O.options=[...D],delete O.optionSource,delete O.loadOptions}),p("Opciones copiadas al campo (options).","success"))},le=({title:O,fieldKey:L,showClearTo:Q})=>{const B=(m==null?void 0:m[L])??{},Ne=Th(B),Le=Oh(B.rule??null),Oe=Ee=>r(m.name,Wt=>{Wt[L]=Ee}),[He,We]=b.useState(""),Ke=b.useRef(null),Ge=Ee=>{Ke.current&&window.clearTimeout(Ke.current),We(Ee),Ke.current=window.setTimeout(()=>We(""),1500)};b.useEffect(()=>()=>{Ke.current!=null&&window.clearTimeout(Ke.current)},[]);const Pe=Ee=>{var sr;if(Ee.rule)return Ee;const Wt=((sr=g[0])==null?void 0:sr.value)??"";return{...Ee,rule:{op:"eq",field:Wt,value:!0}}},yt=Ee=>{Oe(Ee?Pe(No(B,Ee)):No(B,Ee)),Ge(Ee?"Regla activada":"Regla desactivada"),p(Ee?"Regla activada":"Regla desactivada","info")},at=Ee=>{Oe(_h(B,Ee)),Ge("Regla actualizada")},ft=Ee=>{Oe(Fh(B,Ee)),Ge("clearTo actualizado"),p("clearTo actualizado","info")},Bt="__quick_placeholder__",Ut=Ee=>{var da;if(!Ee||Ee===Bt)return;const Wt=((da=g[0])==null?void 0:da.value)??"",sr={...B??{},enabled:!0};Ee==="eq:true"&&Oe({...sr,rule:{op:"eq",field:Wt,value:!0}}),Ee==="eq:false"&&Oe({...sr,rule:{op:"eq",field:Wt,value:!1}}),Ee==="eq:empty"&&Oe({...sr,rule:{op:"eq",field:Wt,value:""}}),Ge("Atajo aplicado"),p("Atajo aplicado","success")},wt=async()=>{try{await navigator.clipboard.writeText(Le||""),Ge("Copiado"),p("Regla copiada al portapapeles","success")}catch{Ge("No se pudo copiar"),p("No se pudo copiar al portapapeles","error")}},qt=async()=>{const Ee=await Rh();Ee?(Oe({...B??{},enabled:!0,rule:Ee}),Ge("Pegado"),p("Regla pegada desde portapapeles","success")):(Ge("Portapapeles no válido"),p("El contenido del portapapeles no es una regla válida","warning"))},xr=()=>{at(void 0),Ge("Regla borrada"),p("Regla borrada","info")},Jr=wl(B.rule,x),jl=Ne?Jr.ok?"text-[var(--color-success-600)]":"text-[var(--color-danger-600)]":"text-[var(--color-ds-text-secondary)]",kl=Ne?Jr.ok?"border-[var(--color-success-400)]":"border-[var(--color-danger-400)]":"border-[var(--color-ds-border-default-50)]";return o.jsxs("div",{className:"rounded-md border border-[var(--color-ds-border-default-50)] p-2 space-y-2",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(dt,{size:"sm",checked:Ne,onChange:yt,label:O}),o.jsxs("span",{className:`ml-2 flex items-center gap-1 text-[11px] ${jl}`,children:[o.jsx("span",{className:"inline-block w-2 h-2 rounded-full border border-black/10 bg-current opacity-70"}),Ne?Jr.ok?"OK":Jr.reason:"Inactiva"]})]})}),o.jsx("div",{className:"text-[11px] h-4 text-[var(--color-ds-text-secondary)]","aria-live":"polite",children:He||o.jsx("span",{"aria-hidden":"true",children:" "})}),o.jsx(rt,{label:"Atajo rápido",value:"__quick_placeholder__",onChange:Ee=>Ut(Ee),options:[{label:"— Atajo rápido —",value:"__quick_placeholder__"},{label:"Campo = true",value:"eq:true"},{label:"Campo = false",value:"eq:false"},{label:"Campo = '' (vacío)",value:"eq:empty"}],size:"sm",reserveErrorSpace:!1}),o.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:wt,title:"Copiar JSON",children:"Copiar"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:qt,title:"Pegar JSON",children:"Pegar"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:xr,title:"Borrar regla",children:"Borrar"})]}),o.jsx("div",{className:Ne?"":"opacity-60 pointer-events-none",children:o.jsx(Sh,{value:B.rule,fieldOptions:g,onChange:Ee=>at(Ee)})}),o.jsx("div",{className:`rounded p-2 bg-[var(--color-ds-background-surface)] border ${kl}`,children:o.jsx("pre",{className:"m-0 text-[11px] leading-snug whitespace-pre-wrap break-all text-[var(--color-ds-text-primary)]",children:Le||"—"})}),Q&&o.jsx(we,{label:"clearTo",value:B.clearTo??"",onChange:Ee=>ft(Ee.target.value)})]})};if(e.kind==="tab"){const O=Mh(t,e.tabKey);if(!O)return o.jsx("div",{className:"p-3 text-[var(--color-ds-text-secondary)]",children:"Pestaña no encontrada."});const{tab:L}=O,[Q,B]=b.useState(L.label??"");return b.useEffect(()=>{B(L.label??"")},[L.label]),o.jsxs("div",{className:"pl-2 pt-4 border-l border-[var(--color-ds-border-default)] space-y-4 custom-scroll overflow-auto",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"font-medium text-ds-md text-[var(--color-ds-text-primary)]",children:"Inspector de pestaña"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>u(e.tabKey,"left"),children:"← Mover"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>u(e.tabKey,"right"),children:"Mover →"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>l(e.tabKey),children:"+ Pestaña a la derecha"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>c(e.tabKey),children:"Eliminar pestaña"})]})]}),o.jsx(it,{title:"Identidad",type:"plain",defaultOpen:!0,children:o.jsx("div",{className:"grid gap-2",children:o.jsx(we,{size:"sm",label:"Label de la pestaña",value:Q,onChange:Ne=>B(Ne.target.value),onBlur:()=>d(e.tabKey,Q)})})}),o.jsx(it,{title:"Estructura",type:"plain",defaultOpen:!0,children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>f(e.tabKey),children:"+ Añadir sección"}),o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm",children:"Esta acción agrega una sección con una fila y una columna vacía dentro de la pestaña."})]})}),o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm",children:"Selecciona una sección o un campo para ver sus propiedades específicas."})]})}if(e.kind!=="field")return o.jsx("div",{className:"p-3 text-[var(--color-ds-text-secondary)]",children:"Selecciona un campo o una pestaña…"});if(!m)return o.jsx("div",{className:"p-3 text-[var(--color-ds-text-secondary)]",children:"Campo no encontrado."});const C=O=>{r(m.name,L=>{var Ne;const Q=(Ne=L.validation)==null?void 0:Ne.pattern;if(O==="none"){L.validation={...L.validation??{},pattern:void 0};return}const B=O==="email"?/^[^\s@]+@[^\s@]+\.[^\s@]+$/:/^\+?\d{7,15}$/;L.validation={...L.validation??{},pattern:{value:B,message:(Q==null?void 0:Q.message)||(O==="email"?"Email inválido":"Teléfono inválido")}}}),p(O==="none"?"Patrón eliminado":"Patrón aplicado","info")};return o.jsxs("div",{className:"pl-2 pt-4 border-l border-[var(--color-ds-border-default)] space-y-4 custom-scroll overflow-auto",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"font-medium text-ds-md text-[var(--color-ds-text-primary)]",children:"Inspector"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>a(m.name,`${m.name}`),children:"Duplicar"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>s(m.name),children:"Eliminar"})]})]}),o.jsxs(it,{title:"Identidad",type:"plain",defaultOpen:!0,children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(we,{size:"sm",label:"Name",value:m.name??"",onChange:O=>n(m.name,O.target.value)}),o.jsx(we,{size:"sm",label:"Label",value:m.label??"",onChange:O=>r(m.name,L=>{L.label=O.target.value})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(rt,{label:"Tipo",value:m.type,onChange:O=>v(m.name,O),options:Ah}),o.jsx(we,{size:"sm",label:"Info (tooltip/ayuda)",value:m.info??"",onChange:O=>r(m.name,L=>{L.info=O.target.value})})]})]}),o.jsx(it,{title:"Layout",type:"plain",defaultOpen:!0,children:o.jsxs("div",{className:"grid gap-2",children:[o.jsx(rt,{label:"Width",value:m.width??"",onChange:O=>r(m.name,L=>{L.width=O}),options:[{label:"— custom —",value:""},...Eh.map(O=>({label:O,value:O}))]}),o.jsx(rt,{label:"Size",value:m.size??"sm",onChange:O=>r(m.name,L=>{L.size=O}),options:Ch.map(O=>({label:O,value:O}))}),!["checkbox","file"].includes(m.type)&&o.jsx(we,{size:"sm",label:"Placeholder",value:m.placeholder??"",onChange:O=>r(m.name,L=>{L.placeholder=O.target.value})})]})}),w&&o.jsxs(it,{title:"Select",type:"plain",defaultOpen:!0,children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(rt,{label:"Option source (registry key)",value:m.optionSource??"",onChange:O=>r(m.name,L=>{L.optionSource=O||void 0,L.optionSource&&(delete L.options,delete L.loadOptions)}),options:S}),o.jsx(we,{size:"sm",label:"Contexto (JSON) para adapter (opcional)",placeholder:'{"cifOrga":"A12345678","tipoContrato":"OB"}',value:E,onChange:O=>te(O.target.value)}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:ne,disabled:$||!A.length,children:$?"Cargando…":"Cargar opciones"}),!!D.length&&o.jsx(ie,{size:"sm",variant:"outline",onClick:K,title:"Copiar vista previa a options",children:"Aplicar al campo"})]}),z&&o.jsx("div",{className:"text-xs text-[var(--color-ds-text-primary)]",children:z}),!!D.length&&o.jsxs("div",{className:"rounded border p-2 max-h-40 overflow-auto border-[var(--color-ds-border-default-50)]",children:[o.jsxs("div",{className:"text-[11px] mb-1 opacity-70",children:["Vista previa (",D.length,"):"]}),o.jsxs("ul",{className:"text-[12px] space-y-1",children:[D.slice(0,50).map((O,L)=>o.jsxs("li",{children:[o.jsx("code",{className:"opacity-70",children:O.value})," — ",O.label]},`${O.value}-${L}`)),D.length>50&&o.jsx("li",{className:"opacity-60 text-[11px]",children:"… (truncado)"})]})]})]}),o.jsxs("div",{className:"pt-2 space-y-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)]",children:"Opciones estáticas (se ignoran si defines optionSource)"}),(m.options??[]).map((O,L)=>o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsx(we,{size:"sm",label:"Etiqueta",value:O.label??"",onChange:Q=>r(m.name,B=>{const Ne=Array.isArray(B.options)?[...B.options]:[];Ne[L]={...Ne[L],label:Q.target.value},B.options=Ne})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{size:"sm",label:"Valor",value:O.value??"",onChange:Q=>r(m.name,B=>{const Ne=Array.isArray(B.options)?[...B.options]:[];Ne[L]={...Ne[L],value:Q.target.value},B.options=Ne})}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>r(m.name,Q=>{const B=Array.isArray(Q.options)?[...Q.options]:[];B.splice(L,1),Q.options=B}),"aria-label":"Eliminar opción",title:"Eliminar opción",children:"✕"})]})]},L)),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>r(m.name,O=>{const L=Array.isArray(O.options)?[...O.options]:[];L.push({label:"Opción",value:`opt_${L.length+1}`}),O.options=L}),children:"+ Añadir opción"})]}),o.jsx("div",{className:"pt-2",children:o.jsx(dt,{size:"sm",label:"Múltiple",checked:!!m.multiple,onChange:O=>r(m.name,L=>{L.multiple=O})})})]}),y&&o.jsxs(it,{title:"Textarea",type:"plain",defaultOpen:!0,children:[o.jsx(we,{size:"sm",type:"number",label:"Máx. caracteres",value:m.maxLength??"",onChange:O=>r(m.name,L=>{const Q=O.target.value;L.maxLength=Q?Number(Q):void 0}),className:"w-32"}),o.jsx(dt,{size:"sm",label:"Mostrar contador",checked:!!m.showCounter,onChange:O=>r(m.name,L=>{L.showCounter=O})})]}),T&&o.jsxs(it,{title:"Archivo",type:"plain",defaultOpen:!0,children:[o.jsx(we,{size:"sm",label:"Extensiones permitidas (accept)",placeholder:".pdf,.jpg",value:m.accept??"",onChange:O=>r(m.name,L=>{L.accept=O.target.value})}),o.jsx(we,{size:"sm",type:"number",label:"Máx. ficheros",value:m.maxFiles??"",onChange:O=>r(m.name,L=>{const Q=O.target.value;L.maxFiles=Q?Number(Q):void 0}),className:"w-32"})]}),N&&o.jsx(it,{title:"Fecha",type:"plain",defaultOpen:!0,children:o.jsx(dt,{size:"sm",label:"Incluir hora",checked:!!m.showTime,onChange:O=>r(m.name,L=>{L.showTime=O})})}),o.jsx(it,{title:"Reglas",type:"plain",defaultOpen:!0,children:o.jsxs("div",{className:"space-y-3",children:[o.jsx(le,{title:"visibleWhen",fieldKey:"visibleWhen"}),o.jsx(le,{title:"disabledWhen",fieldKey:"disabledWhen"}),o.jsx(le,{title:"clearWhen",fieldKey:"clearWhen",showClearTo:!0})]})}),o.jsxs(it,{title:"Validación",type:"plain",defaultOpen:!0,children:[o.jsx(dt,{size:"sm",label:"Requerido",checked:!!((k=m.validation)!=null&&k.required),onChange:O=>r(m.name,L=>{L.validation={...L.validation??{},required:O}})}),o.jsx("div",{className:"grid gap-2",children:o.jsx(rt,{label:"Preset de patrón",value:"__none__",onChange:O=>C(O==="email"?"email":O==="phone"?"phone":"none"),options:[{label:"— ninguno —",value:"__none__"},{label:"Email básico",value:"email"},{label:"Teléfono (+999…)",value:"phone"}],size:"sm",reserveErrorSpace:!1})}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pb-1",children:"minLength"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{type:"number",value:((U=(I=m.validation)==null?void 0:I.minLength)==null?void 0:U.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},minLength:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.minLength)==null?void 0:B.message)??"Muy corto"}:void 0}}),className:"w-24"}),o.jsx(we,{placeholder:"mensaje",value:((ee=(G=m.validation)==null?void 0:G.minLength)==null?void 0:ee.message)??"",onChange:O=>r(m.name,L=>{var B;const Q=(B=L.validation)==null?void 0:B.minLength;L.validation={...L.validation??{},minLength:Q?{...Q,message:O.target.value}:{value:0,message:O.target.value}}})})]})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pb-1",children:"maxLength"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{type:"number",value:((W=(M=m.validation)==null?void 0:M.maxLength)==null?void 0:W.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},maxLength:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.maxLength)==null?void 0:B.message)??"Muy largo"}:void 0}}),className:"w-24"}),o.jsx(we,{placeholder:"mensaje",value:((be=(me=m.validation)==null?void 0:me.maxLength)==null?void 0:be.message)??"",onChange:O=>r(m.name,L=>{var B;const Q=(B=L.validation)==null?void 0:B.maxLength;L.validation={...L.validation??{},maxLength:Q?{...Q,message:O.target.value}:{value:0,message:O.target.value}}})})]})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pb-1",children:"pattern (RegExp)"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{placeholder:"^\\\\d+$",value:((ge=(ke=(de=m.validation)==null?void 0:de.pattern)==null?void 0:ke.value)==null?void 0:ge.source)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},pattern:O.target.value?{value:new RegExp(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.pattern)==null?void 0:B.message)??"Formato inválido"}:void 0}})}),o.jsx(we,{placeholder:"mensaje",value:((fe=(he=m.validation)==null?void 0:he.pattern)==null?void 0:fe.message)??"",onChange:O=>r(m.name,L=>{var B;const Q=(B=L.validation)==null?void 0:B.pattern;L.validation={...L.validation??{},pattern:Q?{...Q,message:O.target.value}:{value:/.*/,message:O.target.value}}})})]})]})]}),_&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Número"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{type:"number",label:"min",className:"w-28",value:((ye=(pe=m.validation)==null?void 0:pe.numberMin)==null?void 0:ye.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},numberMin:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.numberMin)==null?void 0:B.message)??"Demasiado pequeño"}:void 0}})}),o.jsx(we,{type:"number",label:"max",className:"w-28",value:((Se=(ce=m.validation)==null?void 0:ce.numberMax)==null?void 0:Se.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},numberMax:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.numberMax)==null?void 0:B.message)??"Demasiado grande"}:void 0}})}),o.jsx(we,{type:"number",label:"step",className:"w-28",value:((j=(Te=m.validation)==null?void 0:Te.step)==null?void 0:j.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},step:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.step)==null?void 0:B.message)??"Incremento inválido"}:void 0}})})]}),o.jsxs("div",{className:"flex gap-4",children:[o.jsx(dt,{size:"sm",label:"Solo enteros",checked:!!((R=(F=m.validation)==null?void 0:F.integerOnly)!=null&&R.value),onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},integerOnly:O?{value:!0,message:((B=(Q=L.validation)==null?void 0:Q.integerOnly)==null?void 0:B.message)??"Debe ser entero"}:void 0}})}),o.jsx(dt,{size:"sm",label:"Solo positivos",checked:!!((Y=(X=m.validation)==null?void 0:X.positiveOnly)!=null&&Y.value),onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},positiveOnly:O?{value:!0,message:((B=(Q=L.validation)==null?void 0:Q.positiveOnly)==null?void 0:B.message)??"Debe ser positivo"}:void 0}})})]})]}),w&&m.multiple&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Select (múltiple)"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{type:"number",label:"mín. seleccionados",className:"w-40",value:((ue=(Z=m.validation)==null?void 0:Z.selectMin)==null?void 0:ue.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},selectMin:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.selectMin)==null?void 0:B.message)??"Selecciona más opciones"}:void 0}})}),o.jsx(we,{type:"number",label:"máx. seleccionados",className:"w-40",value:((je=(xe=m.validation)==null?void 0:xe.selectMax)==null?void 0:je.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},selectMax:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.selectMax)==null?void 0:B.message)??"Demasiadas opciones"}:void 0}})})]})]}),N&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Fecha"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(_r,{size:"sm",label:"minDate",className:"w-44",showTime:!!m.showTime,defaultValue:((vt=(Fe=m.validation)==null?void 0:Fe.dateMin)==null?void 0:vt.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},dateMin:O.target.value?{value:O.target.value,message:((B=(Q=L.validation)==null?void 0:Q.dateMin)==null?void 0:B.message)??"Demasiado antigua"}:void 0}})}),o.jsx(_r,{size:"sm",label:"maxDate",className:"w-44",showTime:!!m.showTime,defaultValue:((Vt=(Me=m.validation)==null?void 0:Me.dateMax)==null?void 0:Vt.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},dateMax:O.target.value?{value:O.target.value,message:((B=(Q=L.validation)==null?void 0:Q.dateMax)==null?void 0:B.message)??"Demasiado futura"}:void 0}})})]}),o.jsxs("div",{className:"flex gap-4",children:[o.jsx(dt,{size:"sm",label:"No permitir pasado",checked:!!((Ot=(Ft=m.validation)==null?void 0:Ft.disallowPast)!=null&&Ot.value),onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},disallowPast:O?{value:!0,message:((B=(Q=L.validation)==null?void 0:Q.disallowPast)==null?void 0:B.message)??"No se permiten fechas pasadas"}:void 0}})}),o.jsx(dt,{size:"sm",label:"No permitir futuro",checked:!!((Dt=(Rt=m.validation)==null?void 0:Rt.disallowFuture)!=null&&Dt.value),onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},disallowFuture:O?{value:!0,message:((B=(Q=L.validation)==null?void 0:Q.disallowFuture)==null?void 0:B.message)??"No se permiten fechas futuras"}:void 0}})})]})]}),T&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Archivo"}),o.jsx(we,{type:"number",label:"Tamaño máx. por archivo (MB)",className:"w-56",value:((Mt=(rr=m.validation)==null?void 0:rr.fileMaxSizeMB)==null?void 0:Mt.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},fileMaxSizeMB:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.fileMaxSizeMB)==null?void 0:B.message)??"Archivo demasiado grande"}:void 0}})})]})]})]})}function Lh(e){return typeof e.type=="string"}function Ph(e){const t=e.validation;return t===void 0||typeof t=="object"}function zh(e){const t=e.options;return Array.isArray(t)}function Ih(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function Lt(e){return String(e).replace(/\\/g,"\\\\").replace(/`/g,"\\`")}function Vh(e){var a,i,l,c,d;const t=Lh(e)&&e.type?e.type:"string";let r="yup.string()";switch(t){case"number":r="yup.number()";break;case"checkbox":r="yup.boolean()";break;case"date":r="yup.date().nullable()";break;case"file":r="yup.array()";break;case"select":case"text":case"email":case"password":case"textarea":default:r="yup.string()";break}const s=Ph(e)&&e.validation?e.validation:{},n=[r];if(s.required){const u=typeof s.required=="string"?s.required:s.requiredMessage||"Requerido";n.push(`.required(\`${Lt(u)}\`)`)}if(((a=s.minLength)==null?void 0:a.value)!=null&&n.push(`.min(${Number(s.minLength.value)}, \`${Lt(s.minLength.message??"Muy corto")}\`)`),((i=s.maxLength)==null?void 0:i.value)!=null&&n.push(`.max(${Number(s.maxLength.value)}, \`${Lt(s.maxLength.message??"Muy largo")}\`)`),(l=s.pattern)!=null&&l.value&&Ih(s.pattern.value)){const u=s.pattern.value.source,f=s.pattern.value.flags||"";n.push(`.matches(new RegExp(\`${Lt(u)}\`, \`${Lt(f)}\`), \`${Lt(s.pattern.message??"Formato inválido")}\`)`)}if(t==="number"&&(((c=s.min)==null?void 0:c.value)!=null&&n.push(`.min(${Number(s.min.value)}, \`${Lt(s.min.message??"Demasiado pequeño")}\`)`),((d=s.max)==null?void 0:d.value)!=null&&n.push(`.max(${Number(s.max.value)}, \`${Lt(s.max.message??"Demasiado grande")}\`)`)),t==="select"&&zh(e)&&e.options&&e.options.length){const u=e.options.map(f=>JSON.stringify(String(f.value)));n.push(`.oneOf([${u.join(", ")}])`)}return n.join("")}function Bh(e,t="validationSchema"){const r=[],s=e.fields??[];for(const i of s){const l=i;!l.name||typeof l.name!="string"||r.push(` ${l.name}: ${Vh(l)},`)}const n=r.join(`
65
+ `},zf={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function If(e){let{announcements:t=zf,container:r,hiddenTextDescribedById:s,screenReaderInstructions:n=Pf}=e;const{announce:a,announcement:i}=Mf(),l=Us("DndLiveRegion"),[c,d]=b.useState(!1);if(b.useEffect(()=>{d(!0)},[]),$f(b.useMemo(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:h}=f;t.onDragMove&&a(t.onDragMove({active:p,over:h}))},onDragOver(f){let{active:p,over:h}=f;a(t.onDragOver({active:p,over:h}))},onDragEnd(f){let{active:p,over:h}=f;a(t.onDragEnd({active:p,over:h}))},onDragCancel(f){let{active:p,over:h}=f;a(t.onDragCancel({active:p,over:h}))}}),[a,t])),!c)return null;const u=b.createElement(b.Fragment,null,b.createElement(Rf,{id:s,value:n.draggable}),b.createElement(Df,{id:l,announcement:i}));return r?Jt.createPortal(u,r):u}var Ve;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ve||(Ve={}));function Fs(){}function uo(e,t){return b.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Vf(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return b.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const xt=Object.freeze({x:0,y:0});function Bf(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Uf(e,t){const r=_s(e);if(!r)return"0 0";const s={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return s.x+"% "+s.y+"%"}function qf(e,t){let{data:{value:r}}=e,{data:{value:s}}=t;return r-s}function Wf(e,t){let{data:{value:r}}=e,{data:{value:s}}=t;return s-r}function Kf(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function fo(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const Gf=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:s}=e;const n=fo(t,t.left,t.top),a=[];for(const i of s){const{id:l}=i,c=r.get(l);if(c){const d=Bf(fo(c),n);a.push({id:l,data:{droppableContainer:i,value:d}})}}return a.sort(qf)};function Jf(e,t){const r=Math.max(t.top,e.top),s=Math.max(t.left,e.left),n=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=n-s,l=a-r;if(s<n&&r<a){const c=t.width*t.height,d=e.width*e.height,u=i*l,f=u/(c+d-u);return Number(f.toFixed(4))}return 0}const nl=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:s}=e;const n=[];for(const a of s){const{id:i}=a,l=r.get(i);if(l){const c=Jf(l,t);c>0&&n.push({id:i,data:{droppableContainer:a,value:c}})}}return n.sort(Wf)};function Zf(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function al(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:xt}function Yf(e){return function(r){for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;a<s;a++)n[a-1]=arguments[a];return n.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...r})}}const Hf=Yf(1);function ol(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Xf(e,t,r){const s=ol(t);if(!s)return e;const{scaleX:n,scaleY:a,x:i,y:l}=s,c=e.left-i-(1-n)*parseFloat(r),d=e.top-l-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),u=n?e.width/n:e.width,f=a?e.height/a:e.height;return{width:u,height:f,top:d,right:c+u,bottom:d+f,left:c}}const Qf={ignoreTransform:!1};function Wr(e,t){t===void 0&&(t=Qf);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:u}=Ye(e).getComputedStyle(e);d&&(r=Xf(r,d,u))}const{top:s,left:n,width:a,height:i,bottom:l,right:c}=r;return{top:s,left:n,width:a,height:i,bottom:l,right:c}}function mo(e){return Wr(e,{ignoreTransform:!0})}function em(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function tm(e,t){return t===void 0&&(t=Ye(e).getComputedStyle(e)),t.position==="fixed"}function rm(e,t){t===void 0&&(t=Ye(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(n=>{const a=t[n];return typeof a=="string"?r.test(a):!1})}function aa(e,t){const r=[];function s(n){if(t!=null&&r.length>=t||!n)return r;if(sa(n)&&n.scrollingElement!=null&&!r.includes(n.scrollingElement))return r.push(n.scrollingElement),r;if(!Ur(n)||tl(n)||r.includes(n))return r;const a=Ye(e).getComputedStyle(n);return n!==e&&rm(n,a)&&r.push(n),tm(n,a)?r:s(n.parentNode)}return e?s(e):r}function il(e){const[t]=aa(e,1);return t??null}function dn(e){return!Vs||!e?null:br(e)?e:ra(e)?sa(e)||e===gr(e).scrollingElement?window:Ur(e)?e:null:null}function ll(e){return br(e)?e.scrollX:e.scrollLeft}function cl(e){return br(e)?e.scrollY:e.scrollTop}function Ln(e){return{x:ll(e),y:cl(e)}}var Be;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Be||(Be={}));function dl(e){return!Vs||!e?!1:e===document.scrollingElement}function ul(e){const t={x:0,y:0},r=dl(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},n=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=s.y,l=e.scrollLeft>=s.x;return{isTop:n,isLeft:a,isBottom:i,isRight:l,maxScroll:s,minScroll:t}}const sm={x:.2,y:.2};function nm(e,t,r,s,n){let{top:a,left:i,right:l,bottom:c}=r;s===void 0&&(s=10),n===void 0&&(n=sm);const{isTop:d,isBottom:u,isLeft:f,isRight:p}=ul(e),h={x:0,y:0},v={x:0,y:0},x={height:t.height*n.y,width:t.width*n.x};return!d&&a<=t.top+x.height?(h.y=Be.Backward,v.y=s*Math.abs((t.top+x.height-a)/x.height)):!u&&c>=t.bottom-x.height&&(h.y=Be.Forward,v.y=s*Math.abs((t.bottom-x.height-c)/x.height)),!p&&l>=t.right-x.width?(h.x=Be.Forward,v.x=s*Math.abs((t.right-x.width-l)/x.width)):!f&&i<=t.left+x.width&&(h.x=Be.Backward,v.x=s*Math.abs((t.left+x.width-i)/x.width)),{direction:h,speed:v}}function am(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}const{top:t,left:r,right:s,bottom:n}=e.getBoundingClientRect();return{top:t,left:r,right:s,bottom:n,width:e.clientWidth,height:e.clientHeight}}function fl(e){return e.reduce((t,r)=>ur(t,Ln(r)),xt)}function om(e){return e.reduce((t,r)=>t+ll(r),0)}function im(e){return e.reduce((t,r)=>t+cl(r),0)}function ml(e,t){if(t===void 0&&(t=Wr),!e)return;const{top:r,left:s,bottom:n,right:a}=t(e);il(e)&&(n<=0||a<=0||r>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const lm=[["x",["left","right"],om],["y",["top","bottom"],im]];class oa{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=aa(r),n=fl(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,l]of lm)for(const c of i)Object.defineProperty(this,c,{get:()=>{const d=l(s),u=n[a]-d;return this.rect[c]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ar{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...r)})},this.target=t}add(t,r,s){var n;(n=this.target)==null||n.addEventListener(t,r,s),this.listeners.push([t,r,s])}}function cm(e){const{EventTarget:t}=Ye(e);return e instanceof t?e:gr(e)}function un(e,t){const r=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+s**2)>t:"x"in t&&"y"in t?r>t.x&&s>t.y:"x"in t?r>t.x:"y"in t?s>t.y:!1}var ut;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ut||(ut={}));function ho(e){e.preventDefault()}function dm(e){e.stopPropagation()}var Ae;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ae||(Ae={}));const hl={start:[Ae.Space,Ae.Enter],cancel:[Ae.Esc],end:[Ae.Space,Ae.Enter,Ae.Tab]},um=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case Ae.Right:return{...r,x:r.x+25};case Ae.Left:return{...r,x:r.x-25};case Ae.Down:return{...r,y:r.y+25};case Ae.Up:return{...r,y:r.y-25}}};class ia{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new Ar(gr(r)),this.windowListeners=new Ar(Ye(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ut.Resize,this.handleCancel),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ut.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,s=t.node.current;s&&ml(s),r(xt)}handleKeyDown(t){if(na(t)){const{active:r,context:s,options:n}=this.props,{keyboardCodes:a=hl,coordinateGetter:i=um,scrollBehavior:l="smooth"}=n,{code:c}=t;if(a.end.includes(c)){this.handleEnd(t);return}if(a.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:d}=s.current,u=d?{x:d.left,y:d.top}:xt;this.referenceCoordinates||(this.referenceCoordinates=u);const f=i(t,{active:r,context:s.current,currentCoordinates:u});if(f){const p=Ts(f,u),h={x:0,y:0},{scrollableAncestors:v}=s.current;for(const x of v){const g=t.code,{isTop:m,isRight:w,isLeft:y,isBottom:T,maxScroll:N,minScroll:_}=ul(x),A=am(x),S={x:Math.min(g===Ae.Right?A.right-A.width/2:A.right,Math.max(g===Ae.Right?A.left:A.left+A.width/2,f.x)),y:Math.min(g===Ae.Down?A.bottom-A.height/2:A.bottom,Math.max(g===Ae.Down?A.top:A.top+A.height/2,f.y))},$=g===Ae.Right&&!w||g===Ae.Left&&!y,V=g===Ae.Down&&!T||g===Ae.Up&&!m;if($&&S.x!==f.x){const z=x.scrollLeft+p.x,q=g===Ae.Right&&z<=N.x||g===Ae.Left&&z>=_.x;if(q&&!p.y){x.scrollTo({left:z,behavior:l});return}q?h.x=x.scrollLeft-z:h.x=g===Ae.Right?x.scrollLeft-N.x:x.scrollLeft-_.x,h.x&&x.scrollBy({left:-h.x,behavior:l});break}else if(V&&S.y!==f.y){const z=x.scrollTop+p.y,q=g===Ae.Down&&z<=N.y||g===Ae.Up&&z>=_.y;if(q&&!p.x){x.scrollTo({top:z,behavior:l});return}q?h.y=x.scrollTop-z:h.y=g===Ae.Down?x.scrollTop-N.y:x.scrollTop-_.y,h.y&&x.scrollBy({top:-h.y,behavior:l});break}}this.handleMove(t,ur(Ts(f,this.referenceCoordinates),h))}}}handleMove(t,r){const{onMove:s}=this.props;t.preventDefault(),s(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ia.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:s=hl,onActivation:n}=t,{active:a}=r;const{code:i}=e.nativeEvent;if(s.start.includes(i)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),n==null||n({event:e.nativeEvent}),!0)}return!1}}];function po(e){return!!(e&&"distance"in e)}function bo(e){return!!(e&&"delay"in e)}class la{constructor(t,r,s){var n;s===void 0&&(s=cm(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:i}=a;this.props=t,this.events=r,this.document=gr(i),this.documentListeners=new Ar(this.document),this.listeners=new Ar(s),this.windowListeners=new Ar(Ye(i)),this.initialCoordinates=(n=_s(a))!=null?n:xt,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ut.Resize,this.handleCancel),this.windowListeners.add(ut.DragStart,ho),this.windowListeners.add(ut.VisibilityChange,this.handleCancel),this.windowListeners.add(ut.ContextMenu,ho),this.documentListeners.add(ut.Keydown,this.handleKeydown),r){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(bo(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(po(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:s,onPending:n}=this.props;n(s,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(ut.Click,dm,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ut.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:s,initialCoordinates:n,props:a}=this,{onMove:i,options:{activationConstraint:l}}=a;if(!n)return;const c=(r=_s(t))!=null?r:xt,d=Ts(n,c);if(!s&&l){if(po(l)){if(l.tolerance!=null&&un(d,l.tolerance))return this.handleCancel();if(un(d,l.distance))return this.handleStart()}if(bo(l)&&un(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===Ae.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const fm={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ca extends la{constructor(t){const{event:r}=t,s=gr(r.target);super(t,fm,s)}}ca.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:s}=t;return!r.isPrimary||r.button!==0?!1:(s==null||s({event:r}),!0)}}];const mm={move:{name:"mousemove"},end:{name:"mouseup"}};var Pn;(function(e){e[e.RightClick=2]="RightClick"})(Pn||(Pn={}));class hm extends la{constructor(t){super(t,mm,gr(t.event.target))}}hm.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:s}=t;return r.button===Pn.RightClick?!1:(s==null||s({event:r}),!0)}}];const fn={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class pm extends la{constructor(t){super(t,fn)}static setup(){return window.addEventListener(fn.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(fn.move.name,t)};function t(){}}}pm.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:s}=t;const{touches:n}=r;return n.length>1?!1:(s==null||s({event:r}),!0)}}];var Tr;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Tr||(Tr={}));var Os;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Os||(Os={}));function bm(e){let{acceleration:t,activator:r=Tr.Pointer,canScroll:s,draggingRect:n,enabled:a,interval:i=5,order:l=Os.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:p}=e;const h=xm({delta:f,disabled:!a}),[v,x]=Af(),g=b.useRef({x:0,y:0}),m=b.useRef({x:0,y:0}),w=b.useMemo(()=>{switch(r){case Tr.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Tr.DraggableRect:return n}},[r,n,c]),y=b.useRef(null),T=b.useCallback(()=>{const _=y.current;if(!_)return;const A=g.current.x*m.current.x,S=g.current.y*m.current.y;_.scrollBy(A,S)},[]),N=b.useMemo(()=>l===Os.TreeOrder?[...d].reverse():d,[l,d]);b.useEffect(()=>{if(!a||!d.length||!w){x();return}for(const _ of N){if((s==null?void 0:s(_))===!1)continue;const A=d.indexOf(_),S=u[A];if(!S)continue;const{direction:$,speed:V}=nm(_,S,w,t,p);for(const z of["x","y"])h[z][$[z]]||(V[z]=0,$[z]=0);if(V.x>0||V.y>0){x(),y.current=_,v(T,i),g.current=V,m.current=$;return}}g.current={x:0,y:0},m.current={x:0,y:0},x()},[t,T,s,x,a,i,JSON.stringify(w),JSON.stringify(h),v,d,N,u,JSON.stringify(p)])}const gm={x:{[Be.Backward]:!1,[Be.Forward]:!1},y:{[Be.Backward]:!1,[Be.Forward]:!1}};function xm(e){let{delta:t,disabled:r}=e;const s=As(t);return qr(n=>{if(r||!s||!n)return gm;const a={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[Be.Backward]:n.x[Be.Backward]||a.x===-1,[Be.Forward]:n.x[Be.Forward]||a.x===1},y:{[Be.Backward]:n.y[Be.Backward]||a.y===-1,[Be.Forward]:n.y[Be.Forward]||a.y===1}}},[r,t,s])}function vm(e,t){const r=t!=null?e.get(t):void 0,s=r?r.node.current:null;return qr(n=>{var a;return t==null?null:(a=s??n)!=null?a:null},[s,t])}function ym(e,t){return b.useMemo(()=>e.reduce((r,s)=>{const{sensor:n}=s,a=n.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,s)}));return[...r,...a]},[]),[e,t])}var $r;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})($r||($r={}));var zn;(function(e){e.Optimized="optimized"})(zn||(zn={}));const go=new Map;function wm(e,t){let{dragging:r,dependencies:s,config:n}=t;const[a,i]=b.useState(null),{frequency:l,measure:c,strategy:d}=n,u=b.useRef(e),f=g(),p=Dr(f),h=b.useCallback(function(m){m===void 0&&(m=[]),!p.current&&i(w=>w===null?m:w.concat(m.filter(y=>!w.includes(y))))},[p]),v=b.useRef(null),x=qr(m=>{if(f&&!r)return go;if(!m||m===go||u.current!==e||a!=null){const w=new Map;for(let y of e){if(!y)continue;if(a&&a.length>0&&!a.includes(y.id)&&y.rect.current){w.set(y.id,y.rect.current);continue}const T=y.node.current,N=T?new oa(c(T),T):null;y.rect.current=N,N&&w.set(y.id,N)}return w}return m},[e,a,r,f,c]);return b.useEffect(()=>{u.current=e},[e]),b.useEffect(()=>{f||h()},[r,f]),b.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),b.useEffect(()=>{f||typeof l!="number"||v.current!==null||(v.current=setTimeout(()=>{h(),v.current=null},l))},[l,f,h,...s]),{droppableRects:x,measureDroppableContainers:h,measuringScheduled:a!=null};function g(){switch(d){case $r.Always:return!1;case $r.BeforeDragging:return r;default:return!r}}}function da(e,t){return qr(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function jm(e,t){return da(e,t)}function km(e){let{callback:t,disabled:r}=e;const s=Bs(t),n=b.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(s)},[s,r]);return b.useEffect(()=>()=>n==null?void 0:n.disconnect(),[n]),n}function qs(e){let{callback:t,disabled:r}=e;const s=Bs(t),n=b.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(s)},[r]);return b.useEffect(()=>()=>n==null?void 0:n.disconnect(),[n]),n}function Nm(e){return new oa(Wr(e),e)}function xo(e,t,r){t===void 0&&(t=Nm);const[s,n]=b.useState(null);function a(){n(c=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=c??r)!=null?d:null}const u=t(e);return JSON.stringify(c)===JSON.stringify(u)?c:u})}const i=km({callback(c){if(e)for(const d of c){const{type:u,target:f}=d;if(u==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),l=qs({callback:a});return _t(()=>{a(),e?(l==null||l.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),i==null||i.disconnect())},[e]),s}function Sm(e){const t=da(e);return al(e,t)}const vo=[];function Em(e){const t=b.useRef(e),r=qr(s=>e?s&&s!==vo&&e&&t.current&&e.parentNode===t.current.parentNode?s:aa(e):vo,[e]);return b.useEffect(()=>{t.current=e},[e]),r}function Cm(e){const[t,r]=b.useState(null),s=b.useRef(e),n=b.useCallback(a=>{const i=dn(a.target);i&&r(l=>l?(l.set(i,Ln(i)),new Map(l)):null)},[]);return b.useEffect(()=>{const a=s.current;if(e!==a){i(a);const l=e.map(c=>{const d=dn(c);return d?(d.addEventListener("scroll",n,{passive:!0}),[d,Ln(d)]):null}).filter(c=>c!=null);r(l.length?new Map(l):null),s.current=e}return()=>{i(e),i(a)};function i(l){l.forEach(c=>{const d=dn(c);d==null||d.removeEventListener("scroll",n)})}},[n,e]),b.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>ur(a,i),xt):fl(e):xt,[e,t])}function yo(e,t){t===void 0&&(t=[]);const r=b.useRef(null);return b.useEffect(()=>{r.current=null},t),b.useEffect(()=>{const s=e!==xt;s&&!r.current&&(r.current=e),!s&&r.current&&(r.current=null)},[e]),r.current?Ts(e,r.current):xt}function Am(e){b.useEffect(()=>{if(!Vs)return;const t=e.map(r=>{let{sensor:s}=r;return s.setup==null?void 0:s.setup()});return()=>{for(const r of t)r==null||r()}},e.map(t=>{let{sensor:r}=t;return r}))}function Tm(e,t){return b.useMemo(()=>e.reduce((r,s)=>{let{eventName:n,handler:a}=s;return r[n]=i=>{a(i,t)},r},{}),[e,t])}function pl(e){return b.useMemo(()=>e?em(e):null,[e])}const wo=[];function _m(e,t){t===void 0&&(t=Wr);const[r]=e,s=pl(r?Ye(r):null),[n,a]=b.useState(wo);function i(){a(()=>e.length?e.map(c=>dl(c)?s:new oa(t(c),c)):wo)}const l=qs({callback:i});return _t(()=>{l==null||l.disconnect(),i(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),n}function bl(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ur(t)?t:e}function Fm(e){let{measure:t}=e;const[r,s]=b.useState(null),n=b.useCallback(d=>{for(const{target:u}of d)if(Ur(u)){s(f=>{const p=t(u);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=qs({callback:n}),i=b.useCallback(d=>{const u=bl(d);a==null||a.disconnect(),u&&(a==null||a.observe(u)),s(u?t(u):null)},[t,a]),[l,c]=Cs(i);return b.useMemo(()=>({nodeRef:l,rect:r,setRef:c}),[r,l,c])}const Om=[{sensor:ca,options:{}},{sensor:ia,options:{}}],Rm={current:{}},bs={draggable:{measure:mo},droppable:{measure:mo,strategy:$r.WhileDragging,frequency:zn.Optimized},dragOverlay:{measure:Wr}};class _r extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,s;return(r=(s=this.get(t))==null?void 0:s.node.current)!=null?r:void 0}}const Dm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _r,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Fs},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:bs,measureDroppableContainers:Fs,windowRect:null,measuringScheduled:!1},gl={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Fs,draggableNodes:new Map,over:null,measureDroppableContainers:Fs},Kr=b.createContext(gl),xl=b.createContext(Dm);function Mm(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _r}}}function $m(e,t){switch(t.type){case Ve.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ve.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ve.DragEnd:case Ve.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ve.RegisterDroppable:{const{element:r}=t,{id:s}=r,n=new _r(e.droppable.containers);return n.set(s,r),{...e,droppable:{...e.droppable,containers:n}}}case Ve.SetDroppableDisabled:{const{id:r,key:s,disabled:n}=t,a=e.droppable.containers.get(r);if(!a||s!==a.key)return e;const i=new _r(e.droppable.containers);return i.set(r,{...a,disabled:n}),{...e,droppable:{...e.droppable,containers:i}}}case Ve.UnregisterDroppable:{const{id:r,key:s}=t,n=e.droppable.containers.get(r);if(!n||s!==n.key)return e;const a=new _r(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Lm(e){let{disabled:t}=e;const{active:r,activatorEvent:s,draggableNodes:n}=b.useContext(Kr),a=As(s),i=As(r==null?void 0:r.id);return b.useEffect(()=>{if(!t&&!s&&a&&i!=null){if(!na(a)||document.activeElement===a.target)return;const l=n.get(i);if(!l)return;const{activatorNode:c,node:d}=l;if(!c.current&&!d.current)return;requestAnimationFrame(()=>{for(const u of[c.current,d.current]){if(!u)continue;const f=Ff(u);if(f){f.focus();break}}})}},[s,t,n,i,a]),null}function vl(e,t){let{transform:r,...s}=t;return e!=null&&e.length?e.reduce((n,a)=>a({transform:n,...s}),r):r}function Pm(e){return b.useMemo(()=>({draggable:{...bs.draggable,...e==null?void 0:e.draggable},droppable:{...bs.droppable,...e==null?void 0:e.droppable},dragOverlay:{...bs.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function zm(e){let{activeNode:t,measure:r,initialRect:s,config:n=!0}=e;const a=b.useRef(!1),{x:i,y:l}=typeof n=="boolean"?{x:n,y:n}:n;_t(()=>{if(!i&&!l||!t){a.current=!1;return}if(a.current||!s)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const u=r(d),f=al(u,s);if(i||(f.x=0),l||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const p=il(d);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,l,s,r])}const Ws=b.createContext({...xt,scaleX:1,scaleY:1});var zt;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(zt||(zt={}));const Im=b.memo(function(t){var r,s,n,a;let{id:i,accessibility:l,autoScroll:c=!0,children:d,sensors:u=Om,collisionDetection:f=nl,measuring:p,modifiers:h,...v}=t;const x=b.useReducer($m,void 0,Mm),[g,m]=x,[w,y]=Lf(),[T,N]=b.useState(zt.Uninitialized),_=T===zt.Initialized,{draggable:{active:A,nodes:S,translate:$},droppable:{containers:V}}=g,z=A!=null?S.get(A):null,q=b.useRef({initial:null,translated:null}),D=b.useMemo(()=>{var B;return A!=null?{id:A,data:(B=z==null?void 0:z.data)!=null?B:Rm,rect:q}:null},[A,z]),P=b.useRef(null),[E,te]=b.useState(null),[ne,K]=b.useState(null),le=Dr(v,Object.values(v)),C=Us("DndDescribedBy",i),k=b.useMemo(()=>V.getEnabled(),[V]),I=Pm(p),{droppableRects:U,measureDroppableContainers:G,measuringScheduled:ee}=wm(k,{dragging:_,dependencies:[$.x,$.y],config:I.droppable}),M=vm(S,A),W=b.useMemo(()=>ne?_s(ne):null,[ne]),me=Q(),be=jm(M,I.draggable.measure);zm({activeNode:A!=null?S.get(A):null,config:me.layoutShiftCompensation,initialRect:be,measure:I.draggable.measure});const de=xo(M,I.draggable.measure,be),ke=xo(M?M.parentElement:null),ge=b.useRef({activatorEvent:null,active:null,activeNode:M,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:S,draggingNode:null,draggingNodeRect:null,droppableContainers:V,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),he=V.getNodeFor((r=ge.current.over)==null?void 0:r.id),fe=Fm({measure:I.dragOverlay.measure}),pe=(s=fe.nodeRef.current)!=null?s:M,ye=_?(n=fe.rect)!=null?n:de:null,ce=!!(fe.nodeRef.current&&fe.rect),Se=Sm(ce?null:de),Te=pl(pe?Ye(pe):null),j=Em(_?he??M:null),F=_m(j),R=vl(h,{transform:{x:$.x-Se.x,y:$.y-Se.y,scaleX:1,scaleY:1},activatorEvent:ne,active:D,activeNodeRect:de,containerNodeRect:ke,draggingNodeRect:ye,over:ge.current.over,overlayNodeRect:fe.rect,scrollableAncestors:j,scrollableAncestorRects:F,windowRect:Te}),X=W?ur(W,$):null,Y=Cm(j),Z=yo(Y),ue=yo(Y,[de]),xe=ur(R,Z),je=ye?Hf(ye,R):null,Fe=D&&je?f({active:D,collisionRect:je,droppableRects:U,droppableContainers:k,pointerCoordinates:X}):null,vt=Kf(Fe,"id"),[Me,Vt]=b.useState(null),Ft=ce?R:ur(R,ue),Ot=Zf(Ft,(a=Me==null?void 0:Me.rect)!=null?a:null,de),Rt=b.useRef(null),Dt=b.useCallback((B,Ne)=>{let{sensor:Le,options:Oe}=Ne;if(P.current==null)return;const He=S.get(P.current);if(!He)return;const We=B.nativeEvent,Ke=new Le({active:P.current,activeNode:He,event:We,options:Oe,context:ge,onAbort(Pe){if(!S.get(Pe))return;const{onDragAbort:at}=le.current,ft={id:Pe};at==null||at(ft),w({type:"onDragAbort",event:ft})},onPending(Pe,yt,at,ft){if(!S.get(Pe))return;const{onDragPending:Ut}=le.current,wt={id:Pe,constraint:yt,initialCoordinates:at,offset:ft};Ut==null||Ut(wt),w({type:"onDragPending",event:wt})},onStart(Pe){const yt=P.current;if(yt==null)return;const at=S.get(yt);if(!at)return;const{onDragStart:ft}=le.current,Bt={activatorEvent:We,active:{id:yt,data:at.data,rect:q}};Jt.unstable_batchedUpdates(()=>{ft==null||ft(Bt),N(zt.Initializing),m({type:Ve.DragStart,initialCoordinates:Pe,active:yt}),w({type:"onDragStart",event:Bt}),te(Rt.current),K(We)})},onMove(Pe){m({type:Ve.DragMove,coordinates:Pe})},onEnd:Ge(Ve.DragEnd),onCancel:Ge(Ve.DragCancel)});Rt.current=Ke;function Ge(Pe){return async function(){const{active:at,collisions:ft,over:Bt,scrollAdjustedTranslate:Ut}=ge.current;let wt=null;if(at&&Ut){const{cancelDrop:qt}=le.current;wt={activatorEvent:We,active:at,collisions:ft,delta:Ut,over:Bt},Pe===Ve.DragEnd&&typeof qt=="function"&&await Promise.resolve(qt(wt))&&(Pe=Ve.DragCancel)}P.current=null,Jt.unstable_batchedUpdates(()=>{m({type:Pe}),N(zt.Uninitialized),Vt(null),te(null),K(null),Rt.current=null;const qt=Pe===Ve.DragEnd?"onDragEnd":"onDragCancel";if(wt){const xr=le.current[qt];xr==null||xr(wt),w({type:qt,event:wt})}})}}},[S]),rr=b.useCallback((B,Ne)=>(Le,Oe)=>{const He=Le.nativeEvent,We=S.get(Oe);if(P.current!==null||!We||He.dndKit||He.defaultPrevented)return;const Ke={active:We};B(Le,Ne.options,Ke)===!0&&(He.dndKit={capturedBy:Ne.sensor},P.current=Oe,Dt(Le,Ne))},[S,Dt]),Mt=ym(u,rr);Am(u),_t(()=>{de&&T===zt.Initializing&&N(zt.Initialized)},[de,T]),b.useEffect(()=>{const{onDragMove:B}=le.current,{active:Ne,activatorEvent:Le,collisions:Oe,over:He}=ge.current;if(!Ne||!Le)return;const We={active:Ne,activatorEvent:Le,collisions:Oe,delta:{x:xe.x,y:xe.y},over:He};Jt.unstable_batchedUpdates(()=>{B==null||B(We),w({type:"onDragMove",event:We})})},[xe.x,xe.y]),b.useEffect(()=>{const{active:B,activatorEvent:Ne,collisions:Le,droppableContainers:Oe,scrollAdjustedTranslate:He}=ge.current;if(!B||P.current==null||!Ne||!He)return;const{onDragOver:We}=le.current,Ke=Oe.get(vt),Ge=Ke&&Ke.rect.current?{id:Ke.id,rect:Ke.rect.current,data:Ke.data,disabled:Ke.disabled}:null,Pe={active:B,activatorEvent:Ne,collisions:Le,delta:{x:He.x,y:He.y},over:Ge};Jt.unstable_batchedUpdates(()=>{Vt(Ge),We==null||We(Pe),w({type:"onDragOver",event:Pe})})},[vt]),_t(()=>{ge.current={activatorEvent:ne,active:D,activeNode:M,collisionRect:je,collisions:Fe,droppableRects:U,draggableNodes:S,draggingNode:pe,draggingNodeRect:ye,droppableContainers:V,over:Me,scrollableAncestors:j,scrollAdjustedTranslate:xe},q.current={initial:ye,translated:je}},[D,M,Fe,je,S,pe,ye,U,V,Me,j,xe]),bm({...me,delta:$,draggingRect:je,pointerCoordinates:X,scrollableAncestors:j,scrollableAncestorRects:F});const O=b.useMemo(()=>({active:D,activeNode:M,activeNodeRect:de,activatorEvent:ne,collisions:Fe,containerNodeRect:ke,dragOverlay:fe,draggableNodes:S,droppableContainers:V,droppableRects:U,over:Me,measureDroppableContainers:G,scrollableAncestors:j,scrollableAncestorRects:F,measuringConfiguration:I,measuringScheduled:ee,windowRect:Te}),[D,M,de,ne,Fe,ke,fe,S,V,U,Me,G,j,F,I,ee,Te]),L=b.useMemo(()=>({activatorEvent:ne,activators:Mt,active:D,activeNodeRect:de,ariaDescribedById:{draggable:C},dispatch:m,draggableNodes:S,over:Me,measureDroppableContainers:G}),[ne,Mt,D,de,m,C,S,Me,G]);return b.createElement(sl.Provider,{value:y},b.createElement(Kr.Provider,{value:L},b.createElement(xl.Provider,{value:O},b.createElement(Ws.Provider,{value:Ot},d)),b.createElement(Lm,{disabled:(l==null?void 0:l.restoreFocus)===!1})),b.createElement(If,{...l,hiddenTextDescribedById:C}));function Q(){const B=(E==null?void 0:E.autoScrollEnabled)===!1,Ne=typeof c=="object"?c.enabled===!1:c===!1,Le=_&&!B&&!Ne;return typeof c=="object"?{...c,enabled:Le}:{enabled:Le}}}),Vm=b.createContext(null),jo="button",Bm="Draggable";function Gr(e){let{id:t,data:r,disabled:s=!1,attributes:n}=e;const a=Us(Bm),{activators:i,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:p}=b.useContext(Kr),{role:h=jo,roleDescription:v="draggable",tabIndex:x=0}=n??{},g=(c==null?void 0:c.id)===t,m=b.useContext(g?Ws:Vm),[w,y]=Cs(),[T,N]=Cs(),_=Tm(i,t),A=Dr(r);_t(()=>(f.set(t,{id:t,key:a,node:w,activatorNode:T,data:A}),()=>{const $=f.get(t);$&&$.key===a&&f.delete(t)}),[f,t]);const S=b.useMemo(()=>({role:h,tabIndex:x,"aria-disabled":s,"aria-pressed":g&&h===jo?!0:void 0,"aria-roledescription":v,"aria-describedby":u.draggable}),[s,h,x,g,v,u.draggable]);return{active:c,activatorEvent:l,activeNodeRect:d,attributes:S,isDragging:g,listeners:s?void 0:_,node:w,over:p,setNodeRef:y,setActivatorNodeRef:N,transform:m}}function Um(){return b.useContext(xl)}const qm="Droppable",Wm={timeout:25};function Jr(e){let{data:t,disabled:r=!1,id:s,resizeObserverConfig:n}=e;const a=Us(qm),{active:i,dispatch:l,over:c,measureDroppableContainers:d}=b.useContext(Kr),u=b.useRef({disabled:r}),f=b.useRef(!1),p=b.useRef(null),h=b.useRef(null),{disabled:v,updateMeasurementsFor:x,timeout:g}={...Wm,...n},m=Dr(x??s),w=b.useCallback(()=>{if(!f.current){f.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{d(Array.isArray(m.current)?m.current:[m.current]),h.current=null},g)},[g]),y=qs({callback:w,disabled:v||!i}),T=b.useCallback((S,$)=>{y&&($&&(y.unobserve($),f.current=!1),S&&y.observe(S))},[y]),[N,_]=Cs(T),A=Dr(t);return b.useEffect(()=>{!y||!N.current||(y.disconnect(),f.current=!1,y.observe(N.current))},[N,y]),b.useEffect(()=>(l({type:Ve.RegisterDroppable,element:{id:s,key:a,disabled:r,node:N,rect:p,data:A}}),()=>l({type:Ve.UnregisterDroppable,key:a,id:s})),[s]),b.useEffect(()=>{r!==u.current.disabled&&(l({type:Ve.SetDroppableDisabled,id:s,key:a,disabled:r}),u.current.disabled=r)},[s,a,r,l]),{active:i,rect:p,isOver:(c==null?void 0:c.id)===s,node:N,over:c,setNodeRef:_}}function Km(e){let{animation:t,children:r}=e;const[s,n]=b.useState(null),[a,i]=b.useState(null),l=As(r);return!r&&!s&&l&&n(l),_t(()=>{if(!a)return;const c=s==null?void 0:s.key,d=s==null?void 0:s.props.id;if(c==null||d==null){n(null);return}Promise.resolve(t(d,a)).then(()=>{n(null)})},[t,s,a]),b.createElement(b.Fragment,null,r,s?b.cloneElement(s,{ref:i}):null)}const Gm={x:0,y:0,scaleX:1,scaleY:1};function Jm(e){let{children:t}=e;return b.createElement(Kr.Provider,{value:gl},b.createElement(Ws.Provider,{value:Gm},t))}const Zm={position:"fixed",touchAction:"none"},Ym=e=>na(e)?"transform 250ms ease":void 0,Hm=b.forwardRef((e,t)=>{let{as:r,activatorEvent:s,adjustScale:n,children:a,className:i,rect:l,style:c,transform:d,transition:u=Ym}=e;if(!l)return null;const f=n?d:{...d,scaleX:1,scaleY:1},p={...Zm,width:l.width,height:l.height,top:l.top,left:l.left,transform:Mr.Transform.toString(f),transformOrigin:n&&s?Uf(s,l):void 0,transition:typeof u=="function"?u(s):u,...c};return b.createElement(r,{className:i,style:p,ref:t},a)}),Xm=e=>t=>{let{active:r,dragOverlay:s}=t;const n={},{styles:a,className:i}=e;if(a!=null&&a.active)for(const[l,c]of Object.entries(a.active))c!==void 0&&(n[l]=r.node.style.getPropertyValue(l),r.node.style.setProperty(l,c));if(a!=null&&a.dragOverlay)for(const[l,c]of Object.entries(a.dragOverlay))c!==void 0&&s.node.style.setProperty(l,c);return i!=null&&i.active&&r.node.classList.add(i.active),i!=null&&i.dragOverlay&&s.node.classList.add(i.dragOverlay),function(){for(const[c,d]of Object.entries(n))r.node.style.setProperty(c,d);i!=null&&i.active&&r.node.classList.remove(i.active)}},Qm=e=>{let{transform:{initial:t,final:r}}=e;return[{transform:Mr.Transform.toString(t)},{transform:Mr.Transform.toString(r)}]},eh={duration:250,easing:"ease",keyframes:Qm,sideEffects:Xm({styles:{active:{opacity:"0"}}})};function th(e){let{config:t,draggableNodes:r,droppableContainers:s,measuringConfiguration:n}=e;return Bs((a,i)=>{if(t===null)return;const l=r.get(a);if(!l)return;const c=l.node.current;if(!c)return;const d=bl(i);if(!d)return;const{transform:u}=Ye(i).getComputedStyle(i),f=ol(u);if(!f)return;const p=typeof t=="function"?t:rh(t);return ml(c,n.draggable.measure),p({active:{id:a,data:l.data,node:c,rect:n.draggable.measure(c)},draggableNodes:r,dragOverlay:{node:i,rect:n.dragOverlay.measure(d)},droppableContainers:s,measuringConfiguration:n,transform:f})})}function rh(e){const{duration:t,easing:r,sideEffects:s,keyframes:n}={...eh,...e};return a=>{let{active:i,dragOverlay:l,transform:c,...d}=a;if(!t)return;const u={x:l.rect.left-i.rect.left,y:l.rect.top-i.rect.top},f={scaleX:c.scaleX!==1?i.rect.width*c.scaleX/l.rect.width:1,scaleY:c.scaleY!==1?i.rect.height*c.scaleY/l.rect.height:1},p={x:c.x-u.x,y:c.y-u.y,...f},h=n({...d,active:i,dragOverlay:l,transform:{initial:c,final:p}}),[v]=h,x=h[h.length-1];if(JSON.stringify(v)===JSON.stringify(x))return;const g=s==null?void 0:s({active:i,dragOverlay:l,...d}),m=l.node.animate(h,{duration:t,easing:r,fill:"forwards"});return new Promise(w=>{m.onfinish=()=>{g==null||g(),w()}})}}let ko=0;function sh(e){return b.useMemo(()=>{if(e!=null)return ko++,ko},[e])}const nh=b.memo(e=>{let{adjustScale:t=!1,children:r,dropAnimation:s,style:n,transition:a,modifiers:i,wrapperElement:l="div",className:c,zIndex:d=999}=e;const{activatorEvent:u,active:f,activeNodeRect:p,containerNodeRect:h,draggableNodes:v,droppableContainers:x,dragOverlay:g,over:m,measuringConfiguration:w,scrollableAncestors:y,scrollableAncestorRects:T,windowRect:N}=Um(),_=b.useContext(Ws),A=sh(f==null?void 0:f.id),S=vl(i,{activatorEvent:u,active:f,activeNodeRect:p,containerNodeRect:h,draggingNodeRect:g.rect,over:m,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:T,transform:_,windowRect:N}),$=da(p),V=th({config:s,draggableNodes:v,droppableContainers:x,measuringConfiguration:w}),z=$?g.setRef:void 0;return b.createElement(Jm,null,b.createElement(Km,{animation:V},f&&A?b.createElement(Hm,{key:A,id:f.id,ref:z,as:l,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:$,style:{zIndex:d,...n},transform:S},r):null))});function ah(){return{label:"Texto",type:"text",width:"w-full md:w-1/2",placeholder:"Escribe…",size:"sm"}}function oh(){return{label:"Número",type:"number",width:"w-full md:w-1/3",placeholder:"0",size:"sm",validation:{required:!1}}}function ih(){return{label:"Email",type:"email",width:"w-full md:w-1/2",placeholder:"usuario@dominio.com",size:"sm"}}function lh(){return{label:"Selecciona una opción",type:"select",width:"w-full md:w-1/3",size:"sm",options:[{label:"Opción A",value:"A"},{label:"Opción B",value:"B"}]}}function ch(){return{label:"Aceptar condiciones",type:"checkbox",width:"w-full md:w-1/3",size:"sm",defaultValue:!1}}function dh(){return{label:"Comentario",type:"textarea",width:"w-full",size:"sm",maxLength:300,showCounter:!0,placeholder:"Escribe tu comentario…"}}function uh(){return{label:"Fecha",type:"date",width:"w-full md:w-1/3",size:"sm",showTime:!1}}function fh(){return{label:"Documento",type:"file",width:"w-full md:w-1/2",maxFiles:1,accept:".pdf,.doc,.docx"}}const mh={text:ah,number:oh,email:ih,select:lh,checkbox:ch,textarea:dh,date:uh,file:fh},hh=()=>o.jsx(we,{label:"Texto",placeholder:"Escribe…",size:"sm",reserveErrorSpace:!1}),ph=()=>o.jsx(we,{type:"number",label:"Número",placeholder:"0",size:"sm",reserveErrorSpace:!1}),bh=()=>o.jsx(we,{type:"email",label:"Email",placeholder:"usuario@dominio.com",size:"sm",reserveErrorSpace:!1}),gh=()=>o.jsx(rt,{label:"Select",options:[{label:"Opción A",value:"A"},{label:"Opción B",value:"B"}],size:"sm"}),xh=()=>o.jsx(dt,{label:"Aceptar condiciones",defaultValue:!1,name:"__prev_checkbox__"}),vh=()=>o.jsx(Ls,{label:"Comentario",placeholder:"Escribe tu comentario…",size:"sm",maxLength:120,showCounter:!0}),yh=()=>o.jsx(Fr,{label:"Fecha",defaultValue:"",showTime:!1,name:"__prev_date__"}),wh=()=>o.jsxs("div",{children:[o.jsx("label",{className:"text-ds-xs block mb-1 opacity-80",children:"Documento"}),o.jsx("div",{className:"w-full rounded-xl border border-dashed p-4 text-ds-xs opacity-70",children:"Arrastra o selecciona archivo…"})]}),jh=()=>o.jsx("div",{className:"p-2 rounded-md bg-[var(--color-ds-background-page)]",children:o.jsx(Ir,{options:[{label:"Tab 1",value:"t1"},{label:"Tab 2",value:"t2"}],value:"t1",onChange:()=>{},children:{t1:o.jsx("div",{className:"text-ds-sm opacity-80",children:"Contenido ejemplo 1"}),t2:o.jsx("div",{className:"text-ds-sm opacity-80",children:"Contenido ejemplo 2"})}})}),kh=()=>o.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",children:[o.jsx("div",{className:"px-3 py-2 border-b border-[var(--color-ds-border-default-50)] text-ds-sm",children:"Sección"}),o.jsx("div",{className:"p-3 text-ds-xs opacity-70",children:"Fila con 1 columna (w-full). Modifícala desde el lienzo."})]}),is=[{kind:"text",title:"Texto",category:"basics",renderPreview:o.jsx(hh,{}),detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Props: ",o.jsx("code",{children:"placeholder"}),", ",o.jsx("code",{children:"size"}),", ",o.jsx("code",{children:"width"}),", ",o.jsx("code",{children:"info"})]}),o.jsxs("li",{children:["Validación: ",o.jsx("code",{children:"required"}),", ",o.jsx("code",{children:"minLength"}),", ",o.jsx("code",{children:"maxLength"}),", ",o.jsx("code",{children:"pattern"})]})]})},{kind:"number",title:"Número",category:"basics",renderPreview:o.jsx(ph,{}),detail:o.jsx("ul",{className:"list-disc pl-4 space-y-1",children:o.jsxs("li",{children:["Validación: ",o.jsx("code",{children:"numberMin"}),", ",o.jsx("code",{children:"numberMax"}),", ",o.jsx("code",{children:"step"}),", ",o.jsx("code",{children:"integerOnly"}),", ",o.jsx("code",{children:"positiveOnly"})]})})},{kind:"email",title:"Email",category:"basics",renderPreview:o.jsx(bh,{}),detail:o.jsx("ul",{className:"list-disc pl-4 space-y-1",children:o.jsx("li",{children:"Preset de patrón disponible"})})},{kind:"select",title:"Select",category:"basics",renderPreview:o.jsx(gh,{}),hint:"Admite optionSource",detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Opciones: ",o.jsx("code",{children:"options"})," o ",o.jsx("code",{children:"optionSource"})]}),o.jsxs("li",{children:["Default: ",o.jsx("code",{children:"defaultSource"})]}),o.jsxs("li",{children:["Soporta ",o.jsx("code",{children:"multiple"})," y ",o.jsx("code",{children:"adapterCtx"})]})]})},{kind:"checkbox",title:"Checkbox",category:"basics",renderPreview:o.jsx(xh,{}),detail:o.jsx("ul",{className:"list-disc pl-4 space-y-1",children:o.jsxs("li",{children:["Devuelve ",o.jsx("code",{children:"boolean"})]})})},{kind:"date",title:"Fecha",category:"basics",renderPreview:o.jsx(yh,{}),detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Prop: ",o.jsx("code",{children:"showTime"})]}),o.jsxs("li",{children:["Validación: ",o.jsx("code",{children:"dateMin"}),", ",o.jsx("code",{children:"dateMax"}),", ",o.jsx("code",{children:"disallowPast"}),", ",o.jsx("code",{children:"disallowFuture"})]})]})},{kind:"textarea",title:"Textarea",category:"content",renderPreview:o.jsx(vh,{}),detail:o.jsx("ul",{className:"list-disc pl-4 space-y-1",children:o.jsxs("li",{children:["Props: ",o.jsx("code",{children:"maxLength"}),", ",o.jsx("code",{children:"showCounter"})]})})},{kind:"file",title:"Archivo",category:"content",renderPreview:o.jsx(wh,{}),detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Props: ",o.jsx("code",{children:"accept"}),", ",o.jsx("code",{children:"maxFiles"})]}),o.jsxs("li",{children:["Validación: ",o.jsx("code",{children:"fileMaxSizeMB"})]})]})},{kind:"section-layout",title:"Sección",category:"layout",renderPreview:o.jsx(kh,{}),isLayout:!0,hint:"Contenedor de layout",detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsx("li",{children:"Inserta un bloque de filas/columnas (rows) con una fila vacía."}),o.jsx("li",{children:"Después puedes añadir columnas y colocar campos."})]})},{kind:"tabs-layout",title:"Pestañas",category:"layout",renderPreview:o.jsx(jh,{}),isLayout:!0,hint:"Contenedor de layout (no es un campo)",detail:o.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[o.jsxs("li",{children:["Inserta un contenedor de ",o.jsx("code",{children:"tabs"})," en el layout."]}),o.jsx("li",{children:"Cada pestaña contiene sus propias secciones y filas."}),o.jsx("li",{children:"Útil para agrupar campos por temática."})]})}];function yl({title:e,onAdd:t,onInfo:r,dragging:s=!1}){return o.jsxs("div",{className:["hover:text-[var(--color-ds-text-on-accent)] relative",s?"opacity-70":""].join(" "),children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:t,className:["w-full rounded-xl p-2 text-left justify-start","border-dashed ring-1 ring-inset ring-[var(--color-ds-border-default-50)] hover:ring-[var(--color-ds-border-default)] hover:shadow-sm","cursor-grab active:cursor-grabbing"].join(" "),title:`Añadir ${e}`,"aria-label":`Añadir ${e}`,children:o.jsx("div",{className:"text-ds-sm",children:e})}),o.jsx("div",{className:"absolute top-1 right-1",children:o.jsx(Yn,{size:"sm",position:"right",ariaLabel:`Más info de ${e}`,onClick:r,children:o.jsxs("div",{className:"max-w-[240px]",children:["Pulsa para ver un ejemplo y detalles de ",o.jsx("strong",{children:e}),"."]})})})]})}function No({kind:e,title:t,onAdd:r,onInfo:s}){const{attributes:n,listeners:a,setNodeRef:i,isDragging:l}=Gr({id:`palette:${e}:${t}`,data:{kind:"palette-field",factoryKind:e}});return o.jsx("div",{ref:i,...n,...a,role:"button","aria-label":`Arrastrar ${t}`,className:"touch-none select-none",children:o.jsx(yl,{title:t,onAdd:r,onInfo:s,dragging:l})})}function Nh(){var x;const e=J(g=>g.addField),t=J(g=>g.addTabsContainerAt),r=J(g=>g.addRowsBlockAt),s=J(g=>g.schema),{show:n}=Vr(),[a,i]=b.useState(""),[l,c]=b.useState(null),d=b.useMemo(()=>is.filter(g=>g.category==="basics"&&g.title.toLowerCase().includes(a.toLowerCase())),[a]),u=b.useMemo(()=>is.filter(g=>g.category==="content"&&g.title.toLowerCase().includes(a.toLowerCase())),[a]),f=b.useMemo(()=>is.filter(g=>g.category==="layout"&&g.title.toLowerCase().includes(a.toLowerCase())),[a]),p=b.useMemo(()=>is.find(g=>g.kind===l)??null,[l]),h=b.useCallback(g=>{const m=mh[g];if(!m){n("Tipo de campo no soportado.","warning");return}const w=m();e(w),n(`Añadido “${w.label}”. Ahora arrástralo al formulario o usa “Colocar último campo”.`,"success")},[e,n]),v=b.useCallback(g=>{var w;const m=((w=s==null?void 0:s.layout)==null?void 0:w.length)??0;if(g==="section-layout"){typeof r=="function"?(r(m,"Nueva sección"),n("Sección añadida al layout.","success")):n("Acción addRowsBlockAt no disponible en el store.","warning");return}if(g==="tabs-layout"){typeof t=="function"?(t(m),n("Contenedor de pestañas añadido al layout.","success")):n("Acción addTabsContainerAt no disponible en el store.","warning");return}n("Tipo de layout no soportado.","warning")},[(x=s==null?void 0:s.layout)==null?void 0:x.length,r,t,n]);if(p){const g=!!p.isLayout;return o.jsxs("aside",{className:"border-r bg-[var(--color-ds-background-page)] custom-scroll min-h-0 text-[var(--color-ds-text-primary)]",children:[o.jsxs("div",{className:"px-4 py-3 border-b border-[var(--color-ds-border-default-50)] flex items-center",children:[o.jsx("h3",{className:"font-semibold text-[1rem] flex-1 truncate",children:p.title}),o.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>c(null),className:"ml-auto",children:"← Volver"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"border border-[var(--color-ds-border-default-50)] p-4 bg-[var(--color-ds-background-surface)]",children:p.renderPreview}),o.jsxs("div",{className:"p-2",children:[o.jsxs("div",{className:"flex items-center gap-2 justify-center mb-4",children:[o.jsx(ie,{size:"sm",variant:"primary",onClick:()=>g?v(p.kind):h(p.kind),title:"Añadir rápidamente",children:"Añadir al lienzo"}),o.jsx("span",{className:"text-ds-xs opacity-70",children:"o arrástrame al formulario"})]}),o.jsxs("div",{className:"rounded-xl border border-[var(--color-ds-border-default-50)] p-3",children:[o.jsxs("div",{className:"text-ds-sm text-[var(--color-ds-text-secondary)] mb-2",children:["Acerca de ",o.jsx("strong",{children:p.title})]}),o.jsxs("div",{className:"text-ds-sm space-y-2",children:[p.hint?o.jsx("div",{className:"opacity-80",children:p.hint}):null,p.detail]})]})]})]})]})}return o.jsxs("aside",{className:"bg-[var(--color-ds-background-page)] custom-scroll min-h-0 text-[var(--color-ds-text-primary)]",children:[o.jsxs("div",{className:"px-4 py-3 border-b border-[var(--color-ds-border-default-50)]",children:[o.jsx("h3",{className:"font-semibold text-[1rem]",children:"Paleta"}),o.jsxs("p",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm mt-1",children:["Clic en una tarjeta para ",o.jsx("strong",{children:"añadir"})," al catálogo, o ",o.jsx("strong",{children:"arrastra"})," al formulario para colocar. Usa el icono"," ",o.jsx(Po,{className:"inline w-4 h-4 align-[-2px]"})," para ver detalles."]}),o.jsx("div",{className:"mt-3",children:o.jsx(we,{size:"sm",placeholder:"Buscar componente…",value:a,onChange:g=>i(g.target.value),reserveErrorSpace:!1})})]}),o.jsxs("div",{className:"p-4 space-y-6",children:[o.jsxs("section",{className:"space-y-3",children:[o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm font-medium",children:"Inputs básicos"}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.map(g=>o.jsx(No,{kind:g.kind,title:g.title,onAdd:()=>h(g.kind),onInfo:()=>c(g.kind)},g.kind)),d.length===0&&o.jsx("div",{className:"col-span-2 text-ds-xs opacity-60",children:"No hay resultados."})]})]}),o.jsxs("section",{className:"space-y-3",children:[o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm font-medium",children:"Contenido"}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.map(g=>o.jsx(No,{kind:g.kind,title:g.title,onAdd:()=>h(g.kind),onInfo:()=>c(g.kind)},g.kind)),u.length===0&&o.jsx("div",{className:"col-span-2 text-ds-xs opacity-60",children:"No hay resultados."})]})]}),o.jsxs("section",{className:"space-y-3",children:[o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm font-medium",children:"Estructura"}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[f.map(g=>o.jsx(yl,{title:g.title,onAdd:()=>g.isLayout?v(g.kind):h(g.kind),onInfo:()=>c(g.kind)},g.kind)),f.length===0&&o.jsx("div",{className:"col-span-2 text-ds-xs opacity-60",children:"No hay resultados."})]})]})]})]})}function wl(e){const t=e.trim();if(/^(true|false)$/i.test(t))return t.toLowerCase()==="true";const r=Number(t);return!Number.isNaN(r)&&t!==""?r:t}function Sh(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0).map(wl)}function ls(e){return typeof e=="boolean"?e?"true":"false":typeof e=="number"?String(e):typeof e=="string"?e:""}const mn=(e,t)=>JSON.stringify(e??null)===JSON.stringify(t??null);function Eh({value:e,onChange:t,fieldOptions:r}){const s=b.useRef(t);b.useEffect(()=>{s.current=t},[t]);const[n,a]=b.useState((e==null?void 0:e.op)??"eq"),[i,l]=b.useState(e&&"field"in e&&typeof e.field=="string"?e.field:""),[c,d]=b.useState(e&&"value"in e?ls(e.value):""),[u,f]=b.useState(e&&"values"in e&&Array.isArray(e.values)?e.values.map(ls).join(","):""),p=(N={})=>{const _=N.op??n,A=N.field??i,S=N.val??c,$=N.vals??u;if(!A)return;if(_==="in"||_==="notIn"){const z=Sh($);return _==="in"?{op:"in",field:A,values:z}:{op:"notIn",field:A,values:z}}const V=S.trim()===""?"":wl(S);return{op:_,field:A,value:V}},h=()=>p({}),v=b.useRef(!1);b.useEffect(()=>{const N=h();if(mn(e,N))return;if(v.current=!0,!e){a("eq"),l(""),d(""),f(""),v.current=!1;return}const _=e.op??"eq";a(_),l("field"in e&&typeof e.field=="string"?e.field:""),_==="in"||_==="notIn"?(f("values"in e&&Array.isArray(e.values)?e.values.map(ls).join(","):""),d("")):(f(""),d("value"in e?ls(e.value):"")),v.current=!1},[e]);const x=b.useRef(void 0),g=b.useRef(null),m=N=>{v.current||N&&(mn(x.current,N)||(x.current=N,s.current(N)))},w=()=>{if(v.current)return;const N=h();N&&(mn(x.current,N)||(g.current&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{x.current=N,s.current(N)},200)))};b.useEffect(()=>()=>{g.current&&window.clearTimeout(g.current)},[]);const y=b.useMemo(()=>[{value:"eq",label:"igual a"},{value:"neq",label:"distinto de"},{value:"in",label:"en lista"},{value:"notIn",label:"no en lista"},{value:"gt",label:"mayor que"},{value:"gte",label:"mayor o igual"},{value:"lt",label:"menor que"},{value:"lte",label:"menor o igual"}],[]),T=b.useMemo(()=>[{label:"— campo —",value:""},...r],[r]);return o.jsxs("div",{className:"space-y-2",children:[o.jsx(rt,{label:"Operador",value:n,onChange:N=>{const _=N;a(_),_==="in"||_==="notIn"?d(""):f(""),m(p({op:_,val:_==="in"||_==="notIn"?"":c,vals:_==="in"||_==="notIn"?u:""}))},options:y,size:"sm",coerceFirstValid:!1,reserveErrorSpace:!1}),o.jsx(rt,{label:"Campo",value:i,onChange:N=>{const _=N;l(_),m(p({field:_}))},options:T,size:"sm",coerceFirstValid:!1,reserveErrorSpace:!1}),n==="in"||n==="notIn"?o.jsx(we,{size:"sm",label:"Valores (coma)",placeholder:"valor1, valor2, ...",value:u,onChange:N=>{f(N.target.value),w()},reserveErrorSpace:!1}):o.jsx(we,{size:"sm",label:"Valor",placeholder:"true/false, 123, texto",value:c,onChange:N=>{d(N.target.value),w()},reserveErrorSpace:!1})]})}const Ch=["w-full","w-1/2","w-1/3","w-2/3","w-1/4","w-3/4","w-full md:w-1/2","w-full md:w-1/3","w-full md:w-1/4"],Ah=["sm","md","lg"],Th=[{value:"text",label:"Texto"},{value:"number",label:"Número"},{value:"email",label:"Email"},{value:"password",label:"Password"},{value:"textarea",label:"Textarea"},{value:"select",label:"Select"},{value:"checkbox",label:"Checkbox"},{value:"date",label:"Fecha"},{value:"file",label:"Archivo"}],_h=e=>(e==null?void 0:e.enabled)??!!(e!=null&&e.rule),So=(e,t)=>({...e??{},enabled:t}),Fh=(e,t)=>({...e??{},rule:t}),Oh=(e,t)=>({...e??{},clearTo:t}),Rh=e=>{try{return JSON.stringify(e,null,2)}catch{return""}};async function Dh(){try{const e=await navigator.clipboard.readText(),t=JSON.parse(e);if(t&&typeof t=="object"&&"op"in t)return t}catch{}}function Mh(e){return typeof e=="number"||typeof e=="string"||e instanceof Date}function jl(e,t){if(!e)return{ok:!1,reason:"Sin regla"};if(!("op"in e))return{ok:!1,reason:"Operador inválido"};if(e.op==="and"||e.op==="or"){if(!Array.isArray(e.rules)||e.rules.length===0)return{ok:!1,reason:`Lista de reglas vacía en "${e.op}"`};for(const r of e.rules){const s=jl(r,t);if(!s.ok)return s}return{ok:!0}}if(!e.field||typeof e.field!="string")return{ok:!1,reason:"Campo no especificado"};if(!t.includes(e.field))return{ok:!1,reason:`Campo "${e.field}" no existe`};switch(e.op){case"eq":case"neq":return"value"in e?{ok:!0}:{ok:!1,reason:"Valor requerido"};case"in":case"notIn":return Array.isArray(e.values)&&e.values.length>0?{ok:!0}:{ok:!1,reason:"Lista de valores vacía"};case"gt":case"gte":case"lt":case"lte":return"value"in e?Mh(e.value)?{ok:!0}:{ok:!1,reason:"Valor no comparable (número, string o Date)"}:{ok:!1,reason:"Valor requerido"};default:return{ok:!1,reason:`Operador no soportado: ${e.op}`}}}function $h(e,t){for(let r=0;r<e.layout.length;r++){const s=e.layout[r];if((s==null?void 0:s.type)!=="tabs")continue;const n=s.tabs.findIndex(a=>a.key===t);if(n>=0)return{nodeIdx:r,tabIdx:n,node:s,tab:s.tabs[n]}}return null}function Lh(){var k,I,U,G,ee,M,W,me,be,de,ke,ge,he,fe,pe,ye,ce,Se,Te,j,F,R,X,Y,Z,ue,xe,je,Fe,vt,Me,Vt,Ft,Ot,Rt,Dt,rr,Mt;const e=J(O=>O.selection),t=J(O=>O.schema),r=J(O=>O.updateField),s=J(O=>O.removeField),n=J(O=>O.renameField),a=J(O=>O.duplicateField),i=J(O=>O.changeFieldType),l=J(O=>O.addTabAfter),c=J(O=>O.removeTab),d=J(O=>O.renameTab),u=J(O=>O.moveTab),f=J(O=>O.addSectionToTab),{services:p}=$s(),{show:h}=Vr(),v=i??((O,L)=>r(O,Q=>{Q.type=L})),x=b.useMemo(()=>t.fields.map(O=>O.name).filter(Boolean).map(O=>({label:O,value:O})),[t.fields]),g=b.useMemo(()=>x.map(O=>O.value),[x]),m=b.useMemo(()=>{if(e.kind==="field")return t.fields.find(O=>O.name===e.name)},[e,t.fields]),w=(m==null?void 0:m.type)==="select",y=(m==null?void 0:m.type)==="textarea",T=(m==null?void 0:m.type)==="file",N=(m==null?void 0:m.type)==="date",_=(m==null?void 0:m.type)==="number",A=b.useMemo(()=>Object.keys((p==null?void 0:p.registry)??{}),[p]),S=b.useMemo(()=>[{label:"— ninguno —",value:""},...A.map(O=>({label:O,value:O}))],[A]),[$,V]=b.useState(!1),[z,q]=b.useState(null),[D,P]=b.useState([]),[E,te]=b.useState(""),ne=async()=>{var Q;const O=m==null?void 0:m.optionSource;if(!O){q("Debes elegir una clave en 'Option source'."),h("Elige la clave del adapter en 'Option source'.","warning");return}const L=(Q=p==null?void 0:p.registry)==null?void 0:Q[O];if(typeof L!="function"){q(`No existe un provider en services.registry["${O}"]`),h(`Provider no encontrado: ${O}`,"error");return}V(!0),q(null);try{let B;if(E.trim())try{B=JSON.parse(E)}catch{q("Contexto JSON inválido."),h("Contexto JSON inválido.","error"),V(!1);return}const Ne=B!=null?{getValues:()=>B}:void 0,Le=await Promise.resolve(L("",Ne)),Oe=Array.isArray(Le)?Le:[];P(Oe),h(Oe.length?`Cargadas ${Oe.length} opciones.`:"El adapter devolvió 0 opciones.",Oe.length?"success":"info")}catch(B){q((B==null?void 0:B.message)||String(B)),h("Error al cargar opciones desde adapter.","error")}finally{V(!1)}},K=()=>{m!=null&&m.name&&(r(m.name,O=>{O.options=[...D],delete O.optionSource,delete O.loadOptions}),h("Opciones copiadas al campo (options).","success"))},le=({title:O,fieldKey:L,showClearTo:Q})=>{const B=(m==null?void 0:m[L])??{},Ne=_h(B),Le=Rh(B.rule??null),Oe=Ee=>r(m.name,Wt=>{Wt[L]=Ee}),[He,We]=b.useState(""),Ke=b.useRef(null),Ge=Ee=>{Ke.current&&window.clearTimeout(Ke.current),We(Ee),Ke.current=window.setTimeout(()=>We(""),1500)};b.useEffect(()=>()=>{Ke.current!=null&&window.clearTimeout(Ke.current)},[]);const Pe=Ee=>{var sr;if(Ee.rule)return Ee;const Wt=((sr=x[0])==null?void 0:sr.value)??"";return{...Ee,rule:{op:"eq",field:Wt,value:!0}}},yt=Ee=>{Oe(Ee?Pe(So(B,Ee)):So(B,Ee)),Ge(Ee?"Regla activada":"Regla desactivada"),h(Ee?"Regla activada":"Regla desactivada","info")},at=Ee=>{Oe(Fh(B,Ee)),Ge("Regla actualizada")},ft=Ee=>{Oe(Oh(B,Ee)),Ge("clearTo actualizado"),h("clearTo actualizado","info")},Bt="__quick_placeholder__",Ut=Ee=>{var ua;if(!Ee||Ee===Bt)return;const Wt=((ua=x[0])==null?void 0:ua.value)??"",sr={...B??{},enabled:!0};Ee==="eq:true"&&Oe({...sr,rule:{op:"eq",field:Wt,value:!0}}),Ee==="eq:false"&&Oe({...sr,rule:{op:"eq",field:Wt,value:!1}}),Ee==="eq:empty"&&Oe({...sr,rule:{op:"eq",field:Wt,value:""}}),Ge("Atajo aplicado"),h("Atajo aplicado","success")},wt=async()=>{try{await navigator.clipboard.writeText(Le||""),Ge("Copiado"),h("Regla copiada al portapapeles","success")}catch{Ge("No se pudo copiar"),h("No se pudo copiar al portapapeles","error")}},qt=async()=>{const Ee=await Dh();Ee?(Oe({...B??{},enabled:!0,rule:Ee}),Ge("Pegado"),h("Regla pegada desde portapapeles","success")):(Ge("Portapapeles no válido"),h("El contenido del portapapeles no es una regla válida","warning"))},xr=()=>{at(void 0),Ge("Regla borrada"),h("Regla borrada","info")},Zr=jl(B.rule,g),kl=Ne?Zr.ok?"text-[var(--color-success-600)]":"text-[var(--color-danger-600)]":"text-[var(--color-ds-text-secondary)]",Nl=Ne?Zr.ok?"border-[var(--color-success-400)]":"border-[var(--color-danger-400)]":"border-[var(--color-ds-border-default-50)]";return o.jsxs("div",{className:"rounded-md border border-[var(--color-ds-border-default-50)] p-2 space-y-2",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(dt,{size:"sm",checked:Ne,onChange:yt,label:O}),o.jsxs("span",{className:`ml-2 flex items-center gap-1 text-[11px] ${kl}`,children:[o.jsx("span",{className:"inline-block w-2 h-2 rounded-full border border-black/10 bg-current opacity-70"}),Ne?Zr.ok?"OK":Zr.reason:"Inactiva"]})]})}),o.jsx("div",{className:"text-[11px] h-4 text-[var(--color-ds-text-secondary)]","aria-live":"polite",children:He||o.jsx("span",{"aria-hidden":"true",children:" "})}),o.jsx(rt,{label:"Atajo rápido",value:"__quick_placeholder__",onChange:Ee=>Ut(Ee),options:[{label:"— Atajo rápido —",value:"__quick_placeholder__"},{label:"Campo = true",value:"eq:true"},{label:"Campo = false",value:"eq:false"},{label:"Campo = '' (vacío)",value:"eq:empty"}],size:"sm",reserveErrorSpace:!1}),o.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:wt,title:"Copiar JSON",children:"Copiar"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:qt,title:"Pegar JSON",children:"Pegar"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:xr,title:"Borrar regla",children:"Borrar"})]}),o.jsx("div",{className:Ne?"":"opacity-60 pointer-events-none",children:o.jsx(Eh,{value:B.rule,fieldOptions:x,onChange:Ee=>at(Ee)})}),o.jsx("div",{className:`rounded p-2 bg-[var(--color-ds-background-surface)] border ${Nl}`,children:o.jsx("pre",{className:"m-0 text-[11px] leading-snug whitespace-pre-wrap break-all text-[var(--color-ds-text-primary)]",children:Le||"—"})}),Q&&o.jsx(we,{label:"clearTo",value:B.clearTo??"",onChange:Ee=>ft(Ee.target.value)})]})};if(e.kind==="tab"){const O=$h(t,e.tabKey);if(!O)return o.jsx("div",{className:"p-3 text-[var(--color-ds-text-secondary)]",children:"Pestaña no encontrada."});const{tab:L}=O,[Q,B]=b.useState(L.label??"");return b.useEffect(()=>{B(L.label??"")},[L.label]),o.jsxs("div",{className:"pl-2 pt-4 border-l border-[var(--color-ds-border-default)] space-y-4 custom-scroll overflow-auto",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"font-medium text-ds-md text-[var(--color-ds-text-primary)]",children:"Inspector de pestaña"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>u(e.tabKey,"left"),children:"← Mover"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>u(e.tabKey,"right"),children:"Mover →"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>l(e.tabKey),children:"+ Pestaña a la derecha"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>c(e.tabKey),children:"Eliminar pestaña"})]})]}),o.jsx(it,{title:"Identidad",type:"plain",defaultOpen:!0,children:o.jsx("div",{className:"grid gap-2",children:o.jsx(we,{size:"sm",label:"Label de la pestaña",value:Q,onChange:Ne=>B(Ne.target.value),onBlur:()=>d(e.tabKey,Q)})})}),o.jsx(it,{title:"Estructura",type:"plain",defaultOpen:!0,children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>f(e.tabKey),children:"+ Añadir sección"}),o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm",children:"Esta acción agrega una sección con una fila y una columna vacía dentro de la pestaña."})]})}),o.jsx("div",{className:"text-[var(--color-ds-text-secondary)] text-ds-sm",children:"Selecciona una sección o un campo para ver sus propiedades específicas."})]})}if(e.kind!=="field")return o.jsx("div",{className:"p-3 text-[var(--color-ds-text-secondary)]",children:"Selecciona un campo o una pestaña…"});if(!m)return o.jsx("div",{className:"p-3 text-[var(--color-ds-text-secondary)]",children:"Campo no encontrado."});const C=O=>{r(m.name,L=>{var Ne;const Q=(Ne=L.validation)==null?void 0:Ne.pattern;if(O==="none"){L.validation={...L.validation??{},pattern:void 0};return}const B=O==="email"?/^[^\s@]+@[^\s@]+\.[^\s@]+$/:/^\+?\d{7,15}$/;L.validation={...L.validation??{},pattern:{value:B,message:(Q==null?void 0:Q.message)||(O==="email"?"Email inválido":"Teléfono inválido")}}}),h(O==="none"?"Patrón eliminado":"Patrón aplicado","info")};return o.jsxs("div",{className:"pl-2 pt-4 border-l border-[var(--color-ds-border-default)] space-y-4 custom-scroll overflow-auto",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"font-medium text-ds-md text-[var(--color-ds-text-primary)]",children:"Inspector"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>a(m.name,`${m.name}`),children:"Duplicar"}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>s(m.name),children:"Eliminar"})]})]}),o.jsxs(it,{title:"Identidad",type:"plain",defaultOpen:!0,children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(we,{size:"sm",label:"Name",value:m.name??"",onChange:O=>n(m.name,O.target.value)}),o.jsx(we,{size:"sm",label:"Label",value:m.label??"",onChange:O=>r(m.name,L=>{L.label=O.target.value})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(rt,{label:"Tipo",value:m.type,onChange:O=>v(m.name,O),options:Th}),o.jsx(we,{size:"sm",label:"Info (tooltip/ayuda)",value:m.info??"",onChange:O=>r(m.name,L=>{L.info=O.target.value})})]})]}),o.jsx(it,{title:"Layout",type:"plain",defaultOpen:!0,children:o.jsxs("div",{className:"grid gap-2",children:[o.jsx(rt,{label:"Width",value:m.width??"",onChange:O=>r(m.name,L=>{L.width=O}),options:[{label:"— custom —",value:""},...Ch.map(O=>({label:O,value:O}))]}),o.jsx(rt,{label:"Size",value:m.size??"sm",onChange:O=>r(m.name,L=>{L.size=O}),options:Ah.map(O=>({label:O,value:O}))}),!["checkbox","file"].includes(m.type)&&o.jsx(we,{size:"sm",label:"Placeholder",value:m.placeholder??"",onChange:O=>r(m.name,L=>{L.placeholder=O.target.value})})]})}),w&&o.jsxs(it,{title:"Select",type:"plain",defaultOpen:!0,children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(rt,{label:"Option source (registry key)",value:m.optionSource??"",onChange:O=>r(m.name,L=>{L.optionSource=O||void 0,L.optionSource&&(delete L.options,delete L.loadOptions)}),options:S}),o.jsx(we,{size:"sm",label:"Contexto (JSON) para adapter (opcional)",placeholder:'{"cifOrga":"A12345678","tipoContrato":"OB"}',value:E,onChange:O=>te(O.target.value)}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ie,{size:"sm",variant:"outline",onClick:ne,disabled:$||!A.length,children:$?"Cargando…":"Cargar opciones"}),!!D.length&&o.jsx(ie,{size:"sm",variant:"outline",onClick:K,title:"Copiar vista previa a options",children:"Aplicar al campo"})]}),z&&o.jsx("div",{className:"text-xs text-[var(--color-ds-text-primary)]",children:z}),!!D.length&&o.jsxs("div",{className:"rounded border p-2 max-h-40 overflow-auto border-[var(--color-ds-border-default-50)]",children:[o.jsxs("div",{className:"text-[11px] mb-1 opacity-70",children:["Vista previa (",D.length,"):"]}),o.jsxs("ul",{className:"text-[12px] space-y-1",children:[D.slice(0,50).map((O,L)=>o.jsxs("li",{children:[o.jsx("code",{className:"opacity-70",children:O.value})," — ",O.label]},`${O.value}-${L}`)),D.length>50&&o.jsx("li",{className:"opacity-60 text-[11px]",children:"… (truncado)"})]})]})]}),o.jsxs("div",{className:"pt-2 space-y-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)]",children:"Opciones estáticas (se ignoran si defines optionSource)"}),(m.options??[]).map((O,L)=>o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsx(we,{size:"sm",label:"Etiqueta",value:O.label??"",onChange:Q=>r(m.name,B=>{const Ne=Array.isArray(B.options)?[...B.options]:[];Ne[L]={...Ne[L],label:Q.target.value},B.options=Ne})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{size:"sm",label:"Valor",value:O.value??"",onChange:Q=>r(m.name,B=>{const Ne=Array.isArray(B.options)?[...B.options]:[];Ne[L]={...Ne[L],value:Q.target.value},B.options=Ne})}),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>r(m.name,Q=>{const B=Array.isArray(Q.options)?[...Q.options]:[];B.splice(L,1),Q.options=B}),"aria-label":"Eliminar opción",title:"Eliminar opción",children:"✕"})]})]},L)),o.jsx(ie,{size:"sm",variant:"outline",onClick:()=>r(m.name,O=>{const L=Array.isArray(O.options)?[...O.options]:[];L.push({label:"Opción",value:`opt_${L.length+1}`}),O.options=L}),children:"+ Añadir opción"})]}),o.jsx("div",{className:"pt-2",children:o.jsx(dt,{size:"sm",label:"Múltiple",checked:!!m.multiple,onChange:O=>r(m.name,L=>{L.multiple=O})})})]}),y&&o.jsxs(it,{title:"Textarea",type:"plain",defaultOpen:!0,children:[o.jsx(we,{size:"sm",type:"number",label:"Máx. caracteres",value:m.maxLength??"",onChange:O=>r(m.name,L=>{const Q=O.target.value;L.maxLength=Q?Number(Q):void 0}),className:"w-32"}),o.jsx(dt,{size:"sm",label:"Mostrar contador",checked:!!m.showCounter,onChange:O=>r(m.name,L=>{L.showCounter=O})})]}),T&&o.jsxs(it,{title:"Archivo",type:"plain",defaultOpen:!0,children:[o.jsx(we,{size:"sm",label:"Extensiones permitidas (accept)",placeholder:".pdf,.jpg",value:m.accept??"",onChange:O=>r(m.name,L=>{L.accept=O.target.value})}),o.jsx(we,{size:"sm",type:"number",label:"Máx. ficheros",value:m.maxFiles??"",onChange:O=>r(m.name,L=>{const Q=O.target.value;L.maxFiles=Q?Number(Q):void 0}),className:"w-32"})]}),N&&o.jsx(it,{title:"Fecha",type:"plain",defaultOpen:!0,children:o.jsx(dt,{size:"sm",label:"Incluir hora",checked:!!m.showTime,onChange:O=>r(m.name,L=>{L.showTime=O})})}),o.jsx(it,{title:"Reglas",type:"plain",defaultOpen:!0,children:o.jsxs("div",{className:"space-y-3",children:[o.jsx(le,{title:"visibleWhen",fieldKey:"visibleWhen"}),o.jsx(le,{title:"disabledWhen",fieldKey:"disabledWhen"}),o.jsx(le,{title:"clearWhen",fieldKey:"clearWhen",showClearTo:!0})]})}),o.jsxs(it,{title:"Validación",type:"plain",defaultOpen:!0,children:[o.jsx(dt,{size:"sm",label:"Requerido",checked:!!((k=m.validation)!=null&&k.required),onChange:O=>r(m.name,L=>{L.validation={...L.validation??{},required:O}})}),o.jsx("div",{className:"grid gap-2",children:o.jsx(rt,{label:"Preset de patrón",value:"__none__",onChange:O=>C(O==="email"?"email":O==="phone"?"phone":"none"),options:[{label:"— ninguno —",value:"__none__"},{label:"Email básico",value:"email"},{label:"Teléfono (+999…)",value:"phone"}],size:"sm",reserveErrorSpace:!1})}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pb-1",children:"minLength"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{type:"number",value:((U=(I=m.validation)==null?void 0:I.minLength)==null?void 0:U.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},minLength:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.minLength)==null?void 0:B.message)??"Muy corto"}:void 0}}),className:"w-24"}),o.jsx(we,{placeholder:"mensaje",value:((ee=(G=m.validation)==null?void 0:G.minLength)==null?void 0:ee.message)??"",onChange:O=>r(m.name,L=>{var B;const Q=(B=L.validation)==null?void 0:B.minLength;L.validation={...L.validation??{},minLength:Q?{...Q,message:O.target.value}:{value:0,message:O.target.value}}})})]})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pb-1",children:"maxLength"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{type:"number",value:((W=(M=m.validation)==null?void 0:M.maxLength)==null?void 0:W.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},maxLength:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.maxLength)==null?void 0:B.message)??"Muy largo"}:void 0}}),className:"w-24"}),o.jsx(we,{placeholder:"mensaje",value:((be=(me=m.validation)==null?void 0:me.maxLength)==null?void 0:be.message)??"",onChange:O=>r(m.name,L=>{var B;const Q=(B=L.validation)==null?void 0:B.maxLength;L.validation={...L.validation??{},maxLength:Q?{...Q,message:O.target.value}:{value:0,message:O.target.value}}})})]})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pb-1",children:"pattern (RegExp)"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{placeholder:"^\\\\d+$",value:((ge=(ke=(de=m.validation)==null?void 0:de.pattern)==null?void 0:ke.value)==null?void 0:ge.source)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},pattern:O.target.value?{value:new RegExp(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.pattern)==null?void 0:B.message)??"Formato inválido"}:void 0}})}),o.jsx(we,{placeholder:"mensaje",value:((fe=(he=m.validation)==null?void 0:he.pattern)==null?void 0:fe.message)??"",onChange:O=>r(m.name,L=>{var B;const Q=(B=L.validation)==null?void 0:B.pattern;L.validation={...L.validation??{},pattern:Q?{...Q,message:O.target.value}:{value:/.*/,message:O.target.value}}})})]})]})]}),_&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Número"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{type:"number",label:"min",className:"w-28",value:((ye=(pe=m.validation)==null?void 0:pe.numberMin)==null?void 0:ye.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},numberMin:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.numberMin)==null?void 0:B.message)??"Demasiado pequeño"}:void 0}})}),o.jsx(we,{type:"number",label:"max",className:"w-28",value:((Se=(ce=m.validation)==null?void 0:ce.numberMax)==null?void 0:Se.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},numberMax:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.numberMax)==null?void 0:B.message)??"Demasiado grande"}:void 0}})}),o.jsx(we,{type:"number",label:"step",className:"w-28",value:((j=(Te=m.validation)==null?void 0:Te.step)==null?void 0:j.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},step:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.step)==null?void 0:B.message)??"Incremento inválido"}:void 0}})})]}),o.jsxs("div",{className:"flex gap-4",children:[o.jsx(dt,{size:"sm",label:"Solo enteros",checked:!!((R=(F=m.validation)==null?void 0:F.integerOnly)!=null&&R.value),onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},integerOnly:O?{value:!0,message:((B=(Q=L.validation)==null?void 0:Q.integerOnly)==null?void 0:B.message)??"Debe ser entero"}:void 0}})}),o.jsx(dt,{size:"sm",label:"Solo positivos",checked:!!((Y=(X=m.validation)==null?void 0:X.positiveOnly)!=null&&Y.value),onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},positiveOnly:O?{value:!0,message:((B=(Q=L.validation)==null?void 0:Q.positiveOnly)==null?void 0:B.message)??"Debe ser positivo"}:void 0}})})]})]}),w&&m.multiple&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Select (múltiple)"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(we,{type:"number",label:"mín. seleccionados",className:"w-40",value:((ue=(Z=m.validation)==null?void 0:Z.selectMin)==null?void 0:ue.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},selectMin:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.selectMin)==null?void 0:B.message)??"Selecciona más opciones"}:void 0}})}),o.jsx(we,{type:"number",label:"máx. seleccionados",className:"w-40",value:((je=(xe=m.validation)==null?void 0:xe.selectMax)==null?void 0:je.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},selectMax:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.selectMax)==null?void 0:B.message)??"Demasiadas opciones"}:void 0}})})]})]}),N&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Fecha"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Fr,{size:"sm",label:"minDate",className:"w-44",showTime:!!m.showTime,defaultValue:((vt=(Fe=m.validation)==null?void 0:Fe.dateMin)==null?void 0:vt.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},dateMin:O.target.value?{value:O.target.value,message:((B=(Q=L.validation)==null?void 0:Q.dateMin)==null?void 0:B.message)??"Demasiado antigua"}:void 0}})}),o.jsx(Fr,{size:"sm",label:"maxDate",className:"w-44",showTime:!!m.showTime,defaultValue:((Vt=(Me=m.validation)==null?void 0:Me.dateMax)==null?void 0:Vt.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},dateMax:O.target.value?{value:O.target.value,message:((B=(Q=L.validation)==null?void 0:Q.dateMax)==null?void 0:B.message)??"Demasiado futura"}:void 0}})})]}),o.jsxs("div",{className:"flex gap-4",children:[o.jsx(dt,{size:"sm",label:"No permitir pasado",checked:!!((Ot=(Ft=m.validation)==null?void 0:Ft.disallowPast)!=null&&Ot.value),onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},disallowPast:O?{value:!0,message:((B=(Q=L.validation)==null?void 0:Q.disallowPast)==null?void 0:B.message)??"No se permiten fechas pasadas"}:void 0}})}),o.jsx(dt,{size:"sm",label:"No permitir futuro",checked:!!((Dt=(Rt=m.validation)==null?void 0:Rt.disallowFuture)!=null&&Dt.value),onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},disallowFuture:O?{value:!0,message:((B=(Q=L.validation)==null?void 0:Q.disallowFuture)==null?void 0:B.message)??"No se permiten fechas futuras"}:void 0}})})]})]}),T&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx("div",{className:"text-xs opacity-70 text-[var(--color-ds-text-primary)] pt-2",children:"Archivo"}),o.jsx(we,{type:"number",label:"Tamaño máx. por archivo (MB)",className:"w-56",value:((Mt=(rr=m.validation)==null?void 0:rr.fileMaxSizeMB)==null?void 0:Mt.value)??"",onChange:O=>r(m.name,L=>{var Q,B;L.validation={...L.validation??{},fileMaxSizeMB:O.target.value?{value:Number(O.target.value),message:((B=(Q=L.validation)==null?void 0:Q.fileMaxSizeMB)==null?void 0:B.message)??"Archivo demasiado grande"}:void 0}})})]})]})]})}function Ph(e){return typeof e.type=="string"}function zh(e){const t=e.validation;return t===void 0||typeof t=="object"}function Ih(e){const t=e.options;return Array.isArray(t)}function Vh(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function Lt(e){return String(e).replace(/\\/g,"\\\\").replace(/`/g,"\\`")}function Bh(e){var a,i,l,c,d;const t=Ph(e)&&e.type?e.type:"string";let r="yup.string()";switch(t){case"number":r="yup.number()";break;case"checkbox":r="yup.boolean()";break;case"date":r="yup.date().nullable()";break;case"file":r="yup.array()";break;case"select":case"text":case"email":case"password":case"textarea":default:r="yup.string()";break}const s=zh(e)&&e.validation?e.validation:{},n=[r];if(s.required){const u=typeof s.required=="string"?s.required:s.requiredMessage||"Requerido";n.push(`.required(\`${Lt(u)}\`)`)}if(((a=s.minLength)==null?void 0:a.value)!=null&&n.push(`.min(${Number(s.minLength.value)}, \`${Lt(s.minLength.message??"Muy corto")}\`)`),((i=s.maxLength)==null?void 0:i.value)!=null&&n.push(`.max(${Number(s.maxLength.value)}, \`${Lt(s.maxLength.message??"Muy largo")}\`)`),(l=s.pattern)!=null&&l.value&&Vh(s.pattern.value)){const u=s.pattern.value.source,f=s.pattern.value.flags||"";n.push(`.matches(new RegExp(\`${Lt(u)}\`, \`${Lt(f)}\`), \`${Lt(s.pattern.message??"Formato inválido")}\`)`)}if(t==="number"&&(((c=s.min)==null?void 0:c.value)!=null&&n.push(`.min(${Number(s.min.value)}, \`${Lt(s.min.message??"Demasiado pequeño")}\`)`),((d=s.max)==null?void 0:d.value)!=null&&n.push(`.max(${Number(s.max.value)}, \`${Lt(s.max.message??"Demasiado grande")}\`)`)),t==="select"&&Ih(e)&&e.options&&e.options.length){const u=e.options.map(f=>JSON.stringify(String(f.value)));n.push(`.oneOf([${u.join(", ")}])`)}return n.join("")}function Uh(e,t="validationSchema"){const r=[],s=e.fields??[];for(const i of s){const l=i;!l.name||typeof l.name!="string"||r.push(` ${l.name}: ${Bh(l)},`)}const n=r.join(`
66
66
  `);return`/* eslint-disable */
67
67
  // Auto-generated with generateYupCode(schema)
68
68
  import * as yup from "yup";
@@ -71,12 +71,12 @@ attempted value: ${i}
71
71
  ${n}
72
72
  });
73
73
 
74
- export type FormValues = yup.InferType<typeof ${t}>;`}function So(e,t){const r=new Blob([t],{type:"text/plain;charset=utf-8"}),s=URL.createObjectURL(r),n=document.createElement("a");n.href=s,n.download=e,n.click(),URL.revokeObjectURL(s)}function Uh(e){return e.reduce((t,r)=>r.type==="rows"?t+r.sections.length:t+r.tabs.reduce((s,n)=>s+n.sections.length,0),0)}const mn=e=>e.toLowerCase().endsWith(".json")?e:`${e}.json`,Eo=(e,t)=>`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`;function qh(){var _;const e=J(A=>A.schema),t=J(A=>A.undo),r=J(A=>A.redo),s=J(A=>A.setSchema),n=J(A=>A.resetHistory),a=J(A=>A.past.length),i=J(A=>A.future.length),l=b.useRef(null),{show:c}=Ir(),{fs:d,baseDir:u}=Ms(),f=Uh(e.layout),h=e.fields.length,p=((_=e.title)==null?void 0:_.toString().trim().replace(/\s+/g,"-").toLowerCase())||"form-schema",v=()=>{So(`${p}.json`,JSON.stringify(e,null,2)),c("Esquema exportado como JSON.","success")},g=()=>{try{const A=Bh(e,"validationSchema");So(`${p}.validation.ts`,A),c("Yup exportado como TypeScript.","success")}catch(A){console.error(A),c("No se pudo generar el Yup.","error")}},x=async()=>{try{await navigator.clipboard.writeText(JSON.stringify(e,null,2)),c("JSON copiado al portapapeles.","success")}catch{c("No se pudo copiar al portapapeles.","error")}},m=()=>{var A;return(A=l.current)==null?void 0:A.click()},w=A=>{var z;const S=(z=A.target.files)==null?void 0:z[0];if(!S)return;if(!window.confirm("Vas a reemplazar el esquema actual. ¿Continuar?")){A.currentTarget.value="";return}const V=new FileReader;V.onload=()=>{try{const q=JSON.parse(String(V.result));if(!Array.isArray(q.layout)||!Array.isArray(q.fields)){c("JSON inválido: faltan layout/fields.","error");return}s(()=>q),n(),c("Esquema importado correctamente.","success")}catch{c("No se pudo parsear el JSON.","error")}},V.readAsText(S),A.currentTarget.value=""},y=()=>{window.confirm("Crear un esquema nuevo vacío (perderás cambios no guardados). ¿Continuar?")&&(s(S=>{S.layout=[{type:"rows",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}],S.fields=[],S.successMessage="Guardado",S.errorMessage="Error",S.onSubmit=async()=>{}}),n(),c("Esquema nuevo creado.","info"))},T=async()=>{try{const A=Eo(u,mn(`${p}.json`));await d.write(A,JSON.stringify(e,null,2)),c(`Guardado rápido en ${A}`,"success")}catch(A){console.error(A),c("Guardado rápido fallido.","error")}},N=async()=>{try{const A=mn(`${p}.json`),S=window.prompt("Guardar como (archivo en baseDir):",A);if(!S)return;const $=Eo(u,mn(S));await d.write($,JSON.stringify(e,null,2)),c(`Guardado en ${$}`,"success")}catch(A){console.error(A),c("No se pudo guardar el archivo.","error")}};return b.useEffect(()=>{const A=S=>{const $=S.metaKey||S.ctrlKey;if($&&S.key.toLowerCase()==="z"&&!S.shiftKey){S.preventDefault(),a>0&&t();return}if($&&S.key.toLowerCase()==="z"&&S.shiftKey||$&&S.key.toLowerCase()==="y"){S.preventDefault(),i>0&&r();return}if($&&S.key.toLowerCase()==="s"){S.preventDefault(),T();return}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[a,i,t,r]),o.jsxs("div",{className:"px-4 py-2 border-b border-[var(--color-ds-border-default)] bg-[var(--color-ds-background-page)] flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ie,{variant:"ghost",onClick:t,disabled:a===0,title:"Deshacer (Ctrl/Cmd+Z)",children:"Undo"}),o.jsx(ie,{variant:"ghost",onClick:r,disabled:i===0,title:"Rehacer (Ctrl/Cmd+Shift+Z · Ctrl+Y)",children:"Redo"}),o.jsx("span",{className:"mx-1 opacity-30 select-none",children:"|"}),o.jsx(ie,{variant:"outline",onClick:m,title:"Importar desde JSON",children:"Importar JSON"}),o.jsx(ie,{variant:"outline",onClick:v,title:"Exportar a JSON",children:"Exportar JSON"}),o.jsx(ie,{variant:"outline",onClick:g,title:"Exportar Yup como TypeScript",children:"Exportar Yup (.ts)"}),o.jsx(ie,{variant:"ghost",onClick:x,title:"Copiar JSON al portapapeles",children:"Copiar JSON"}),o.jsx("input",{ref:l,type:"file",accept:"application/json",className:"hidden",onChange:w}),o.jsx("span",{className:"mx-1 opacity-30 select-none",children:"|"}),o.jsx(ie,{variant:"outline",onClick:T,title:"Guardar rápido en baseDir (Ctrl/Cmd+S)",children:"Guardar"}),o.jsx(ie,{variant:"outline",onClick:N,title:"Guardar como… en baseDir",children:"Guardar como…"}),o.jsx("span",{className:"mx-1 opacity-30 select-none",children:"|"}),o.jsx(ie,{onClick:y,title:"Nuevo esquema",children:"Nuevo"})]}),o.jsxs("div",{className:"flex items-center gap-3 text-[var(--color-ds-text-secondary)] text-ds-sm",children:[o.jsxs("span",{className:"text-[var(--color-ds-text-primary)]",children:["Secciones: ",o.jsx("strong",{children:f})]}),o.jsxs("span",{className:"text-[var(--color-ds-text-primary)]",children:["Campos: ",o.jsx("strong",{children:h})]})]})]})}const ls="application/x-ds-field-template",Co="application/x-ds-layout-kind";function cs(e){return e.layout.find(t=>(t==null?void 0:t.type)==="rows")}function Wh({className:e,children:t}){var w;const r=J(y=>y.schema),s=J(y=>y.addFieldAndPlace),n=J(y=>y.addRowsBlockAt),a=J(y=>y.addSection),i=J(y=>y.addRowToSection),l=J(y=>y.setRowColumns),c=J(y=>y.moveField),[d,u]=b.useState(!1),f=b.useMemo(()=>{var N;const y=cs(r);if(!y)return[];const T=[];return(N=y.sections)==null||N.forEach((_,A)=>{var S;(S=_.rows)==null||S.forEach(($,V)=>{($.columns??[]).forEach((z,q)=>{var E;const D=((E=z.fields)==null?void 0:E.length)??0,P=Math.max(1,D+1);for(let te=0;te<P;te++)T.push({kind:"field-slot",sectionIdx:A,rowIdx:V,colIdx:q,insertIdx:te,key:`s${A}-r${V}-c${q}-i${te}`})})})}),T},[r]),h=b.useCallback(()=>{var N,_;let y=cs(r);return y?(N=y.sections)!=null&&N.length?(_=y.sections[0].rows)!=null&&_.length?((y.sections[0].rows[0].columns??[]).length||l==null||l(0,0,1),{s:0,r:0,c:0}):(i==null||i(0),{s:0,r:0,c:0}):(a==null||a("Sección 1"),{s:0,r:0,c:0}):(n==null||n(r.layout.length??0,"Sección 1"),{s:0,r:0,c:0})},[r,n,a,i,l]),p=b.useCallback(y=>{var N;const T=((N=y.dataTransfer)==null?void 0:N.types)||[];(T.includes(ls)||T.includes(Co))&&(y.preventDefault(),y.dataTransfer.dropEffect="copy",u(T.includes(ls)?"field":"layout"))},[]),v=b.useCallback(()=>u(!1),[]),g=b.useCallback(y=>{var A;const T=y.dataTransfer.getData(Co);if(!T)return!1;const{kind:N}=JSON.parse(T),_=((A=r==null?void 0:r.layout)==null?void 0:A.length)??0;return N==="section-layout"&&(n==null||n(_,"Nueva sección")),!0},[(w=r==null?void 0:r.layout)==null?void 0:w.length,n]),x=b.useCallback((y,T)=>{const N=T.dataTransfer.getData(ls);if(!N)return!1;const{fieldTemplate:_}=JSON.parse(N);return s(_,y.sectionIdx,y.rowIdx,y.colIdx),queueMicrotask(()=>{var z;const A=J.getState().schema,V=(((z=cs(A).sections[y.sectionIdx].rows[y.rowIdx].columns[y.colIdx].fields)==null?void 0:z.length)??1)-1;y.insertIdx>=0&&y.insertIdx<V&&c({s:y.sectionIdx,r:y.rowIdx,c:y.colIdx,idx:V},{s:y.sectionIdx,r:y.rowIdx,c:y.colIdx,idx:y.insertIdx})}),!0},[s,c]),m=b.useCallback(y=>{if(y.preventDefault(),y.stopPropagation(),g(y)){u(!1);return}const T=y.dataTransfer.getData(ls);if(T){const{fieldTemplate:N}=JSON.parse(T),_=h();s(N,_.s,_.r,_.c)}u(!1)},[g,h,s]);return o.jsxs("div",{className:["relative",e].filter(Boolean).join(" "),onDragOver:p,onDragLeave:v,onDrop:m,children:[t,d&&o.jsxs("div",{className:"absolute inset-0 z-40",children:[o.jsx("div",{className:"absolute inset-0 bg-black/5 pointer-events-none"}),o.jsx("div",{className:"absolute inset-0 px-4 py-4 overflow-auto space-y-4",children:(()=>{var N;const y=cs(r);if(!y||!((N=y.sections)!=null&&N.length)){const _=h(),A={kind:"field-slot",sectionIdx:_.s,rowIdx:_.r,colIdx:_.c,insertIdx:0,key:"init"};return o.jsx("div",{className:"min-h-[220px] border-2 border-dashed rounded-2xl bg-white/70 flex items-center justify-center text-ds-sm",onDragOver:S=>S.preventDefault(),onDrop:S=>{S.preventDefault(),S.stopPropagation(),x(A,S),u(!1)},children:"Suelta aquí para empezar"})}const T=[];return y.sections.forEach((_,A)=>{var S;(S=_.rows)==null||S.forEach(($,V)=>{const z=[];($.columns??[]).forEach((q,D)=>{const P=f.filter(E=>E.sectionIdx===A&&E.rowIdx===V&&E.colIdx===D);z.push(P)}),T.push({key:`s${A}-r${V}`,cols:z})})}),T.map(_=>o.jsx("div",{className:"grid gap-3 pointer-events-none",style:{gridTemplateColumns:`repeat(${_.cols.length||1}, minmax(0,1fr))`},children:_.cols.map((A,S)=>{const $=A.length===1;return o.jsx("div",{className:"pointer-events-auto",children:o.jsx("div",{className:["rounded-xl border-2 border-dashed bg-white/60",$?"min-h-[160px]":"py-2"].join(" "),children:o.jsx("div",{className:"flex flex-col gap-2",children:A.map(V=>o.jsx("div",{className:"h-7 rounded-md border border-transparent hover:border-[var(--color-ds-border-default)] hover:bg-white/80 flex items-center justify-center text-ds-xs text-[var(--color-ds-text-secondary)]",onDragOver:z=>z.preventDefault(),onDrop:z=>{z.preventDefault(),z.stopPropagation(),x(V,z),u(!1)},title:`Insertar en Col ${V.colIdx+1}, posición ${V.insertIdx+1}`,children:$?"Soltar aquí":V.insertIdx===A.length-1?"Añadir al final":"Insertar aquí"},V.key))})})},`${_.key}-c${S}`)})},_.key))})()})]})]})}function Kh(e,t,r){const s={...e};return t.top+e.y<=r.top?s.y=r.top-t.top:t.bottom+e.y>=r.top+r.height&&(s.y=r.top+r.height-t.bottom),t.left+e.x<=r.left?s.x=r.left-t.left:t.right+e.x>=r.left+r.width&&(s.x=r.left+r.width-t.right),s}const Gh=e=>{let{transform:t,draggingNodeRect:r,windowRect:s}=e;return!r||!s?t:Kh(t,r,s)};function Jh({children:e}){const t=J(D=>D.moveField),r=J(D=>D.moveFieldInTab),s=J(D=>D.removeFieldFromLayout),n=J(D=>D.removeFieldFromTabLayout),a=J(D=>D.insertExistingFieldAt),i=J(D=>D.insertExistingFieldInTabAt),l=J(D=>D.addField),c=J(D=>D.addFieldAndPlaceInTabAt),d=J(D=>D.placeFieldInTabColumn),u=J(D=>D.placeFieldInColumn),f=J(D=>D.moveFieldAt),h=J(D=>D.removeFieldFromLayoutAt),p=J(D=>D.placeFieldInColumnAt),v=J(D=>D.insertExistingFieldAtAt),g=J(D=>D.addFieldAndPlaceAtAt),x=J(D=>D.moveSection),m=J(D=>D.moveTab),w=J(D=>D.moveTabSection),[y,T]=b.useState(null),[N,_]=b.useState(null),A=If(co(la,{activationConstraint:{distance:6}}),co(oa)),S=D=>{var E,te;const P=(te=(E=D==null?void 0:D.active)==null?void 0:E.data)==null?void 0:te.current;P&&T({data:P})},$=D=>{var E,te;const P=(te=(E=D==null?void 0:D.over)==null?void 0:E.data)==null?void 0:te.current;_(P??null)},V=(D,P)=>D===void 0?P:Math.max(0,Math.min(D,P)),z=D=>{var ne,K;const P=(K=(ne=D.active)==null?void 0:ne.data)==null?void 0:K.current;let E=null;switch(P==null?void 0:P.kind){case"rows-section":E=["rows-section"];break;case"tabs-tab":E=["tabs-tab"];break;case"tab-section":E=["tab-section"];break;case"field-in-rows":E=["rows-column"];break;case"field-in-tabs":E=["tabs-column"];break;case"palette-field":E=["rows-column","tabs-column"];break;default:E=null}const te=E==null?D.droppableContainers:D.droppableContainers.filter(le=>{var k,I;const C=(I=(k=le.data)==null?void 0:k.current)==null?void 0:I.scope;return C&&E.includes(C)});return te.length?Kf({...D,droppableContainers:te}):sl(D)},q=D=>{var te,ne,K,le,C,k,I,U;const P=(ne=(te=D==null?void 0:D.active)==null?void 0:te.data)==null?void 0:ne.current,E=(le=(K=D==null?void 0:D.over)==null?void 0:K.data)==null?void 0:le.current;if(T(null),_(null),!(!P||!E)){if(P.kind==="rows-section"&&E.scope==="rows-section"){if(typeof x=="function"&&P.nodeIdx===E.nodeIdx){const G=J.getState().schema.layout[P.nodeIdx],ee=((C=G==null?void 0:G.sections)==null?void 0:C.length)??0;x(P.nodeIdx,P.sIdx,V(E.insertAt,ee))}return}if(P.kind==="tabs-tab"&&E.scope==="tabs-tab"){if(typeof m=="function"&&P.nodeIdx===E.nodeIdx){const G=J.getState().schema.layout[P.nodeIdx],ee=((k=G==null?void 0:G.tabs)==null?void 0:k.length)??0;m(P.nodeIdx,P.index,V(E.insertAt,ee))}return}if(P.kind==="tab-section"&&E.scope==="tab-section"){if(typeof w=="function"&&P.nodeIdx===E.nodeIdx&&P.tabKey===E.tabKey){const G=J.getState().schema.layout[P.nodeIdx],ee=(I=G==null?void 0:G.tabs)==null?void 0:I.find(W=>W.key===P.tabKey),M=((U=ee==null?void 0:ee.sections)==null?void 0:U.length)??0;w(P.nodeIdx,P.tabKey,P.sIdx,V(E.insertAt,M))}return}if(P.kind==="field-in-rows"&&E.scope==="rows-column"){const G=P.rowsNodeIdx??0,ee=E.rowsNodeIdx??G;typeof f=="function"&&G!==ee?f(G,P.path,ee,{s:E.s,r:E.r,c:E.c,idx:E.insertAt}):t(P.path,{s:E.s,r:E.r,c:E.c,idx:E.insertAt});return}if(P.kind==="field-in-tabs"&&E.scope==="tabs-column"&&P.tabKey===E.tabKey){r({tabKey:P.tabKey,...P.path},{tabKey:P.tabKey,s:E.s,r:E.r,c:E.c,idx:E.insertAt});return}if(P.kind==="field-in-tabs"&&E.scope==="tabs-column"&&P.tabKey!==E.tabKey){n({tabKey:P.tabKey,...P.path}),typeof E.insertAt=="number"?i(P.name,E.tabKey,E.s,E.r,E.c,E.insertAt):d(P.name,E.tabKey,E.s,E.r,E.c);return}if(P.kind==="field-in-rows"&&E.scope==="tabs-column"){const G=P.rowsNodeIdx??0;typeof h=="function"?h(G,P.path):s(P.path),typeof E.insertAt=="number"?i(P.name,E.tabKey,E.s,E.r,E.c,E.insertAt):d(P.name,E.tabKey,E.s,E.r,E.c);return}if(P.kind==="field-in-tabs"&&E.scope==="rows-column"){n({tabKey:P.tabKey,...P.path});const G=E.rowsNodeIdx??0;if(typeof v=="function"){const ee=typeof E.insertAt=="number"?E.insertAt:void 0;typeof ee=="number"?v(G,P.name,E.s,E.r,E.c,ee):typeof p=="function"?p(G,P.name,E.s,E.r,E.c):u(P.name,E.s,E.r,E.c)}else typeof E.insertAt=="number"?a(P.name,E.s,E.r,E.c,E.insertAt):u(P.name,E.s,E.r,E.c);return}if(P.kind==="palette-field"){if(E.scope==="rows-column"){const G=E.rowsNodeIdx??0;if(typeof E.insertAt=="number"&&typeof g=="function")g(G,{type:P.factoryKind},E.s,E.r,E.c,E.insertAt);else{const ee=J.getState().schema.fields.length;l({type:P.factoryKind});const M=J.getState().schema.fields[ee];typeof p=="function"?p(G,M.name,E.s,E.r,E.c):u(M.name,E.s,E.r,E.c)}return}if(E.scope==="tabs-column"){if(typeof E.insertAt=="number"&&typeof c=="function")c({type:P.factoryKind},E.tabKey,E.s,E.r,E.c,E.insertAt);else{const G=J.getState().schema.fields.length;l({type:P.factoryKind});const ee=J.getState().schema.fields[G];d(ee.name,E.tabKey,E.s,E.r,E.c)}return}}}};return o.jsxs(zm,{sensors:A,collisionDetection:z,onDragStart:S,onDragOver:$,onDragEnd:q,modifiers:[Gh],children:[e,o.jsx(sh,{children:y?o.jsxs("div",{className:"px-2 py-1 rounded-md border text-[var(--color-ds-text-primary)] border-[var(--color-ds-border-default)] bg-[var(--color-ds-background-surface)] shadow",children:[y.data.kind==="palette-field"&&`Nuevo: ${y.data.factoryKind}`,y.data.kind==="field-in-rows"&&y.data.name,y.data.kind==="field-in-tabs"&&y.data.name,y.data.kind==="rows-section"&&"Sección",y.data.kind==="tabs-tab"&&"Pestaña",y.data.kind==="tab-section"&&"Sección de pestaña"]}):null})]})}function Ao(e){const r={...e.scope==="rows-column"?{scope:"rows-column",s:e.s,r:e.r,c:e.c,rowsNodeIdx:e.rowsNodeIdx}:{scope:"tabs-column",tabKey:e.tabKey,s:e.s,r:e.r,c:e.c},insertAt:Number.MAX_SAFE_INTEGER},{setNodeRef:s,isOver:n}=Gr({id:JSON.stringify(r),data:r});return o.jsx("div",{ref:s,className:n?"ring-2 ring-[var(--color-ds-border-default)] rounded-md":"","aria-dropeffect":n?"copy":void 0,"data-drop-scope":e.scope,children:e.children})}function ds(e){const r={...e.scope==="rows-column"?{scope:"rows-column",rowsNodeIdx:e.rowsNodeIdx,s:e.s,r:e.r,c:e.c}:{scope:"tabs-column",tabKey:e.tabKey,s:e.s,r:e.r,c:e.c},insertAt:e.insertAt},{setNodeRef:s,isOver:n}=Gr({id:JSON.stringify(r),data:r});return o.jsx("div",{ref:s,role:"button","aria-dropeffect":n?"copy":void 0,"aria-label":`Soltar aquí (posición ${e.insertAt+1})`,"data-drop-scope":e.scope,"data-insert-at":e.insertAt,className:["h-2 my-1 w-full","rounded-sm transition",n?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent","relative -mx-1 px-1"].join(" ")})}function To(e){const t=e.kind==="field-in-tabs"?`${e.kind}:${e.tabKey}:${e.name}:${e.path.s}-${e.path.r}-${e.path.c}-${e.path.idx}`:`${e.kind}:${e.rowsNodeIdx}:${e.name}:${e.path.s}-${e.path.r}-${e.path.c}-${e.path.idx}`,r=e.kind==="field-in-rows"?{kind:e.kind,name:e.name,path:e.path,rowsNodeIdx:e.rowsNodeIdx}:{kind:e.kind,name:e.name,path:e.path,tabKey:e.tabKey},{attributes:s,listeners:n,setNodeRef:a,isDragging:i}=Kr({id:t,data:r});return o.jsxs("div",{ref:a,className:["text-[var(--color-ds-text-primary)] group flex items-center justify-between gap-2 rounded-md px-2 py-1 w-100",i?"opacity-50":"opacity-100"].join(" "),"data-field-name":e.name,children:[o.jsx("button",{type:"button",className:"text-[var(--color-ds-text-primary)] text-ds-sm hover:underline text-left truncate",title:e.name,onClick:e.onSelect,children:e.name}),o.jsx("div",{...n,...s,role:"button","aria-grabbed":i,"aria-label":`Arrastrar campo ${e.name}`,className:["text-[var(--color-ds-text-primary)] text-[10px] select-none cursor-grab active:cursor-grabbing","px-1 py-0.5 rounded-sm","hover:bg-[var(--color-ds-background-muted)]","focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-500)]"].join(" "),title:"Arrastra para reordenar",children:"⇅"})]})}function _o({nodeIdx:e,insertAt:t}){const r={scope:"rows-section",nodeIdx:e,insertAt:t},{setNodeRef:s,isOver:n}=Gr({id:`rows-section:${e}:${t}`,data:r});return o.jsx("div",{ref:s,className:["h-2 my-1 w-full rounded-sm transition relative -mx-1 px-1",n?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent"].join(" "),"aria-label":`Insertar sección en posición ${t+1}`})}function Zh({nodeIdx:e,sIdx:t}){const r=`rows-section:${e}:${t}`,s={kind:"rows-section",nodeIdx:e,sIdx:t},{attributes:n,listeners:a,setNodeRef:i,isDragging:l}=Kr({id:r,data:s});return o.jsx("div",{ref:i,...n,...a,role:"button",title:"Arrastrar sección","aria-grabbed":l,className:"shrink-0 w-6 h-6 grid place-items-center cursor-grab active:cursor-grabbing rounded hover:bg-[var(--color-ds-background-muted)]",children:"⇅"})}function Fo({nodeIdx:e,insertAt:t}){const r={scope:"tabs-tab",nodeIdx:e,insertAt:t},{setNodeRef:s,isOver:n}=Gr({id:`tabs-tab:${e}:${t}`,data:r});return o.jsx("div",{ref:s,className:["w-8 h-7 rounded-md transition",n?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent"].join(" "),title:`Insertar pestaña en posición ${t+1}`})}function Yh({nodeIdx:e,index:t,tabKey:r,label:s}){const n=`tabs-tab:${e}:${t}:${r}`,a={kind:"tabs-tab",nodeIdx:e,index:t,tabKey:r},{attributes:i,listeners:l,setNodeRef:c,isDragging:d}=Kr({id:n,data:a});return o.jsxs("div",{ref:c,...i,...l,"aria-grabbed":d,className:["px-2 h-7 inline-flex items-center rounded-full border text-ds-xs cursor-grab active:cursor-grabbing","border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",d?"opacity-50":"opacity-100"].join(" "),title:`Arrastrar pestaña "${s}"`,children:[o.jsx("span",{className:"mr-1",children:"⇅"})," ",s]})}function hn({nodeIdx:e,tabKey:t,insertAt:r}){const s={scope:"tab-section",nodeIdx:e,tabKey:t,insertAt:r},{setNodeRef:n,isOver:a}=Gr({id:`tab-section:${e}:${t}:${r}`,data:s});return o.jsx("div",{ref:n,className:["h-2 my-1 w-full rounded-sm transition relative -mx-1 px-1",a?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent"].join(" "),"aria-label":`Insertar sección de pestaña en posición ${r+1}`})}function Hh({nodeIdx:e,tabKey:t,sIdx:r}){const s=`tab-section:${e}:${t}:${r}`,n={kind:"tab-section",nodeIdx:e,tabKey:t,sIdx:r},{attributes:a,listeners:i,setNodeRef:l,isDragging:c}=Kr({id:s,data:n});return o.jsx("div",{ref:l,...a,...i,title:"Arrastrar sección de pestaña","aria-grabbed":c,className:"shrink-0 w-6 h-6 grid place-items-center cursor-grab active:cursor-grabbing rounded hover:bg-[var(--color-ds-background-muted)]",children:"⇅"})}const Oo=e=>e<=1?["w-full"]:e===2?["w-1/2","w-1/2"]:e===3?["w-1/3","w-1/3","w-1/3"]:Array.from({length:e},()=>"flex-1"),Ro=[1,2,3,4];function pn({expanded:e,onClick:t,labelExpanded:r,labelCollapsed:s,titleExpanded:n,titleCollapsed:a,className:i=""}){return o.jsx(ie,{size:"xs",variant:"ghost","aria-expanded":e,"aria-label":e?r:s,onClick:t,title:e?n??"Colapsar":a??"Expandir",className:`shrink-0 w-8 h-8 p-0 grid place-items-center ${i}`,children:o.jsx(Os,{className:`w-4 h-4 text-[var(--color-ds-text-primary)] transition-transform duration-150 ${e?"rotate-180":""}`})})}function Xh(){const e=J(M=>M.schema),t=J(M=>M.placeFieldInColumn),r=J(M=>M.removeFieldFromLayout),s=J(M=>M.addColumnToRow),n=J(M=>M.setRowColumns),a=J(M=>M.removeColumn),i=J(M=>M.setSelection),l=J(M=>M.renameSection||M.setSectionTitle),c=J(M=>M.removeSection);J(M=>M.duplicateSection),J(M=>M.addRowToSection);const d=J(M=>M.addTabAfter),u=J(M=>M.removeTab),f=J(M=>M.renameTab),h=J(M=>M.addSectionToTab);J(M=>M.addRowToTabSection);const p=J(M=>M.renameTabSection),v=J(M=>M.setTabRowColumns),g=J(M=>M.addColumnToTabRow),x=J(M=>M.removeTabColumn),m=J(M=>M.placeFieldInTabColumn),w=J(M=>M.removeFieldFromTabLayout);J(M=>M.addRowsBlockAt),J(M=>M.addTabsContainerAt);const y=J(M=>M.removeLayoutNode);J(M=>M.duplicateRowInSection);const T=J(M=>M.removeRowFromSection),N=J(M=>M.duplicateTabRow),_=J(M=>M.removeTabRow),[A,S]=b.useState({}),[$,V]=b.useState({}),[z,q]=b.useState({}),[D,P]=b.useState({}),E=(M,W)=>`${M}:${W}`,te=(M,W,me)=>`${M}:${W}:${me}`,ne=(M,W)=>V(me=>({...me,[E(M,W)]:!me[E(M,W)]})),K=(M,W)=>!!$[E(M,W)],le=(M,W,me)=>q(be=>({...be,[te(M,W,me)]:!be[te(M,W,me)]})),C=(M,W,me)=>!!z[te(M,W,me)],k=M=>P(W=>({...W,[M]:!W[M]})),I=M=>!!D[M],U=(M,W)=>l==null?void 0:l(M,W),G=M=>c==null?void 0:c(M),ee=b.useMemo(()=>[...e.fields].reverse().find(M=>M.type!=="inputGroup"&&M.type!=="button"),[e.fields]);return o.jsx(Jh,{children:o.jsxs("div",{className:"space-y-3",children:[o.jsx(bn,{at:0}),e.layout.map((M,W)=>{var me;if(M.type==="rows")return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(_o,{nodeIdx:W,insertAt:0}),M.sections.map((be,de)=>o.jsxs(b.Fragment,{children:[o.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsx("div",{className:"pr-3 bg-[var(--color-ds-background-surface)] border-b border-[var(--color-ds-border-default-50)]",children:o.jsxs("div",{className:"flex items-center gap-2 min-h-9 py-1",children:[o.jsx(pn,{expanded:!K(W,de),onClick:()=>ne(W,de),labelExpanded:"Colapsar sección",labelCollapsed:"Expandir sección"}),o.jsx(Zh,{nodeIdx:W,sIdx:de}),o.jsx(we,{size:"sm",labelHidden:!0,placeholder:"Sección",value:be.sectionTitle??"",onChange:ke=>U(de,ke.target.value),onBlur:ke=>U(de,ke.target.value.trim()||"Sección"),reserveErrorSpace:!1}),o.jsx("div",{className:"flex flex-wrap gap-1 ml-auto",children:o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>G(de),title:"Eliminar sección",children:"✕"})})]})}),K(W,de)?null:o.jsx("div",{className:"space-y-4 bg-[var(--color-ds-background-page)]",children:be.rows.map((ke,ge)=>{const he=ke.columns??[],fe=he.length===0,pe=Oo(he.length);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"px-3 py-2 flex items-center gap-3 bg-[var(--color-ds-background)] border-b border-[var(--color-ds-border-default-50)]",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-wrap flex-1 min-w-0",children:[o.jsxs("span",{className:"text-[11px] leading-none uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:["Fila ",ge+1]}),o.jsx("div",{className:"h-3 w-px bg-[var(--color-ds-border-default-50)]"}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[Ro.map(ye=>o.jsx(ie,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>n(de,ge,ye),title:`${ye} columna(s)`,children:ye},ye)),o.jsx(ie,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>s(de,ge),title:"Añadir columna",children:"+ columna"})]})]}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>T==null?void 0:T(de,ge),title:"Eliminar fila",children:"✕"})]}),fe?o.jsx("div",{className:"rounded-md border border-dashed p-6 text-center border-[var(--color-ds-border-default-50)] text-[var(--color-ds-text-secondary)]",children:"No hay columnas. Usa “+ columna”."}):o.jsx("div",{className:"space-y-3",children:he.map((ye,ce)=>o.jsx(Ao,{scope:"rows-column",rowsNodeIdx:W,s:de,r:ge,c:ce,children:o.jsxs("div",{className:"rounded-lg border bg-[var(--color-ds-background-page)] border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--color-ds-background-surface)]",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"inline-flex items-center justify-center text-[10px] leading-none px-1.5 py-0.5 rounded-full border text-[var(--color-ds-text-primary)] border-[var(--color-ds-border-default-50)]",children:["Col ",ce+1]}),o.jsx("span",{className:"text-[10px] leading-none text-[var(--color-ds-text-secondary)]",children:ye.width||pe[ce]||"flex-1"})]}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>a(de,ge,ce),title:"Eliminar columna",children:"✕"})]}),o.jsxs("div",{className:"p-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ds,{scope:"rows-column",rowsNodeIdx:W,s:de,r:ge,c:ce,insertAt:0}),(ye.fields??[]).length===0&&o.jsx("div",{className:"text-center text-[12px] text-[var(--color-ds-text-secondary)] border border-dashed border-[var(--color-ds-border-default-50)] rounded-md py-4",children:"Suelta campos aquí"}),(ye.fields??[]).map((Se,Te)=>{const j=typeof Se=="string"?Se:Se.name;return o.jsxs(b.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)] px-2 py-1",children:[o.jsx(To,{kind:"field-in-rows",rowsNodeIdx:W,name:j,path:{s:de,r:ge,c:ce,idx:Te},onSelect:()=>i({kind:"field",name:j})}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>r({s:de,r:ge,c:ce,idx:Te}),title:"Quitar del layout",children:"✕"})]}),o.jsx(ds,{scope:"rows-column",rowsNodeIdx:W,s:de,r:ge,c:ce,insertAt:Te+1})]},`${j}-${Te}`)})]}),o.jsx("div",{className:"mt-2",children:o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>(ee==null?void 0:ee.name)&&t(ee.name,de,ge,ce),title:"Colocar el último campo creado en esta columna",children:"Colocar último campo"})})]})]})},`col-${W}-${de}-${ge}-${ce}`))})]},ge)})})]}),o.jsx(_o,{nodeIdx:W,insertAt:de+1})]},`rows-sec-${W}-${de}`))]}),o.jsx(bn,{at:W+1})]},`rows-${W}`);if(M.type==="tabs"){const be=M.tabs.map(ge=>({label:ge.label,value:ge.key})),de=(me=M.tabs[0])==null?void 0:me.key,ke=A[W]??de??"";return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsx("div",{className:"bg-[var(--color-ds-background-surface)] border-b border-[var(--color-ds-border-default-50)]",children:o.jsxs("div",{className:"flex items-center gap-2 min-h-9 py-1 pr-2",children:[o.jsx(pn,{expanded:!I(W),onClick:()=>k(W),labelExpanded:"Colapsar pestañas",labelCollapsed:"Expandir pestañas"}),o.jsx("span",{className:"text-[11px] leading-none uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:"Pestañas"}),o.jsx("div",{className:"ml-auto",children:o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>y(W),title:"Eliminar bloque",children:"✕"})})]})}),I(W)?null:o.jsxs("div",{className:"bg-[var(--color-ds-background)]",children:[o.jsxs("div",{className:"px-2 py-2 flex items-center gap-2 border-b border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",children:[o.jsx("span",{className:"text-[11px] uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:"Orden pestañas"}),o.jsx(Fo,{nodeIdx:W,insertAt:0}),M.tabs.map((ge,he)=>o.jsxs(b.Fragment,{children:[o.jsx(Yh,{nodeIdx:W,index:he,tabKey:ge.key,label:ge.label}),o.jsx(Fo,{nodeIdx:W,insertAt:he+1})]},`tabchip-${W}-${ge.key}`))]}),o.jsx("div",{className:"border-b border-[var(--color-ds-border-default-50)]",children:o.jsx(zr,{options:be,value:ke,onChange:ge=>S(he=>({...he,[W]:ge})),children:M.tabs.reduce((ge,he)=>(ge[he.key]=o.jsxs("div",{className:"space-y-3",children:[ke===he.key&&o.jsxs("div",{className:"p-2 flex flex-wrap items-center gap-2",children:[o.jsx(we,{size:"sm",label:"Nombre pestaña",value:he.label,onChange:fe=>f==null?void 0:f(he.key,fe.target.value),className:"w-48",reserveErrorSpace:!1}),o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>d==null?void 0:d(he.key),children:"+ pestaña"}),o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>h==null?void 0:h(he.key,"Nueva sección"),children:"+ sección"}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>u==null?void 0:u(he.key),disabled:M.tabs.length<=1,children:"eliminar pestaña"})]}),he.sections.length===0?o.jsx("div",{className:"px-2",children:o.jsx(hn,{nodeIdx:W,tabKey:he.key,insertAt:0})}):null,he.sections.map((fe,pe)=>o.jsxs(b.Fragment,{children:[pe===0?o.jsx("div",{className:"px-2",children:o.jsx(hn,{nodeIdx:W,tabKey:he.key,insertAt:0})}):null,o.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsx("div",{className:"bg-[var(--color-ds-background-surface)] border-b border-[var(--color-ds-border-default-50)]",children:o.jsxs("div",{className:"flex items-center gap-2 min-h-9 py-1",children:[o.jsx(pn,{expanded:!C(W,he.key,pe),onClick:()=>le(W,he.key,pe),labelExpanded:"Colapsar sección",labelCollapsed:"Expandir sección",className:"ml-2"}),o.jsx(Hh,{nodeIdx:W,tabKey:he.key,sIdx:pe}),o.jsx(we,{size:"sm",labelHidden:!0,placeholder:"Sección",value:fe.sectionTitle??"",onChange:ye=>p==null?void 0:p(he.key,pe,ye.target.value),onBlur:ye=>p==null?void 0:p(he.key,pe,ye.target.value.trim()||"Sección"),reserveErrorSpace:!1})]})}),C(W,he.key,pe)?null:o.jsx("div",{className:"space-y-4 bg-[var(--color-ds-background-page)]",children:fe.rows.map((ye,ce)=>{const Se=ye.columns??[],Te=Se.length===0,j=Oo(Se.length);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"px-3 py-2 flex items-center gap-3 bg-[var(--color-ds-background)] border-b border-[var(--color-ds-border-default-50)]",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-wrap flex-1 min-w-0",children:[o.jsxs("span",{className:"text-[11px] leading-none uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:["Fila ",ce+1]}),o.jsx("div",{className:"h-3 w-px bg-[var(--color-ds-border-default-50)]"}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[Ro.map(F=>o.jsx(ie,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>v==null?void 0:v(he.key,pe,ce,F),title:`${F} columna(s)`,children:F},F)),o.jsx(ie,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>g==null?void 0:g(he.key,pe,ce),title:"Añadir columna",children:"+ columna"})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ie,{size:"xs",variant:"subtle",onClick:()=>N==null?void 0:N(he.key,pe,ce),title:"Duplicar fila",children:"duplicar"}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>_==null?void 0:_(he.key,pe,ce),title:"Eliminar fila",children:"eliminar"})]})]}),Te?o.jsx("div",{className:"rounded-md border border-dashed p-6 text-center border-[var(--color-ds-border-default-50)] text-[var(--color-ds-text-secondary)]",children:"No hay columnas. Usa “+ columna”."}):o.jsx("div",{className:"space-y-3",children:Se.map((F,R)=>o.jsx(Ao,{scope:"tabs-column",tabKey:he.key,s:pe,r:ce,c:R,children:o.jsxs("div",{className:"rounded-lg border bg-[var(--color-ds-background-page)] border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--color-ds-background-surface)]",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"inline-flex items-center justify-center text-[10px] leading-none px-1.5 py-0.5 rounded-full border border-[var(--color-ds-border-default-50)]",children:["Col ",R+1]}),o.jsx("span",{className:"text-[10px] leading-none text-[var(--color-ds-text-secondary)]",children:F.width||j[R]||"flex-1"})]}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>x==null?void 0:x(he.key,pe,ce,R),children:"✕"})]}),o.jsxs("div",{className:"p-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ds,{scope:"tabs-column",tabKey:he.key,s:pe,r:ce,c:R,insertAt:0}),(F.fields??[]).length===0&&o.jsx("div",{className:"text-center text-[12px] text-[var(--color-ds-text-secondary)] border border-dashed border-[var(--color-ds-border-default-50)] rounded-md py-4",children:"Suelta campos aquí"}),(F.fields??[]).map((X,Y)=>{const Z=typeof X=="string"?X:X.name;return o.jsxs(b.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)] px-2 py-1",children:[o.jsx(To,{kind:"field-in-tabs",tabKey:he.key,name:Z,path:{s:pe,r:ce,c:R,idx:Y},onSelect:()=>i({kind:"field",name:Z})}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>w==null?void 0:w({tabKey:he.key,s:pe,r:ce,c:R,idx:Y}),children:"✕"})]}),o.jsx(ds,{scope:"tabs-column",tabKey:he.key,s:pe,r:ce,c:R,insertAt:Y+1})]},`${Z}-${Y}`)})]}),o.jsx("div",{className:"mt-2",children:o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>(ee==null?void 0:ee.name)&&(m==null?void 0:m(ee.name,he.key,pe,ce,R)),children:"Colocar último campo"})})]})]})},`tcol-${he.key}-${ce}-${R}`))})]},`trow-${he.key}-${ce}`)})})]}),o.jsx("div",{className:"px-2",children:o.jsx(hn,{nodeIdx:W,tabKey:he.key,insertAt:pe+1})})]},`tsec-${he.key}-${pe}`))]}),ge),{})})})]})]}),o.jsx(bn,{at:W+1})]},`tabs-${W}`)}return null})]})})}function bn({at:e}){const t=J(s=>s.addRowsBlockAt),r=J(s=>s.addTabsContainerAt);return o.jsxs("div",{className:"my-2 flex items-center justify-center gap-2",children:[o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>t(e,"Sección"),title:"Añadir sección aquí",children:"+ Sección aquí"}),o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>r(e),title:"Añadir pestañas aquí",children:"+ Pestañas aquí"})]})}function Qh(){const e=J(r=>r.schema),t=b.useMemo(()=>{try{const r=Fi(e);return hi(r)}catch{return}},[e]);return o.jsxs("div",{className:"grid grid-rows-[auto_1fr] h-[calc(100vh-80px)]",children:[o.jsx(qh,{}),o.jsxs("div",{className:"grid grid-cols-[260px_1fr_320px] min-h-0",children:[o.jsxs("div",{className:"overflow-auto border-r border-[var(--color-ds-border-default)] ",children:[o.jsx(kh,{}),o.jsx("div",{className:"h-px bg-[var(--color-ds-border-default-50)] my-2"}),o.jsx(Xh,{})]}),o.jsxs(Wh,{className:"overflow-auto",children:[o.jsx("div",{className:"px-4 py-2 border-b text-[var(--color-ds-text-primary)] bg-[var(--color-ds-background-surface)] flex items-center gap-2",children:o.jsx("strong",{children:"Preview"})}),o.jsx("div",{className:"p-4",children:o.jsx(Pi,{schema:e,resolver:t})})]}),o.jsx($h,{})]})]})}function ep({title:e="Form Schema Editor",baseDir:t="src/schemas",fs:r,services:s,onSchemaChange:n,rightPanel:a,rightPanelWidth:i="320px",rightPanelDefaultOpen:l=!1,rightPanelOpen:c,onRightPanelOpenChange:d,className:u}){const f=J(T=>T.schema),h=typeof c=="boolean",[p,v]=b.useState(l),g=h?c:p,x=T=>{h||v(T),d==null||d(T)};b.useEffect(()=>{n==null||n(f)},[f,n]),b.useEffect(()=>{(!(r!=null&&r.list)||!(r!=null&&r.read)||!(r!=null&&r.write)||!(r!=null&&r.remove))&&console.warn("[SchemaEditorHost] fs adapter incompleto."),s!=null&&s.registry||console.warn("[SchemaEditorHost] services.adapter sin registry.")},[r,s]);const m=!!a,w=a&&g?{paddingRight:i}:void 0,y={width:i};return o.jsx(Mu,{value:{fs:r,services:s,baseDir:t},children:o.jsxs("div",{className:["grid grid-rows-[auto_1fr] h-full min-h-[480px]",u].filter(Boolean).join(" "),children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-[var(--color-ds-border-default)] border-b bg-[var(--color-ds-background-page)]",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("h1",{className:"text-lg font-semibold text-[var(--color-ds-text-primary)]",children:e}),m&&o.jsx("button",{type:"button",onClick:()=>x(!g),className:`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs\r
74
+ export type FormValues = yup.InferType<typeof ${t}>;`}function Eo(e,t){const r=new Blob([t],{type:"text/plain;charset=utf-8"}),s=URL.createObjectURL(r),n=document.createElement("a");n.href=s,n.download=e,n.click(),URL.revokeObjectURL(s)}function qh(e){return e.reduce((t,r)=>r.type==="rows"?t+r.sections.length:t+r.tabs.reduce((s,n)=>s+n.sections.length,0),0)}const hn=e=>e.toLowerCase().endsWith(".json")?e:`${e}.json`,Co=(e,t)=>`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`;function Wh(){var _;const e=J(A=>A.schema),t=J(A=>A.undo),r=J(A=>A.redo),s=J(A=>A.setSchema),n=J(A=>A.resetHistory),a=J(A=>A.past.length),i=J(A=>A.future.length),l=b.useRef(null),{show:c}=Vr(),{fs:d,baseDir:u}=$s(),f=qh(e.layout),p=e.fields.length,h=((_=e.title)==null?void 0:_.toString().trim().replace(/\s+/g,"-").toLowerCase())||"form-schema",v=()=>{Eo(`${h}.json`,JSON.stringify(e,null,2)),c("Esquema exportado como JSON.","success")},x=()=>{try{const A=Uh(e,"validationSchema");Eo(`${h}.validation.ts`,A),c("Yup exportado como TypeScript.","success")}catch(A){console.error(A),c("No se pudo generar el Yup.","error")}},g=async()=>{try{await navigator.clipboard.writeText(JSON.stringify(e,null,2)),c("JSON copiado al portapapeles.","success")}catch{c("No se pudo copiar al portapapeles.","error")}},m=()=>{var A;return(A=l.current)==null?void 0:A.click()},w=A=>{var z;const S=(z=A.target.files)==null?void 0:z[0];if(!S)return;if(!window.confirm("Vas a reemplazar el esquema actual. ¿Continuar?")){A.currentTarget.value="";return}const V=new FileReader;V.onload=()=>{try{const q=JSON.parse(String(V.result));if(!Array.isArray(q.layout)||!Array.isArray(q.fields)){c("JSON inválido: faltan layout/fields.","error");return}s(()=>q),n(),c("Esquema importado correctamente.","success")}catch{c("No se pudo parsear el JSON.","error")}},V.readAsText(S),A.currentTarget.value=""},y=()=>{window.confirm("Crear un esquema nuevo vacío (perderás cambios no guardados). ¿Continuar?")&&(s(S=>{S.layout=[{type:"rows",sections:[{sectionTitle:"Sección 1",defaultOpen:!0,rows:[{title:"",columns:[{width:"w-full",fields:[]}]}]}]}],S.fields=[],S.successMessage="Guardado",S.errorMessage="Error",S.onSubmit=async()=>{}}),n(),c("Esquema nuevo creado.","info"))},T=async()=>{try{const A=Co(u,hn(`${h}.json`));await d.write(A,JSON.stringify(e,null,2)),c(`Guardado rápido en ${A}`,"success")}catch(A){console.error(A),c("Guardado rápido fallido.","error")}},N=async()=>{try{const A=hn(`${h}.json`),S=window.prompt("Guardar como (archivo en baseDir):",A);if(!S)return;const $=Co(u,hn(S));await d.write($,JSON.stringify(e,null,2)),c(`Guardado en ${$}`,"success")}catch(A){console.error(A),c("No se pudo guardar el archivo.","error")}};return b.useEffect(()=>{const A=S=>{const $=S.metaKey||S.ctrlKey;if($&&S.key.toLowerCase()==="z"&&!S.shiftKey){S.preventDefault(),a>0&&t();return}if($&&S.key.toLowerCase()==="z"&&S.shiftKey||$&&S.key.toLowerCase()==="y"){S.preventDefault(),i>0&&r();return}if($&&S.key.toLowerCase()==="s"){S.preventDefault(),T();return}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[a,i,t,r]),o.jsxs("div",{className:"px-4 py-2 border-b border-[var(--color-ds-border-default)] bg-[var(--color-ds-background-page)] flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ie,{variant:"ghost",onClick:t,disabled:a===0,title:"Deshacer (Ctrl/Cmd+Z)",children:"Undo"}),o.jsx(ie,{variant:"ghost",onClick:r,disabled:i===0,title:"Rehacer (Ctrl/Cmd+Shift+Z · Ctrl+Y)",children:"Redo"}),o.jsx("span",{className:"mx-1 opacity-30 select-none",children:"|"}),o.jsx(ie,{variant:"outline",onClick:m,title:"Importar desde JSON",children:"Importar JSON"}),o.jsx(ie,{variant:"outline",onClick:v,title:"Exportar a JSON",children:"Exportar JSON"}),o.jsx(ie,{variant:"outline",onClick:x,title:"Exportar Yup como TypeScript",children:"Exportar Yup (.ts)"}),o.jsx(ie,{variant:"ghost",onClick:g,title:"Copiar JSON al portapapeles",children:"Copiar JSON"}),o.jsx("input",{ref:l,type:"file",accept:"application/json",className:"hidden",onChange:w}),o.jsx("span",{className:"mx-1 opacity-30 select-none",children:"|"}),o.jsx(ie,{variant:"outline",onClick:T,title:"Guardar rápido en baseDir (Ctrl/Cmd+S)",children:"Guardar"}),o.jsx(ie,{variant:"outline",onClick:N,title:"Guardar como… en baseDir",children:"Guardar como…"}),o.jsx("span",{className:"mx-1 opacity-30 select-none",children:"|"}),o.jsx(ie,{onClick:y,title:"Nuevo esquema",children:"Nuevo"})]}),o.jsxs("div",{className:"flex items-center gap-3 text-[var(--color-ds-text-secondary)] text-ds-sm",children:[o.jsxs("span",{className:"text-[var(--color-ds-text-primary)]",children:["Secciones: ",o.jsx("strong",{children:f})]}),o.jsxs("span",{className:"text-[var(--color-ds-text-primary)]",children:["Campos: ",o.jsx("strong",{children:p})]})]})]})}const cs="application/x-ds-field-template",Ao="application/x-ds-layout-kind";function ds(e){return e.layout.find(t=>(t==null?void 0:t.type)==="rows")}function Kh({className:e,children:t}){var w;const r=J(y=>y.schema),s=J(y=>y.addFieldAndPlace),n=J(y=>y.addRowsBlockAt),a=J(y=>y.addSection),i=J(y=>y.addRowToSection),l=J(y=>y.setRowColumns),c=J(y=>y.moveField),[d,u]=b.useState(!1),f=b.useMemo(()=>{var N;const y=ds(r);if(!y)return[];const T=[];return(N=y.sections)==null||N.forEach((_,A)=>{var S;(S=_.rows)==null||S.forEach(($,V)=>{($.columns??[]).forEach((z,q)=>{var E;const D=((E=z.fields)==null?void 0:E.length)??0,P=Math.max(1,D+1);for(let te=0;te<P;te++)T.push({kind:"field-slot",sectionIdx:A,rowIdx:V,colIdx:q,insertIdx:te,key:`s${A}-r${V}-c${q}-i${te}`})})})}),T},[r]),p=b.useCallback(()=>{var N,_;let y=ds(r);return y?(N=y.sections)!=null&&N.length?(_=y.sections[0].rows)!=null&&_.length?((y.sections[0].rows[0].columns??[]).length||l==null||l(0,0,1),{s:0,r:0,c:0}):(i==null||i(0),{s:0,r:0,c:0}):(a==null||a("Sección 1"),{s:0,r:0,c:0}):(n==null||n(r.layout.length??0,"Sección 1"),{s:0,r:0,c:0})},[r,n,a,i,l]),h=b.useCallback(y=>{var N;const T=((N=y.dataTransfer)==null?void 0:N.types)||[];(T.includes(cs)||T.includes(Ao))&&(y.preventDefault(),y.dataTransfer.dropEffect="copy",u(T.includes(cs)?"field":"layout"))},[]),v=b.useCallback(()=>u(!1),[]),x=b.useCallback(y=>{var A;const T=y.dataTransfer.getData(Ao);if(!T)return!1;const{kind:N}=JSON.parse(T),_=((A=r==null?void 0:r.layout)==null?void 0:A.length)??0;return N==="section-layout"&&(n==null||n(_,"Nueva sección")),!0},[(w=r==null?void 0:r.layout)==null?void 0:w.length,n]),g=b.useCallback((y,T)=>{const N=T.dataTransfer.getData(cs);if(!N)return!1;const{fieldTemplate:_}=JSON.parse(N);return s(_,y.sectionIdx,y.rowIdx,y.colIdx),queueMicrotask(()=>{var z;const A=J.getState().schema,V=(((z=ds(A).sections[y.sectionIdx].rows[y.rowIdx].columns[y.colIdx].fields)==null?void 0:z.length)??1)-1;y.insertIdx>=0&&y.insertIdx<V&&c({s:y.sectionIdx,r:y.rowIdx,c:y.colIdx,idx:V},{s:y.sectionIdx,r:y.rowIdx,c:y.colIdx,idx:y.insertIdx})}),!0},[s,c]),m=b.useCallback(y=>{if(y.preventDefault(),y.stopPropagation(),x(y)){u(!1);return}const T=y.dataTransfer.getData(cs);if(T){const{fieldTemplate:N}=JSON.parse(T),_=p();s(N,_.s,_.r,_.c)}u(!1)},[x,p,s]);return o.jsxs("div",{className:["relative",e].filter(Boolean).join(" "),onDragOver:h,onDragLeave:v,onDrop:m,children:[t,d&&o.jsxs("div",{className:"absolute inset-0 z-40",children:[o.jsx("div",{className:"absolute inset-0 bg-black/5 pointer-events-none"}),o.jsx("div",{className:"absolute inset-0 px-4 py-4 overflow-auto space-y-4",children:(()=>{var N;const y=ds(r);if(!y||!((N=y.sections)!=null&&N.length)){const _=p(),A={kind:"field-slot",sectionIdx:_.s,rowIdx:_.r,colIdx:_.c,insertIdx:0,key:"init"};return o.jsx("div",{className:"min-h-[220px] border-2 border-dashed rounded-2xl bg-white/70 flex items-center justify-center text-ds-sm",onDragOver:S=>S.preventDefault(),onDrop:S=>{S.preventDefault(),S.stopPropagation(),g(A,S),u(!1)},children:"Suelta aquí para empezar"})}const T=[];return y.sections.forEach((_,A)=>{var S;(S=_.rows)==null||S.forEach(($,V)=>{const z=[];($.columns??[]).forEach((q,D)=>{const P=f.filter(E=>E.sectionIdx===A&&E.rowIdx===V&&E.colIdx===D);z.push(P)}),T.push({key:`s${A}-r${V}`,cols:z})})}),T.map(_=>o.jsx("div",{className:"grid gap-3 pointer-events-none",style:{gridTemplateColumns:`repeat(${_.cols.length||1}, minmax(0,1fr))`},children:_.cols.map((A,S)=>{const $=A.length===1;return o.jsx("div",{className:"pointer-events-auto",children:o.jsx("div",{className:["rounded-xl border-2 border-dashed bg-white/60",$?"min-h-[160px]":"py-2"].join(" "),children:o.jsx("div",{className:"flex flex-col gap-2",children:A.map(V=>o.jsx("div",{className:"h-7 rounded-md border border-transparent hover:border-[var(--color-ds-border-default)] hover:bg-white/80 flex items-center justify-center text-ds-xs text-[var(--color-ds-text-secondary)]",onDragOver:z=>z.preventDefault(),onDrop:z=>{z.preventDefault(),z.stopPropagation(),g(V,z),u(!1)},title:`Insertar en Col ${V.colIdx+1}, posición ${V.insertIdx+1}`,children:$?"Soltar aquí":V.insertIdx===A.length-1?"Añadir al final":"Insertar aquí"},V.key))})})},`${_.key}-c${S}`)})},_.key))})()})]})]})}function Gh(e,t,r){const s={...e};return t.top+e.y<=r.top?s.y=r.top-t.top:t.bottom+e.y>=r.top+r.height&&(s.y=r.top+r.height-t.bottom),t.left+e.x<=r.left?s.x=r.left-t.left:t.right+e.x>=r.left+r.width&&(s.x=r.left+r.width-t.right),s}const Jh=e=>{let{transform:t,draggingNodeRect:r,windowRect:s}=e;return!r||!s?t:Gh(t,r,s)};function Zh({children:e}){const t=J(D=>D.moveField),r=J(D=>D.moveFieldInTab),s=J(D=>D.removeFieldFromLayout),n=J(D=>D.removeFieldFromTabLayout),a=J(D=>D.insertExistingFieldAt),i=J(D=>D.insertExistingFieldInTabAt),l=J(D=>D.addField),c=J(D=>D.addFieldAndPlaceInTabAt),d=J(D=>D.placeFieldInTabColumn),u=J(D=>D.placeFieldInColumn),f=J(D=>D.moveFieldAt),p=J(D=>D.removeFieldFromLayoutAt),h=J(D=>D.placeFieldInColumnAt),v=J(D=>D.insertExistingFieldAtAt),x=J(D=>D.addFieldAndPlaceAtAt),g=J(D=>D.moveSection),m=J(D=>D.moveTab),w=J(D=>D.moveTabSection),[y,T]=b.useState(null),[N,_]=b.useState(null),A=Vf(uo(ca,{activationConstraint:{distance:6}}),uo(ia)),S=D=>{var E,te;const P=(te=(E=D==null?void 0:D.active)==null?void 0:E.data)==null?void 0:te.current;P&&T({data:P})},$=D=>{var E,te;const P=(te=(E=D==null?void 0:D.over)==null?void 0:E.data)==null?void 0:te.current;_(P??null)},V=(D,P)=>D===void 0?P:Math.max(0,Math.min(D,P)),z=D=>{var ne,K;const P=(K=(ne=D.active)==null?void 0:ne.data)==null?void 0:K.current;let E=null;switch(P==null?void 0:P.kind){case"rows-section":E=["rows-section"];break;case"tabs-tab":E=["tabs-tab"];break;case"tab-section":E=["tab-section"];break;case"field-in-rows":E=["rows-column"];break;case"field-in-tabs":E=["tabs-column"];break;case"palette-field":E=["rows-column","tabs-column"];break;default:E=null}const te=E==null?D.droppableContainers:D.droppableContainers.filter(le=>{var k,I;const C=(I=(k=le.data)==null?void 0:k.current)==null?void 0:I.scope;return C&&E.includes(C)});return te.length?Gf({...D,droppableContainers:te}):nl(D)},q=D=>{var te,ne,K,le,C,k,I,U;const P=(ne=(te=D==null?void 0:D.active)==null?void 0:te.data)==null?void 0:ne.current,E=(le=(K=D==null?void 0:D.over)==null?void 0:K.data)==null?void 0:le.current;if(T(null),_(null),!(!P||!E)){if(P.kind==="rows-section"&&E.scope==="rows-section"){if(typeof g=="function"&&P.nodeIdx===E.nodeIdx){const G=J.getState().schema.layout[P.nodeIdx],ee=((C=G==null?void 0:G.sections)==null?void 0:C.length)??0;g(P.nodeIdx,P.sIdx,V(E.insertAt,ee))}return}if(P.kind==="tabs-tab"&&E.scope==="tabs-tab"){if(typeof m=="function"&&P.nodeIdx===E.nodeIdx){const G=J.getState().schema.layout[P.nodeIdx],ee=((k=G==null?void 0:G.tabs)==null?void 0:k.length)??0;m(P.nodeIdx,P.index,V(E.insertAt,ee))}return}if(P.kind==="tab-section"&&E.scope==="tab-section"){if(typeof w=="function"&&P.nodeIdx===E.nodeIdx&&P.tabKey===E.tabKey){const G=J.getState().schema.layout[P.nodeIdx],ee=(I=G==null?void 0:G.tabs)==null?void 0:I.find(W=>W.key===P.tabKey),M=((U=ee==null?void 0:ee.sections)==null?void 0:U.length)??0;w(P.nodeIdx,P.tabKey,P.sIdx,V(E.insertAt,M))}return}if(P.kind==="field-in-rows"&&E.scope==="rows-column"){const G=P.rowsNodeIdx??0,ee=E.rowsNodeIdx??G;typeof f=="function"&&G!==ee?f(G,P.path,ee,{s:E.s,r:E.r,c:E.c,idx:E.insertAt}):t(P.path,{s:E.s,r:E.r,c:E.c,idx:E.insertAt});return}if(P.kind==="field-in-tabs"&&E.scope==="tabs-column"&&P.tabKey===E.tabKey){r({tabKey:P.tabKey,...P.path},{tabKey:P.tabKey,s:E.s,r:E.r,c:E.c,idx:E.insertAt});return}if(P.kind==="field-in-tabs"&&E.scope==="tabs-column"&&P.tabKey!==E.tabKey){n({tabKey:P.tabKey,...P.path}),typeof E.insertAt=="number"?i(P.name,E.tabKey,E.s,E.r,E.c,E.insertAt):d(P.name,E.tabKey,E.s,E.r,E.c);return}if(P.kind==="field-in-rows"&&E.scope==="tabs-column"){const G=P.rowsNodeIdx??0;typeof p=="function"?p(G,P.path):s(P.path),typeof E.insertAt=="number"?i(P.name,E.tabKey,E.s,E.r,E.c,E.insertAt):d(P.name,E.tabKey,E.s,E.r,E.c);return}if(P.kind==="field-in-tabs"&&E.scope==="rows-column"){n({tabKey:P.tabKey,...P.path});const G=E.rowsNodeIdx??0;if(typeof v=="function"){const ee=typeof E.insertAt=="number"?E.insertAt:void 0;typeof ee=="number"?v(G,P.name,E.s,E.r,E.c,ee):typeof h=="function"?h(G,P.name,E.s,E.r,E.c):u(P.name,E.s,E.r,E.c)}else typeof E.insertAt=="number"?a(P.name,E.s,E.r,E.c,E.insertAt):u(P.name,E.s,E.r,E.c);return}if(P.kind==="palette-field"){if(E.scope==="rows-column"){const G=E.rowsNodeIdx??0;if(typeof E.insertAt=="number"&&typeof x=="function")x(G,{type:P.factoryKind},E.s,E.r,E.c,E.insertAt);else{const ee=J.getState().schema.fields.length;l({type:P.factoryKind});const M=J.getState().schema.fields[ee];typeof h=="function"?h(G,M.name,E.s,E.r,E.c):u(M.name,E.s,E.r,E.c)}return}if(E.scope==="tabs-column"){if(typeof E.insertAt=="number"&&typeof c=="function")c({type:P.factoryKind},E.tabKey,E.s,E.r,E.c,E.insertAt);else{const G=J.getState().schema.fields.length;l({type:P.factoryKind});const ee=J.getState().schema.fields[G];d(ee.name,E.tabKey,E.s,E.r,E.c)}return}}}};return o.jsxs(Im,{sensors:A,collisionDetection:z,onDragStart:S,onDragOver:$,onDragEnd:q,modifiers:[Jh],children:[e,o.jsx(nh,{children:y?o.jsxs("div",{className:"px-2 py-1 rounded-md border text-[var(--color-ds-text-primary)] border-[var(--color-ds-border-default)] bg-[var(--color-ds-background-surface)] shadow",children:[y.data.kind==="palette-field"&&`Nuevo: ${y.data.factoryKind}`,y.data.kind==="field-in-rows"&&y.data.name,y.data.kind==="field-in-tabs"&&y.data.name,y.data.kind==="rows-section"&&"Sección",y.data.kind==="tabs-tab"&&"Pestaña",y.data.kind==="tab-section"&&"Sección de pestaña"]}):null})]})}function To(e){const r={...e.scope==="rows-column"?{scope:"rows-column",s:e.s,r:e.r,c:e.c,rowsNodeIdx:e.rowsNodeIdx}:{scope:"tabs-column",tabKey:e.tabKey,s:e.s,r:e.r,c:e.c},insertAt:Number.MAX_SAFE_INTEGER},{setNodeRef:s,isOver:n}=Jr({id:JSON.stringify(r),data:r});return o.jsx("div",{ref:s,className:n?"ring-2 ring-[var(--color-ds-border-default)] rounded-md":"","aria-dropeffect":n?"copy":void 0,"data-drop-scope":e.scope,children:e.children})}function us(e){const r={...e.scope==="rows-column"?{scope:"rows-column",rowsNodeIdx:e.rowsNodeIdx,s:e.s,r:e.r,c:e.c}:{scope:"tabs-column",tabKey:e.tabKey,s:e.s,r:e.r,c:e.c},insertAt:e.insertAt},{setNodeRef:s,isOver:n}=Jr({id:JSON.stringify(r),data:r});return o.jsx("div",{ref:s,role:"button","aria-dropeffect":n?"copy":void 0,"aria-label":`Soltar aquí (posición ${e.insertAt+1})`,"data-drop-scope":e.scope,"data-insert-at":e.insertAt,className:["h-2 my-1 w-full","rounded-sm transition",n?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent","relative -mx-1 px-1"].join(" ")})}function _o(e){const t=e.kind==="field-in-tabs"?`${e.kind}:${e.tabKey}:${e.name}:${e.path.s}-${e.path.r}-${e.path.c}-${e.path.idx}`:`${e.kind}:${e.rowsNodeIdx}:${e.name}:${e.path.s}-${e.path.r}-${e.path.c}-${e.path.idx}`,r=e.kind==="field-in-rows"?{kind:e.kind,name:e.name,path:e.path,rowsNodeIdx:e.rowsNodeIdx}:{kind:e.kind,name:e.name,path:e.path,tabKey:e.tabKey},{attributes:s,listeners:n,setNodeRef:a,isDragging:i}=Gr({id:t,data:r});return o.jsxs("div",{ref:a,className:["text-[var(--color-ds-text-primary)] group flex items-center justify-between gap-2 rounded-md px-2 py-1 w-100",i?"opacity-50":"opacity-100"].join(" "),"data-field-name":e.name,children:[o.jsx("button",{type:"button",className:"text-[var(--color-ds-text-primary)] text-ds-sm hover:underline text-left truncate",title:e.name,onClick:e.onSelect,children:e.name}),o.jsx("div",{...n,...s,role:"button","aria-grabbed":i,"aria-label":`Arrastrar campo ${e.name}`,className:["text-[var(--color-ds-text-primary)] text-[10px] select-none cursor-grab active:cursor-grabbing","px-1 py-0.5 rounded-sm","hover:bg-[var(--color-ds-background-muted)]","focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-500)]"].join(" "),title:"Arrastra para reordenar",children:"⇅"})]})}function Fo({nodeIdx:e,insertAt:t}){const r={scope:"rows-section",nodeIdx:e,insertAt:t},{setNodeRef:s,isOver:n}=Jr({id:`rows-section:${e}:${t}`,data:r});return o.jsx("div",{ref:s,className:["h-2 my-1 w-full rounded-sm transition relative -mx-1 px-1",n?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent"].join(" "),"aria-label":`Insertar sección en posición ${t+1}`})}function Yh({nodeIdx:e,sIdx:t}){const r=`rows-section:${e}:${t}`,s={kind:"rows-section",nodeIdx:e,sIdx:t},{attributes:n,listeners:a,setNodeRef:i,isDragging:l}=Gr({id:r,data:s});return o.jsx("div",{ref:i,...n,...a,role:"button",title:"Arrastrar sección","aria-grabbed":l,className:"shrink-0 w-6 h-6 grid place-items-center cursor-grab active:cursor-grabbing rounded hover:bg-[var(--color-ds-background-muted)]",children:"⇅"})}function Oo({nodeIdx:e,insertAt:t}){const r={scope:"tabs-tab",nodeIdx:e,insertAt:t},{setNodeRef:s,isOver:n}=Jr({id:`tabs-tab:${e}:${t}`,data:r});return o.jsx("div",{ref:s,className:["w-8 h-7 rounded-md transition",n?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent"].join(" "),title:`Insertar pestaña en posición ${t+1}`})}function Hh({nodeIdx:e,index:t,tabKey:r,label:s}){const n=`tabs-tab:${e}:${t}:${r}`,a={kind:"tabs-tab",nodeIdx:e,index:t,tabKey:r},{attributes:i,listeners:l,setNodeRef:c,isDragging:d}=Gr({id:n,data:a});return o.jsxs("div",{ref:c,...i,...l,"aria-grabbed":d,className:["px-2 h-7 inline-flex items-center rounded-full border text-ds-xs cursor-grab active:cursor-grabbing","border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",d?"opacity-50":"opacity-100"].join(" "),title:`Arrastrar pestaña "${s}"`,children:[o.jsx("span",{className:"mr-1",children:"⇅"})," ",s]})}function pn({nodeIdx:e,tabKey:t,insertAt:r}){const s={scope:"tab-section",nodeIdx:e,tabKey:t,insertAt:r},{setNodeRef:n,isOver:a}=Jr({id:`tab-section:${e}:${t}:${r}`,data:s});return o.jsx("div",{ref:n,className:["h-2 my-1 w-full rounded-sm transition relative -mx-1 px-1",a?"bg-[var(--color-ds-border-default)]/30 ring-1 ring-[var(--color-ds-border-default)]":"bg-transparent"].join(" "),"aria-label":`Insertar sección de pestaña en posición ${r+1}`})}function Xh({nodeIdx:e,tabKey:t,sIdx:r}){const s=`tab-section:${e}:${t}:${r}`,n={kind:"tab-section",nodeIdx:e,tabKey:t,sIdx:r},{attributes:a,listeners:i,setNodeRef:l,isDragging:c}=Gr({id:s,data:n});return o.jsx("div",{ref:l,...a,...i,title:"Arrastrar sección de pestaña","aria-grabbed":c,className:"shrink-0 w-6 h-6 grid place-items-center cursor-grab active:cursor-grabbing rounded hover:bg-[var(--color-ds-background-muted)]",children:"⇅"})}const Ro=e=>e<=1?["w-full"]:e===2?["w-1/2","w-1/2"]:e===3?["w-1/3","w-1/3","w-1/3"]:Array.from({length:e},()=>"flex-1"),Do=[1,2,3,4];function bn({expanded:e,onClick:t,labelExpanded:r,labelCollapsed:s,titleExpanded:n,titleCollapsed:a,className:i=""}){return o.jsx(ie,{size:"xs",variant:"ghost","aria-expanded":e,"aria-label":e?r:s,onClick:t,title:e?n??"Colapsar":a??"Expandir",className:`shrink-0 w-8 h-8 p-0 grid place-items-center ${i}`,children:o.jsx(Rs,{className:`w-4 h-4 text-[var(--color-ds-text-primary)] transition-transform duration-150 ${e?"rotate-180":""}`})})}function Qh(){const e=J(M=>M.schema),t=J(M=>M.placeFieldInColumn),r=J(M=>M.removeFieldFromLayout),s=J(M=>M.addColumnToRow),n=J(M=>M.setRowColumns),a=J(M=>M.removeColumn),i=J(M=>M.setSelection),l=J(M=>M.renameSection||M.setSectionTitle),c=J(M=>M.removeSection);J(M=>M.duplicateSection),J(M=>M.addRowToSection);const d=J(M=>M.addTabAfter),u=J(M=>M.removeTab),f=J(M=>M.renameTab),p=J(M=>M.addSectionToTab);J(M=>M.addRowToTabSection);const h=J(M=>M.renameTabSection),v=J(M=>M.setTabRowColumns),x=J(M=>M.addColumnToTabRow),g=J(M=>M.removeTabColumn),m=J(M=>M.placeFieldInTabColumn),w=J(M=>M.removeFieldFromTabLayout);J(M=>M.addRowsBlockAt),J(M=>M.addTabsContainerAt);const y=J(M=>M.removeLayoutNode);J(M=>M.duplicateRowInSection);const T=J(M=>M.removeRowFromSection),N=J(M=>M.duplicateTabRow),_=J(M=>M.removeTabRow),[A,S]=b.useState({}),[$,V]=b.useState({}),[z,q]=b.useState({}),[D,P]=b.useState({}),E=(M,W)=>`${M}:${W}`,te=(M,W,me)=>`${M}:${W}:${me}`,ne=(M,W)=>V(me=>({...me,[E(M,W)]:!me[E(M,W)]})),K=(M,W)=>!!$[E(M,W)],le=(M,W,me)=>q(be=>({...be,[te(M,W,me)]:!be[te(M,W,me)]})),C=(M,W,me)=>!!z[te(M,W,me)],k=M=>P(W=>({...W,[M]:!W[M]})),I=M=>!!D[M],U=(M,W)=>l==null?void 0:l(M,W),G=M=>c==null?void 0:c(M),ee=b.useMemo(()=>[...e.fields].reverse().find(M=>M.type!=="inputGroup"&&M.type!=="button"),[e.fields]);return o.jsx(Zh,{children:o.jsxs("div",{className:"space-y-3",children:[o.jsx(gn,{at:0}),e.layout.map((M,W)=>{var me;if(M.type==="rows")return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Fo,{nodeIdx:W,insertAt:0}),M.sections.map((be,de)=>o.jsxs(b.Fragment,{children:[o.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsx("div",{className:"pr-3 bg-[var(--color-ds-background-surface)] border-b border-[var(--color-ds-border-default-50)]",children:o.jsxs("div",{className:"flex items-center gap-2 min-h-9 py-1",children:[o.jsx(bn,{expanded:!K(W,de),onClick:()=>ne(W,de),labelExpanded:"Colapsar sección",labelCollapsed:"Expandir sección"}),o.jsx(Yh,{nodeIdx:W,sIdx:de}),o.jsx(we,{size:"sm",labelHidden:!0,placeholder:"Sección",value:be.sectionTitle??"",onChange:ke=>U(de,ke.target.value),onBlur:ke=>U(de,ke.target.value.trim()||"Sección"),reserveErrorSpace:!1}),o.jsx("div",{className:"flex flex-wrap gap-1 ml-auto",children:o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>G(de),title:"Eliminar sección",children:"✕"})})]})}),K(W,de)?null:o.jsx("div",{className:"space-y-4 bg-[var(--color-ds-background-page)]",children:be.rows.map((ke,ge)=>{const he=ke.columns??[],fe=he.length===0,pe=Ro(he.length);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"px-3 py-2 flex items-center gap-3 bg-[var(--color-ds-background)] border-b border-[var(--color-ds-border-default-50)]",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-wrap flex-1 min-w-0",children:[o.jsxs("span",{className:"text-[11px] leading-none uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:["Fila ",ge+1]}),o.jsx("div",{className:"h-3 w-px bg-[var(--color-ds-border-default-50)]"}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[Do.map(ye=>o.jsx(ie,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>n(de,ge,ye),title:`${ye} columna(s)`,children:ye},ye)),o.jsx(ie,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>s(de,ge),title:"Añadir columna",children:"+ columna"})]})]}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>T==null?void 0:T(de,ge),title:"Eliminar fila",children:"✕"})]}),fe?o.jsx("div",{className:"rounded-md border border-dashed p-6 text-center border-[var(--color-ds-border-default-50)] text-[var(--color-ds-text-secondary)]",children:"No hay columnas. Usa “+ columna”."}):o.jsx("div",{className:"space-y-3",children:he.map((ye,ce)=>o.jsx(To,{scope:"rows-column",rowsNodeIdx:W,s:de,r:ge,c:ce,children:o.jsxs("div",{className:"rounded-lg border bg-[var(--color-ds-background-page)] border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--color-ds-background-surface)]",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"inline-flex items-center justify-center text-[10px] leading-none px-1.5 py-0.5 rounded-full border text-[var(--color-ds-text-primary)] border-[var(--color-ds-border-default-50)]",children:["Col ",ce+1]}),o.jsx("span",{className:"text-[10px] leading-none text-[var(--color-ds-text-secondary)]",children:ye.width||pe[ce]||"flex-1"})]}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>a(de,ge,ce),title:"Eliminar columna",children:"✕"})]}),o.jsxs("div",{className:"p-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(us,{scope:"rows-column",rowsNodeIdx:W,s:de,r:ge,c:ce,insertAt:0}),(ye.fields??[]).length===0&&o.jsx("div",{className:"text-center text-[12px] text-[var(--color-ds-text-secondary)] border border-dashed border-[var(--color-ds-border-default-50)] rounded-md py-4",children:"Suelta campos aquí"}),(ye.fields??[]).map((Se,Te)=>{const j=typeof Se=="string"?Se:Se.name;return o.jsxs(b.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)] px-2 py-1",children:[o.jsx(_o,{kind:"field-in-rows",rowsNodeIdx:W,name:j,path:{s:de,r:ge,c:ce,idx:Te},onSelect:()=>i({kind:"field",name:j})}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>r({s:de,r:ge,c:ce,idx:Te}),title:"Quitar del layout",children:"✕"})]}),o.jsx(us,{scope:"rows-column",rowsNodeIdx:W,s:de,r:ge,c:ce,insertAt:Te+1})]},`${j}-${Te}`)})]}),o.jsx("div",{className:"mt-2",children:o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>(ee==null?void 0:ee.name)&&t(ee.name,de,ge,ce),title:"Colocar el último campo creado en esta columna",children:"Colocar último campo"})})]})]})},`col-${W}-${de}-${ge}-${ce}`))})]},ge)})})]}),o.jsx(Fo,{nodeIdx:W,insertAt:de+1})]},`rows-sec-${W}-${de}`))]}),o.jsx(gn,{at:W+1})]},`rows-${W}`);if(M.type==="tabs"){const be=M.tabs.map(ge=>({label:ge.label,value:ge.key})),de=(me=M.tabs[0])==null?void 0:me.key,ke=A[W]??de??"";return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsx("div",{className:"bg-[var(--color-ds-background-surface)] border-b border-[var(--color-ds-border-default-50)]",children:o.jsxs("div",{className:"flex items-center gap-2 min-h-9 py-1 pr-2",children:[o.jsx(bn,{expanded:!I(W),onClick:()=>k(W),labelExpanded:"Colapsar pestañas",labelCollapsed:"Expandir pestañas"}),o.jsx("span",{className:"text-[11px] leading-none uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:"Pestañas"}),o.jsx("div",{className:"ml-auto",children:o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>y(W),title:"Eliminar bloque",children:"✕"})})]})}),I(W)?null:o.jsxs("div",{className:"bg-[var(--color-ds-background)]",children:[o.jsxs("div",{className:"px-2 py-2 flex items-center gap-2 border-b border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",children:[o.jsx("span",{className:"text-[11px] uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:"Orden pestañas"}),o.jsx(Oo,{nodeIdx:W,insertAt:0}),M.tabs.map((ge,he)=>o.jsxs(b.Fragment,{children:[o.jsx(Hh,{nodeIdx:W,index:he,tabKey:ge.key,label:ge.label}),o.jsx(Oo,{nodeIdx:W,insertAt:he+1})]},`tabchip-${W}-${ge.key}`))]}),o.jsx("div",{className:"border-b border-[var(--color-ds-border-default-50)]",children:o.jsx(Ir,{options:be,value:ke,onChange:ge=>S(he=>({...he,[W]:ge})),children:M.tabs.reduce((ge,he)=>(ge[he.key]=o.jsxs("div",{className:"space-y-3",children:[ke===he.key&&o.jsxs("div",{className:"p-2 flex flex-wrap items-center gap-2",children:[o.jsx(we,{size:"sm",label:"Nombre pestaña",value:he.label,onChange:fe=>f==null?void 0:f(he.key,fe.target.value),className:"w-48",reserveErrorSpace:!1}),o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>d==null?void 0:d(he.key),children:"+ pestaña"}),o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>p==null?void 0:p(he.key,"Nueva sección"),children:"+ sección"}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>u==null?void 0:u(he.key),disabled:M.tabs.length<=1,children:"eliminar pestaña"})]}),he.sections.length===0?o.jsx("div",{className:"px-2",children:o.jsx(pn,{nodeIdx:W,tabKey:he.key,insertAt:0})}):null,he.sections.map((fe,pe)=>o.jsxs(b.Fragment,{children:[pe===0?o.jsx("div",{className:"px-2",children:o.jsx(pn,{nodeIdx:W,tabKey:he.key,insertAt:0})}):null,o.jsxs("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsx("div",{className:"bg-[var(--color-ds-background-surface)] border-b border-[var(--color-ds-border-default-50)]",children:o.jsxs("div",{className:"flex items-center gap-2 min-h-9 py-1",children:[o.jsx(bn,{expanded:!C(W,he.key,pe),onClick:()=>le(W,he.key,pe),labelExpanded:"Colapsar sección",labelCollapsed:"Expandir sección",className:"ml-2"}),o.jsx(Xh,{nodeIdx:W,tabKey:he.key,sIdx:pe}),o.jsx(we,{size:"sm",labelHidden:!0,placeholder:"Sección",value:fe.sectionTitle??"",onChange:ye=>h==null?void 0:h(he.key,pe,ye.target.value),onBlur:ye=>h==null?void 0:h(he.key,pe,ye.target.value.trim()||"Sección"),reserveErrorSpace:!1})]})}),C(W,he.key,pe)?null:o.jsx("div",{className:"space-y-4 bg-[var(--color-ds-background-page)]",children:fe.rows.map((ye,ce)=>{const Se=ye.columns??[],Te=Se.length===0,j=Ro(Se.length);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"px-3 py-2 flex items-center gap-3 bg-[var(--color-ds-background)] border-b border-[var(--color-ds-border-default-50)]",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-wrap flex-1 min-w-0",children:[o.jsxs("span",{className:"text-[11px] leading-none uppercase tracking-wide text-[var(--color-ds-text-secondary)]",children:["Fila ",ce+1]}),o.jsx("div",{className:"h-3 w-px bg-[var(--color-ds-border-default-50)]"}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[Do.map(F=>o.jsx(ie,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>v==null?void 0:v(he.key,pe,ce,F),title:`${F} columna(s)`,children:F},F)),o.jsx(ie,{size:"xs",variant:"outline",className:"rounded-full px-2 py-0.5",onClick:()=>x==null?void 0:x(he.key,pe,ce),title:"Añadir columna",children:"+ columna"})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(ie,{size:"xs",variant:"subtle",onClick:()=>N==null?void 0:N(he.key,pe,ce),title:"Duplicar fila",children:"duplicar"}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>_==null?void 0:_(he.key,pe,ce),title:"Eliminar fila",children:"eliminar"})]})]}),Te?o.jsx("div",{className:"rounded-md border border-dashed p-6 text-center border-[var(--color-ds-border-default-50)] text-[var(--color-ds-text-secondary)]",children:"No hay columnas. Usa “+ columna”."}):o.jsx("div",{className:"space-y-3",children:Se.map((F,R)=>o.jsx(To,{scope:"tabs-column",tabKey:he.key,s:pe,r:ce,c:R,children:o.jsxs("div",{className:"rounded-lg border bg-[var(--color-ds-background-page)] border-[var(--color-ds-border-default-50)] overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--color-ds-background-surface)]",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"inline-flex items-center justify-center text-[10px] leading-none px-1.5 py-0.5 rounded-full border border-[var(--color-ds-border-default-50)]",children:["Col ",R+1]}),o.jsx("span",{className:"text-[10px] leading-none text-[var(--color-ds-text-secondary)]",children:F.width||j[R]||"flex-1"})]}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>g==null?void 0:g(he.key,pe,ce,R),children:"✕"})]}),o.jsxs("div",{className:"p-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(us,{scope:"tabs-column",tabKey:he.key,s:pe,r:ce,c:R,insertAt:0}),(F.fields??[]).length===0&&o.jsx("div",{className:"text-center text-[12px] text-[var(--color-ds-text-secondary)] border border-dashed border-[var(--color-ds-border-default-50)] rounded-md py-4",children:"Suelta campos aquí"}),(F.fields??[]).map((X,Y)=>{const Z=typeof X=="string"?X:X.name;return o.jsxs(b.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)] px-2 py-1",children:[o.jsx(_o,{kind:"field-in-tabs",tabKey:he.key,name:Z,path:{s:pe,r:ce,c:R,idx:Y},onSelect:()=>i({kind:"field",name:Z})}),o.jsx(ie,{size:"xs",variant:"danger",onClick:()=>w==null?void 0:w({tabKey:he.key,s:pe,r:ce,c:R,idx:Y}),children:"✕"})]}),o.jsx(us,{scope:"tabs-column",tabKey:he.key,s:pe,r:ce,c:R,insertAt:Y+1})]},`${Z}-${Y}`)})]}),o.jsx("div",{className:"mt-2",children:o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>(ee==null?void 0:ee.name)&&(m==null?void 0:m(ee.name,he.key,pe,ce,R)),children:"Colocar último campo"})})]})]})},`tcol-${he.key}-${ce}-${R}`))})]},`trow-${he.key}-${ce}`)})})]}),o.jsx("div",{className:"px-2",children:o.jsx(pn,{nodeIdx:W,tabKey:he.key,insertAt:pe+1})})]},`tsec-${he.key}-${pe}`))]}),ge),{})})})]})]}),o.jsx(gn,{at:W+1})]},`tabs-${W}`)}return null})]})})}function gn({at:e}){const t=J(s=>s.addRowsBlockAt),r=J(s=>s.addTabsContainerAt);return o.jsxs("div",{className:"my-2 flex items-center justify-center gap-2",children:[o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>t(e,"Sección"),title:"Añadir sección aquí",children:"+ Sección aquí"}),o.jsx(ie,{size:"xs",variant:"outline",onClick:()=>r(e),title:"Añadir pestañas aquí",children:"+ Pestañas aquí"})]})}function ep(){const e=J(r=>r.schema),t=b.useMemo(()=>{try{const r=Oi(e);return pi(r)}catch{return}},[e]);return o.jsxs("div",{className:"grid grid-rows-[auto_1fr] h-[calc(100vh-80px)]",children:[o.jsx(Wh,{}),o.jsxs("div",{className:"grid grid-cols-[260px_1fr_320px] min-h-0",children:[o.jsxs("div",{className:"overflow-auto border-r border-[var(--color-ds-border-default)] ",children:[o.jsx(Nh,{}),o.jsx("div",{className:"h-px bg-[var(--color-ds-border-default-50)] my-2"}),o.jsx(Qh,{})]}),o.jsxs(Kh,{className:"overflow-auto",children:[o.jsx("div",{className:"px-4 py-2 border-b text-[var(--color-ds-text-primary)] bg-[var(--color-ds-background-surface)] flex items-center gap-2",children:o.jsx("strong",{children:"Preview"})}),o.jsx("div",{className:"p-4",children:o.jsx(zi,{schema:e,resolver:t})})]}),o.jsx(Lh,{})]})]})}function tp({title:e="Form Schema Editor",baseDir:t="src/schemas",fs:r,services:s,onSchemaChange:n,rightPanel:a,rightPanelWidth:i="320px",rightPanelDefaultOpen:l=!1,rightPanelOpen:c,onRightPanelOpenChange:d,className:u}){const f=J(T=>T.schema),p=typeof c=="boolean",[h,v]=b.useState(l),x=p?c:h,g=T=>{p||v(T),d==null||d(T)};b.useEffect(()=>{n==null||n(f)},[f,n]),b.useEffect(()=>{(!(r!=null&&r.list)||!(r!=null&&r.read)||!(r!=null&&r.write)||!(r!=null&&r.remove))&&console.warn("[SchemaEditorHost] fs adapter incompleto."),s!=null&&s.registry||console.warn("[SchemaEditorHost] services.adapter sin registry.")},[r,s]);const m=!!a,w=a&&x?{paddingRight:i}:void 0,y={width:i};return o.jsx($u,{value:{fs:r,services:s,baseDir:t},children:o.jsxs("div",{className:["grid grid-rows-[auto_1fr] h-full min-h-[480px]",u].filter(Boolean).join(" "),children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-[var(--color-ds-border-default)] border-b bg-[var(--color-ds-background-page)]",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("h1",{className:"text-lg font-semibold text-[var(--color-ds-text-primary)]",children:e}),m&&o.jsx("button",{type:"button",onClick:()=>g(!x),className:`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs\r
75
75
  border-[var(--color-ds-border-default-50)]\r
76
76
  text-[var(--color-ds-text-primary)]\r
77
- hover:bg-[var(--color-ds-background-surface)]`,title:g?"Ocultar panel":"Mostrar panel","aria-pressed":g,"aria-label":"Alternar panel derecho",children:g?o.jsxs(o.Fragment,{children:[o.jsx(Mo,{className:"w-4 h-4"}),"Ocultar panel"]}):o.jsxs(o.Fragment,{children:[o.jsx(Gl,{className:"w-4 h-4"}),"Mostrar panel"]})})]}),o.jsxs("div",{className:"text-xs text-[var(--color-ds-text-secondary)]",children:["baseDir: ",o.jsx("code",{children:t})]})]}),o.jsxs("div",{className:"relative min-h-0",children:[o.jsx("div",{className:"min-h-0 h-full overflow-hidden",style:w,children:o.jsx(Qh,{})}),a&&g&&o.jsx("aside",{className:"absolute inset-y-0 right-0 border-l min-h-0 overflow-auto bg-[var(--color-ds-background-page)]",style:y,children:a})]})]})})}function tp({name:e,canUp:t,canDown:r,canLeft:s,canRight:n,onSelect:a,onUp:i,onDown:l,onLeft:c,onRight:d,onDuplicate:u,onRemove:f}){return o.jsxs("div",{className:`group flex items-center justify-between gap-2 rounded-md border px-2 py-1\r
77
+ hover:bg-[var(--color-ds-background-surface)]`,title:x?"Ocultar panel":"Mostrar panel","aria-pressed":x,"aria-label":"Alternar panel derecho",children:x?o.jsxs(o.Fragment,{children:[o.jsx($o,{className:"w-4 h-4"}),"Ocultar panel"]}):o.jsxs(o.Fragment,{children:[o.jsx(Jl,{className:"w-4 h-4"}),"Mostrar panel"]})})]}),o.jsxs("div",{className:"text-xs text-[var(--color-ds-text-secondary)]",children:["baseDir: ",o.jsx("code",{children:t})]})]}),o.jsxs("div",{className:"relative min-h-0",children:[o.jsx("div",{className:"min-h-0 h-full overflow-hidden",style:w,children:o.jsx(ep,{})}),a&&x&&o.jsx("aside",{className:"absolute inset-y-0 right-0 border-l min-h-0 overflow-auto bg-[var(--color-ds-background-page)]",style:y,children:a})]})]})})}function rp({name:e,canUp:t,canDown:r,canLeft:s,canRight:n,onSelect:a,onUp:i,onDown:l,onLeft:c,onRight:d,onDuplicate:u,onRemove:f}){return o.jsxs("div",{className:`group flex items-center justify-between gap-2 rounded-md border px-2 py-1\r
78
78
  bg-[var(--color-ds-background-surface)]\r
79
79
  border-[var(--color-ds-border-default)]\r
80
- text-[var(--color-ds-text-primary)]`,children:[o.jsxs("button",{type:"button",className:"flex items-center gap-2 text-sm hover:underline",onClick:a,children:[o.jsx(ec,{className:"h-4 w-4 opacity-70"}),e]}),o.jsxs("div",{className:"invisible group-hover:visible flex items-center gap-1",children:[o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Subir",icon:Bl,disabled:!t,onClick:i}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Bajar",icon:$l,disabled:!r,onClick:l}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Izquierda",icon:Pl,disabled:!s,onClick:c}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Derecha",icon:Il,disabled:!n,onClick:d}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Duplicar",icon:uc,onClick:u}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Quitar",icon:pc,onClick:f})]})]})}function zn({widthLabel:e,fields:t,indices:r,canMoveLeft:s,canMoveRight:n,onSelect:a,onMove:i,onDuplicate:l,onRemoveAt:c,onPlaceLast:d,placeDisabled:u,readOnly:f=!1}){const{sIdx:h,rIdx:p,cIdx:v}=r;return o.jsxs("div",{className:`flex-1 rounded-lg p-2 border border-dashed\r
80
+ text-[var(--color-ds-text-primary)]`,children:[o.jsxs("button",{type:"button",className:"flex items-center gap-2 text-sm hover:underline",onClick:a,children:[o.jsx(tc,{className:"h-4 w-4 opacity-70"}),e]}),o.jsxs("div",{className:"invisible group-hover:visible flex items-center gap-1",children:[o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Subir",icon:Ul,disabled:!t,onClick:i}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Bajar",icon:Ll,disabled:!r,onClick:l}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Izquierda",icon:zl,disabled:!s,onClick:c}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Derecha",icon:Vl,disabled:!n,onClick:d}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Duplicar",icon:fc,onClick:u}),o.jsx(ie,{type:"button",variant:"ghost",ariaLabel:"Quitar",icon:bc,onClick:f})]})]})}function In({widthLabel:e,fields:t,indices:r,canMoveLeft:s,canMoveRight:n,onSelect:a,onMove:i,onDuplicate:l,onRemoveAt:c,onPlaceLast:d,placeDisabled:u,readOnly:f=!1}){const{sIdx:p,rIdx:h,cIdx:v}=r;return o.jsxs("div",{className:`flex-1 rounded-lg p-2 border border-dashed\r
81
81
  bg-[var(--color-ds-background-page)]\r
82
- border-[var(--color-ds-border-muted)]`,children:[o.jsx("div",{className:"text-[10px] mb-2 text-[var(--color-ds-text-secondary)]",children:e||"flex-1"}),o.jsx("ul",{className:"space-y-1",children:t.map((g,x)=>o.jsx("li",{children:o.jsx(tp,{name:g,canUp:x>0,canDown:x<t.length-1,canLeft:s,canRight:n,onSelect:()=>a(g),onUp:()=>i({s:h,r:p,c:v,idx:x},{idx:x-1}),onDown:()=>i({s:h,r:p,c:v,idx:x},{idx:x+1}),onLeft:()=>s&&i({s:h,r:p,c:v,idx:x},{c:v-1,idx:void 0}),onRight:()=>n&&i({s:h,r:p,c:v,idx:x},{c:v+1,idx:void 0}),onDuplicate:()=>l(g),onRemove:()=>c({s:h,r:p,c:v,idx:x})})},`${g}-${x}`))}),o.jsx("div",{className:"mt-3",children:o.jsx(ie,{type:"button",variant:"outline",onClick:d,disabled:f||u,"aria-disabled":f||u,children:"Colocar último campo"})})]})}const rp=e=>e.type!=="inputGroup"&&e.type!=="button";function sp(){const e=J(u=>u.schema),t=J(u=>u.setSelection),r=J(u=>u.moveField),s=J(u=>u.removeFieldFromLayout),n=J(u=>u.placeFieldInColumn),a=J(u=>u.duplicateField),[i,l]=b.useState({}),c=b.useMemo(()=>[...e.fields].reverse().find(rp),[e.fields]),d=b.useMemo(()=>{const u=[];return e.layout.forEach((f,h)=>{var p;if(f.type==="rows"&&f.sections.forEach((v,g)=>{const x=o.jsx("div",{className:"space-y-2",children:v.rows.map((m,w)=>o.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${m.columns.length}, minmax(0, 1fr))`},children:m.columns.map((y,T)=>o.jsx(zn,{widthLabel:y.width||"flex-1",fields:y.fields??[],indices:{sIdx:g,rIdx:w,cIdx:T},canMoveLeft:T>0,canMoveRight:T<m.columns.length-1,onSelect:N=>t({kind:"field",name:N}),onMove:(N,_)=>r(N,{s:N.s,r:N.r,c:_.c??N.c,idx:_.idx}),onDuplicate:N=>a(N,`${N}_copy`),onRemoveAt:N=>s(N),onPlaceLast:()=>(c==null?void 0:c.name)&&n(c.name,g,w,T),placeDisabled:!(c!=null&&c.name)},`col-${g}-${w}-${T}`))},`row-${g}-${w}`))});u.push({id:`rows-${h}-sec-${g}`,title:v.sectionTitle,defaultOpen:v.defaultOpen,content:x})}),f.type==="tabs"){const v=f.tabs.map(y=>({label:y.label,value:y.key})),g=(p=f.tabs[0])==null?void 0:p.key,x=i[h]??g,m={};f.tabs.forEach(y=>{const T=o.jsx("div",{className:"space-y-4",children:y.sections.map((N,_)=>o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"text-ds-sm font-medium text-[var(--color-ds-text-primary)]",children:N.sectionTitle}),N.rows.map((A,S)=>o.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${A.columns.length}, minmax(0, 1fr))`},children:A.columns.map(($,V)=>o.jsx(zn,{widthLabel:$.width||"flex-1",fields:$.fields??[],indices:{sIdx:0,rIdx:0,cIdx:0},canMoveLeft:!1,canMoveRight:!1,onSelect:z=>t({kind:"field",name:z}),onMove:()=>{},onDuplicate:()=>{},onRemoveAt:()=>{},onPlaceLast:()=>{},placeDisabled:!0,readOnly:!0},`tab-${y.key}-col-${S}-${V}`))},`tab-${y.key}-row-${S}`))]},`tab-${y.key}-sec-${_}`))});m[y.key]=T});const w=o.jsx("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)]",children:o.jsx("div",{className:"p-2 border-b border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",children:o.jsx(zr,{options:v,value:x,onChange:y=>l(T=>({...T,[h]:y})),children:m})})});u.push({id:`tabs-${h}`,title:"Contenedor de pestañas",defaultOpen:!0,content:w})}}),u},[e.layout,c==null?void 0:c.name,a,r,n,s,t,i]);return o.jsx("div",{className:"p-3",children:o.jsx(Ki,{items:d})})}exports.Button=ie;exports.Canvas=sp;exports.Checkbox=dt;exports.CollapsibleSection=it;exports.ColumnDropZone=zn;exports.CompactAccordion=Ki;exports.DateInput=_r;exports.DropdownMenu=xd;exports.FileUploader=fi;exports.FormFieldInput=Yn;exports.FormPageLayout=zd;exports.FormRenderer=Pi;exports.Header=Ui;exports.Icon=kt;exports.IconButton=zi;exports.InfoButton=Zn;exports.Input=we;exports.InputGroup=Oi;exports.LoadingScreen=Xu;exports.Modal=Qu;exports.OptionGroup=Ri;exports.PageLayout=rf;exports.SchemaEditorHost=ep;exports.SearchField=Li;exports.Select=rt;exports.Sidebar=qi;exports.SidebarNav=Xn;exports.SkeletonLoader=Xt;exports.Table=sf;exports.Tabs=zr;exports.TextArea=$s;exports.ThemeProvider=Hu;exports.ThemeToggle=Ii;exports.Toast=Di;exports.ToastProvider=_u;exports.ToggleSwitch=Wi;exports.useToast=Ir;
82
+ border-[var(--color-ds-border-muted)]`,children:[o.jsx("div",{className:"text-[10px] mb-2 text-[var(--color-ds-text-secondary)]",children:e||"flex-1"}),o.jsx("ul",{className:"space-y-1",children:t.map((x,g)=>o.jsx("li",{children:o.jsx(rp,{name:x,canUp:g>0,canDown:g<t.length-1,canLeft:s,canRight:n,onSelect:()=>a(x),onUp:()=>i({s:p,r:h,c:v,idx:g},{idx:g-1}),onDown:()=>i({s:p,r:h,c:v,idx:g},{idx:g+1}),onLeft:()=>s&&i({s:p,r:h,c:v,idx:g},{c:v-1,idx:void 0}),onRight:()=>n&&i({s:p,r:h,c:v,idx:g},{c:v+1,idx:void 0}),onDuplicate:()=>l(x),onRemove:()=>c({s:p,r:h,c:v,idx:g})})},`${x}-${g}`))}),o.jsx("div",{className:"mt-3",children:o.jsx(ie,{type:"button",variant:"outline",onClick:d,disabled:f||u,"aria-disabled":f||u,children:"Colocar último campo"})})]})}const sp=e=>e.type!=="inputGroup"&&e.type!=="button";function np(){const e=J(u=>u.schema),t=J(u=>u.setSelection),r=J(u=>u.moveField),s=J(u=>u.removeFieldFromLayout),n=J(u=>u.placeFieldInColumn),a=J(u=>u.duplicateField),[i,l]=b.useState({}),c=b.useMemo(()=>[...e.fields].reverse().find(sp),[e.fields]),d=b.useMemo(()=>{const u=[];return e.layout.forEach((f,p)=>{var h;if(f.type==="rows"&&f.sections.forEach((v,x)=>{const g=o.jsx("div",{className:"space-y-2",children:v.rows.map((m,w)=>o.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${m.columns.length}, minmax(0, 1fr))`},children:m.columns.map((y,T)=>o.jsx(In,{widthLabel:y.width||"flex-1",fields:y.fields??[],indices:{sIdx:x,rIdx:w,cIdx:T},canMoveLeft:T>0,canMoveRight:T<m.columns.length-1,onSelect:N=>t({kind:"field",name:N}),onMove:(N,_)=>r(N,{s:N.s,r:N.r,c:_.c??N.c,idx:_.idx}),onDuplicate:N=>a(N,`${N}_copy`),onRemoveAt:N=>s(N),onPlaceLast:()=>(c==null?void 0:c.name)&&n(c.name,x,w,T),placeDisabled:!(c!=null&&c.name)},`col-${x}-${w}-${T}`))},`row-${x}-${w}`))});u.push({id:`rows-${p}-sec-${x}`,title:v.sectionTitle,defaultOpen:v.defaultOpen,content:g})}),f.type==="tabs"){const v=f.tabs.map(y=>({label:y.label,value:y.key})),x=(h=f.tabs[0])==null?void 0:h.key,g=i[p]??x,m={};f.tabs.forEach(y=>{const T=o.jsx("div",{className:"space-y-4",children:y.sections.map((N,_)=>o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"text-ds-sm font-medium text-[var(--color-ds-text-primary)]",children:N.sectionTitle}),N.rows.map((A,S)=>o.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${A.columns.length}, minmax(0, 1fr))`},children:A.columns.map(($,V)=>o.jsx(In,{widthLabel:$.width||"flex-1",fields:$.fields??[],indices:{sIdx:0,rIdx:0,cIdx:0},canMoveLeft:!1,canMoveRight:!1,onSelect:z=>t({kind:"field",name:z}),onMove:()=>{},onDuplicate:()=>{},onRemoveAt:()=>{},onPlaceLast:()=>{},placeDisabled:!0,readOnly:!0},`tab-${y.key}-col-${S}-${V}`))},`tab-${y.key}-row-${S}`))]},`tab-${y.key}-sec-${_}`))});m[y.key]=T});const w=o.jsx("div",{className:"rounded-lg border border-[var(--color-ds-border-default-50)]",children:o.jsx("div",{className:"p-2 border-b border-[var(--color-ds-border-default-50)] bg-[var(--color-ds-background-surface)]",children:o.jsx(Ir,{options:v,value:g,onChange:y=>l(T=>({...T,[p]:y})),children:m})})});u.push({id:`tabs-${p}`,title:"Contenedor de pestañas",defaultOpen:!0,content:w})}}),u},[e.layout,c==null?void 0:c.name,a,r,n,s,t,i]);return o.jsx("div",{className:"p-3",children:o.jsx(Gi,{items:d})})}exports.Button=ie;exports.Canvas=np;exports.Checkbox=dt;exports.CollapsibleSection=it;exports.ColumnDropZone=In;exports.CompactAccordion=Gi;exports.DateInput=Fr;exports.DropdownMenu=vd;exports.FileUploader=mi;exports.FormFieldInput=Hn;exports.FormPageLayout=Id;exports.FormRenderer=zi;exports.Header=qi;exports.Icon=kt;exports.IconButton=Ii;exports.InfoButton=Yn;exports.Input=we;exports.InputGroup=Ri;exports.LoadingScreen=Qu;exports.Modal=ef;exports.OptionGroup=Di;exports.PageLayout=sf;exports.SchemaEditorHost=tp;exports.SearchField=Pi;exports.Select=rt;exports.Sidebar=Wi;exports.SidebarNav=Qn;exports.SkeletonLoader=Xt;exports.Table=nf;exports.Tabs=Ir;exports.TextArea=Ls;exports.ThemeProvider=Xu;exports.ThemeToggle=Vi;exports.Toast=Mi;exports.ToastProvider=Fu;exports.ToggleSwitch=Ki;exports.useToast=Vr;