@dipusevilla/componentes-iu 1.0.44 → 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.
Files changed (32) hide show
  1. package/dist/index.cjs.js +35 -14
  2. package/dist/index.css +1 -1
  3. package/dist/index.es.js +12304 -4110
  4. package/dist/index.umd.js +36 -15
  5. package/dist/types/components/Button.d.ts +3 -3
  6. package/dist/types/components/Header.d.ts +4 -4
  7. package/dist/types/components/InfoButton.d.ts +2 -0
  8. package/dist/types/components/NodeToolbar.d.ts +8 -0
  9. package/dist/types/editor/SchemaEditorHost.d.ts +21 -0
  10. package/dist/types/editor/SchemaEditorPage.d.ts +1 -0
  11. package/dist/types/editor/adapters/types.d.ts +17 -0
  12. package/dist/types/editor/components/Canvas.d.ts +1 -0
  13. package/dist/types/editor/components/ColumnDropZone.d.ts +26 -0
  14. package/dist/types/editor/components/DesignerCanvas.d.ts +1 -0
  15. package/dist/types/editor/components/FieldChip.d.ts +16 -0
  16. package/dist/types/editor/components/Inspector.d.ts +10 -0
  17. package/dist/types/editor/components/Palette.d.ts +4 -0
  18. package/dist/types/editor/components/RuleBuilder.d.ts +11 -0
  19. package/dist/types/editor/components/Toolbar.d.ts +2 -0
  20. package/dist/types/editor/context/adaptersProvider.d.ts +7 -0
  21. package/dist/types/editor/dnd/DraggableField.d.ts +18 -0
  22. package/dist/types/editor/dnd/DraggableSection.d.ts +8 -0
  23. package/dist/types/editor/dnd/DraggableTabChip.d.ts +10 -0
  24. package/dist/types/editor/dnd/DraggableTabSection.d.ts +10 -0
  25. package/dist/types/editor/dnd/DropColumn.d.ts +26 -0
  26. package/dist/types/editor/dnd/EditorDndProvider.d.ts +2 -0
  27. package/dist/types/editor/dnd/GlobalDropTarget.d.ts +7 -0
  28. package/dist/types/editor/dnd/InlineDropSlot.d.ts +19 -0
  29. package/dist/types/editor/dnd/types.d.ts +62 -0
  30. package/dist/types/editor/store.d.ts +125 -0
  31. package/dist/types/index.d.ts +5 -0
  32. package/package.json +4 -1
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react"),vs=require("react-dom");function $n(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const Y=$n(v);function Dn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var vt={exports:{}},it={};/**
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 Cr;function In(){if(Cr)return it;Cr=1;var r=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(s,n,a){var o=null;if(a!==void 0&&(o=""+a),n.key!==void 0&&(o=""+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:r,type:s,key:o,ref:n!==void 0?n:null,props:a}}return it.Fragment=e,it.jsx=t,it.jsxs=t,it}var lt={};/**
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,37 +14,37 @@
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 Or;function Ln(){return Or||(Or=1,process.env.NODE_ENV!=="production"&&function(){function r(E){if(E==null)return null;if(typeof E=="function")return E.$$typeof===Q?null:E.displayName||E.name||null;if(typeof E=="string")return E;switch(E){case k:return"Fragment";case w:return"Profiler";case S:return"StrictMode";case F:return"Suspense";case U:return"SuspenseList";case D:return"Activity"}if(typeof E=="object")switch(typeof E.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),E.$$typeof){case x:return"Portal";case T:return(E.displayName||"Context")+".Provider";case g:return(E._context.displayName||"Context")+".Consumer";case V:var j=E.render;return E=E.displayName,E||(E=j.displayName||j.name||"",E=E!==""?"ForwardRef("+E+")":"ForwardRef"),E;case G:return j=E.displayName||null,j!==null?j:r(E.type)||"Memo";case _:j=E._payload,E=E._init;try{return r(E(j))}catch{}}return null}function e(E){return""+E}function t(E){try{e(E);var j=!1}catch{j=!0}if(j){j=console;var O=j.error,I=typeof Symbol=="function"&&Symbol.toStringTag&&E[Symbol.toStringTag]||E.constructor.name||"Object";return O.call(j,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",I),e(E)}}function s(E){if(E===k)return"<>";if(typeof E=="object"&&E!==null&&E.$$typeof===_)return"<...>";try{var j=r(E);return j?"<"+j+">":"<...>"}catch{return"<...>"}}function n(){var E=Z.A;return E===null?null:E.getOwner()}function a(){return Error("react-stack-top-frame")}function o(E){if($.call(E,"key")){var j=Object.getOwnPropertyDescriptor(E,"key").get;if(j&&j.isReactWarning)return!1}return E.key!==void 0}function l(E,j){function O(){q||(q=!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)",j))}O.isReactWarning=!0,Object.defineProperty(E,"key",{get:O,configurable:!0})}function c(){var E=r(this.type);return X[E]||(X[E]=!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.")),E=this.props.ref,E!==void 0?E:null}function d(E,j,O,I,ee,se,ue,ne){return O=se.ref,E={$$typeof:y,type:E,key:j,props:se,_owner:ee},(O!==void 0?O:null)!==null?Object.defineProperty(E,"ref",{enumerable:!1,get:c}):Object.defineProperty(E,"ref",{enumerable:!1,value:null}),E._store={},Object.defineProperty(E._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(E,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(E,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ue}),Object.defineProperty(E,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ne}),Object.freeze&&(Object.freeze(E.props),Object.freeze(E)),E}function u(E,j,O,I,ee,se,ue,ne){var ae=j.children;if(ae!==void 0)if(I)if(H(ae)){for(I=0;I<ae.length;I++)p(ae[I]);Object.freeze&&Object.freeze(ae)}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 p(ae);if($.call(j,"key")){ae=r(E);var he=Object.keys(j).filter(function(te){return te!=="key"});I=0<he.length?"{key: someKey, "+he.join(": ..., ")+": ...}":"{key: someKey}",W[ae+I]||(he=0<he.length?"{"+he.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} />`,I,ae,he,ae),W[ae+I]=!0)}if(ae=null,O!==void 0&&(t(O),ae=""+O),o(j)&&(t(j.key),ae=""+j.key),"key"in j){O={};for(var ge in j)ge!=="key"&&(O[ge]=j[ge])}else O=j;return ae&&l(O,typeof E=="function"?E.displayName||E.name||"Unknown":E),d(E,ae,se,ee,n(),O,ue,ne)}function p(E){typeof E=="object"&&E!==null&&E.$$typeof===y&&E._store&&(E._store.validated=1)}var h=v,y=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),T=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),Q=Symbol.for("react.client.reference"),Z=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,H=Array.isArray,J=console.createTask?console.createTask:function(){return null};h={"react-stack-bottom-frame":function(E){return E()}};var q,X={},C=h["react-stack-bottom-frame"].bind(h,a)(),m=J(s(a)),W={};lt.Fragment=k,lt.jsx=function(E,j,O,I,ee){var se=1e4>Z.recentlyCreatedOwnerStacks++;return u(E,j,O,!1,I,ee,se?Error("react-stack-top-frame"):C,se?J(s(E)):m)},lt.jsxs=function(E,j,O,I,ee){var se=1e4>Z.recentlyCreatedOwnerStacks++;return u(E,j,O,!0,I,ee,se?Error("react-stack-top-frame"):C,se?J(s(E)):m)}}()),lt}var Rr;function Pn(){return Rr||(Rr=1,process.env.NODE_ENV==="production"?vt.exports=In():vt.exports=Ln()),vt.exports}var i=Pn();function ws(r){var e,t,s="";if(typeof r=="string"||typeof r=="number")s+=r;else if(typeof r=="object")if(Array.isArray(r)){var n=r.length;for(e=0;e<n;e++)r[e]&&(t=ws(r[e]))&&(s&&(s+=" "),s+=t)}else for(t in r)r[t]&&(s&&(s+=" "),s+=t);return s}function L(){for(var r,e,t=0,s="",n=arguments.length;t<n;t++)(r=arguments[t])&&(e=ws(r))&&(s&&(s+=" "),s+=e);return s}const zn={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 Me({component:r,size:e="sm",className:t,...s}){return i.jsx(r,{className:L(zn[e],t),"aria-hidden":s["aria-label"]?void 0:!0,...s})}const Bn="inline-flex items-center justify-center box-border font-[var(--font-primary)] font-medium rounded-lg transition focus:outline-none",Un={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"},Zn={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"},Wn={sm:"h-6 w-6 p-0",md:"h-10 w-10 p-0",lg:"h-12 w-12 p-0"},qn="disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-[var(--color-ds-background-disabled)] disabled:text-[var(--color-ds-text-on-accent)] disabled:ring-1 disabled:ring-inset disabled:ring-[var(--color-ds-border-muted)]";function Pe({type:r="button",variant:e="primary",size:t="sm",width:s,disabled:n=!1,icon:a,iconPosition:o="left",ariaLabel:l,children:c,onClick:d,className:u}){const p=!!a,h=p&&!c,y=h?Wn[t]:Zn[t];return i.jsxs("button",{type:r,onClick:d,disabled:n,"aria-label":h?l:void 0,style:s?{width:s}:void 0,className:L(Bn,Un[e],y,qn,u,p&&c&&"gap-2"),children:[a&&o==="left"&&i.jsx(Me,{component:a,size:t}),c,a&&o==="right"&&i.jsx(Me,{component:a,size:t})]})}function Gn({title:r,titleId:e,...t},s){return Y.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":e},t),r?Y.createElement("title",{id:e},r):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"}))}const Yn=Y.forwardRef(Gn);function Hn({title:r,titleId:e,...t},s){return Y.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":e},t),r?Y.createElement("title",{id:e},r):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))}const pr=Y.forwardRef(Hn);function Xn({title:r,titleId:e,...t},s){return Y.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":e},t),r?Y.createElement("title",{id:e},r):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))}const Kn=Y.forwardRef(Xn);function Jn({title:r,titleId:e,...t},s){return Y.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":e},t),r?Y.createElement("title",{id:e},r):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))}const Qn=Y.forwardRef(Jn);function ea({title:r,titleId:e,...t},s){return Y.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":e},t),r?Y.createElement("title",{id:e},r):null,Y.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 ta=Y.forwardRef(ea);function ra({title:r,titleId:e,...t},s){return Y.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":e},t),r?Y.createElement("title",{id:e},r):null,Y.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 Mr=Y.forwardRef(ra);function sa({title:r,titleId:e,...t},s){return Y.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":e},t),r?Y.createElement("title",{id:e},r):null,Y.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 na=Y.forwardRef(sa);function aa({title:r,titleId:e,...t},s){return Y.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":e},t),r?Y.createElement("title",{id:e},r):null,Y.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"}),Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const ks=Y.forwardRef(aa);function oa({title:r,titleId:e,...t},s){return Y.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":e},t),r?Y.createElement("title",{id:e},r):null,Y.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 ia=Y.forwardRef(oa);function la({title:r,titleId:e,...t},s){return Y.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":e},t),r?Y.createElement("title",{id:e},r):null,Y.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 ca=Y.forwardRef(la);function ua({title:r,titleId:e,...t},s){return Y.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":e},t),r?Y.createElement("title",{id:e},r):null,Y.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 da=Y.forwardRef(ua);function fa({title:r,titleId:e,...t},s){return Y.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":e},t),r?Y.createElement("title",{id:e},r):null,Y.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 ma=Y.forwardRef(fa);function ha({title:r,titleId:e,...t},s){return Y.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":e},t),r?Y.createElement("title",{id:e},r):null,Y.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const xr=Y.forwardRef(ha),pa={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 rr({title:r,children:e,defaultOpen:t=!0,className:s,type:n="default",contentClassName:a,headerClassName:o}){const[l,c]=v.useState(t),d=v.useRef(null),[u,p]=v.useState(0),h=()=>{d.current&&p(d.current.scrollHeight)};v.useLayoutEffect(()=>{h()},[l]),v.useEffect(()=>{const x=d.current;if(!x)return;const k=new ResizeObserver(()=>h());return k.observe(x),()=>k.disconnect()},[]);const y=pa[n];return i.jsxs("div",{className:L("flex flex-col w-full gap-3",s),children:[i.jsxs("button",{type:"button",onClick:()=>c(x=>!x),"aria-expanded":l,className:L("flex items-center justify-between w-full transition-colors","hover:bg-[var(--color-ds-surface-hover)]",o),children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"block w-1 h-5 bg-[var(--color-ds-background-accent)] rounded-sm"}),i.jsx("span",{className:"font-semibold text-[var(--color-ds-text-primary)]",children:r})]}),l?i.jsx(Qn,{className:"w-5 h-5 text-[var(--color-ds-text-primary)]"}):i.jsx(pr,{className:"w-5 h-5 text-[var(--color-ds-text-primary)]"})]}),i.jsx("div",{className:y.wrapper,children:i.jsx("div",{className:y.padX,children:i.jsx("div",{className:L("overflow-hidden transition-all duration-300 ease-in-out",l?"opacity-100":"opacity-0"),style:{maxHeight:l?`${u}px`:"0px"},children:i.jsx("div",{ref:d,className:L(y.padY,a),children:e})})})})]})}const gr="-",xa=r=>{const e=ba(r),{conflictingClassGroups:t,conflictingClassGroupModifiers:s}=r;return{getClassGroupId:o=>{const l=o.split(gr);return l[0]===""&&l.length!==1&&l.shift(),js(l,e)||ga(o)},getConflictingClassGroupIds:(o,l)=>{const c=t[o]||[];return l&&s[o]?[...c,...s[o]]:c}}},js=(r,e)=>{var o;if(r.length===0)return e.classGroupId;const t=r[0],s=e.nextPart.get(t),n=s?js(r.slice(1),s):void 0;if(n)return n;if(e.validators.length===0)return;const a=r.join(gr);return(o=e.validators.find(({validator:l})=>l(a)))==null?void 0:o.classGroupId},Vr=/^\[(.+)\]$/,ga=r=>{if(Vr.test(r)){const e=Vr.exec(r)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},ba=r=>{const{theme:e,classGroups:t}=r,s={nextPart:new Map,validators:[]};for(const n in t)sr(t[n],s,n,e);return s},sr=(r,e,t,s)=>{r.forEach(n=>{if(typeof n=="string"){const a=n===""?e:$r(e,n);a.classGroupId=t;return}if(typeof n=="function"){if(ya(n)){sr(n(s),e,t,s);return}e.validators.push({validator:n,classGroupId:t});return}Object.entries(n).forEach(([a,o])=>{sr(o,$r(e,a),t,s)})})},$r=(r,e)=>{let t=r;return e.split(gr).forEach(s=>{t.nextPart.has(s)||t.nextPart.set(s,{nextPart:new Map,validators:[]}),t=t.nextPart.get(s)}),t},ya=r=>r.isThemeGetter,va=r=>{if(r<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,s=new Map;const n=(a,o)=>{t.set(a,o),e++,e>r&&(e=0,s=t,t=new Map)};return{get(a){let o=t.get(a);if(o!==void 0)return o;if((o=s.get(a))!==void 0)return n(a,o),o},set(a,o){t.has(a)?t.set(a,o):n(a,o)}}},nr="!",ar=":",wa=ar.length,ka=r=>{const{prefix:e,experimentalParseClassName:t}=r;let s=n=>{const a=[];let o=0,l=0,c=0,d;for(let x=0;x<n.length;x++){let k=n[x];if(o===0&&l===0){if(k===ar){a.push(n.slice(c,x)),c=x+wa;continue}if(k==="/"){d=x;continue}}k==="["?o++:k==="]"?o--:k==="("?l++:k===")"&&l--}const u=a.length===0?n:n.substring(c),p=ja(u),h=p!==u,y=d&&d>c?d-c:void 0;return{modifiers:a,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:y}};if(e){const n=e+ar,a=s;s=o=>o.startsWith(n)?a(o.substring(n.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(t){const n=s;s=a=>t({className:a,parseClassName:n})}return s},ja=r=>r.endsWith(nr)?r.substring(0,r.length-1):r.startsWith(nr)?r.substring(1):r,Ea=r=>{const e=Object.fromEntries(r.orderSensitiveModifiers.map(s=>[s,!0]));return s=>{if(s.length<=1)return s;const n=[];let a=[];return s.forEach(o=>{o[0]==="["||e[o]?(n.push(...a.sort(),o),a=[]):a.push(o)}),n.push(...a.sort()),n}},Na=r=>({cache:va(r.cacheSize),parseClassName:ka(r),sortModifiers:Ea(r),...xa(r)}),Sa=/\s+/,_a=(r,e)=>{const{parseClassName:t,getClassGroupId:s,getConflictingClassGroupIds:n,sortModifiers:a}=e,o=[],l=r.trim().split(Sa);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:h,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:k}=t(u);if(p){c=u+(c.length>0?" "+c:c);continue}let S=!!k,w=s(S?x.substring(0,k):x);if(!w){if(!S){c=u+(c.length>0?" "+c:c);continue}if(w=s(x),!w){c=u+(c.length>0?" "+c:c);continue}S=!1}const g=a(h).join(":"),T=y?g+nr:g,V=T+w;if(o.includes(V))continue;o.push(V);const F=n(w,S);for(let U=0;U<F.length;++U){const G=F[U];o.push(T+G)}c=u+(c.length>0?" "+c:c)}return c};function Fa(){let r=0,e,t,s="";for(;r<arguments.length;)(e=arguments[r++])&&(t=Es(e))&&(s&&(s+=" "),s+=t);return s}const Es=r=>{if(typeof r=="string")return r;let e,t="";for(let s=0;s<r.length;s++)r[s]&&(e=Es(r[s]))&&(t&&(t+=" "),t+=e);return t};function Ta(r,...e){let t,s,n,a=o;function o(c){const d=e.reduce((u,p)=>p(u),r());return t=Na(d),s=t.cache.get,n=t.cache.set,a=l,l(c)}function l(c){const d=s(c);if(d)return d;const u=_a(c,t);return n(c,u),u}return function(){return a(Fa.apply(null,arguments))}}const pe=r=>{const e=t=>t[r]||[];return e.isThemeGetter=!0,e},Ns=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ss=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Aa=/^\d+\/\d+$/,Ca=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Oa=/\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$/,Ra=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ma=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Va=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Je=r=>Aa.test(r),re=r=>!!r&&!Number.isNaN(Number(r)),Ue=r=>!!r&&Number.isInteger(Number(r)),Yt=r=>r.endsWith("%")&&re(r.slice(0,-1)),$e=r=>Ca.test(r),$a=()=>!0,Da=r=>Oa.test(r)&&!Ra.test(r),_s=()=>!1,Ia=r=>Ma.test(r),La=r=>Va.test(r),Pa=r=>!z(r)&&!B(r),za=r=>st(r,As,_s),z=r=>Ns.test(r),qe=r=>st(r,Cs,Da),Ht=r=>st(r,qa,re),Dr=r=>st(r,Fs,_s),Ba=r=>st(r,Ts,La),wt=r=>st(r,Os,Ia),B=r=>Ss.test(r),ct=r=>nt(r,Cs),Ua=r=>nt(r,Ga),Ir=r=>nt(r,Fs),Za=r=>nt(r,As),Wa=r=>nt(r,Ts),kt=r=>nt(r,Os,!0),st=(r,e,t)=>{const s=Ns.exec(r);return s?s[1]?e(s[1]):t(s[2]):!1},nt=(r,e,t=!1)=>{const s=Ss.exec(r);return s?s[1]?e(s[1]):t:!1},Fs=r=>r==="position"||r==="percentage",Ts=r=>r==="image"||r==="url",As=r=>r==="length"||r==="size"||r==="bg-size",Cs=r=>r==="length",qa=r=>r==="number",Ga=r=>r==="family-name",Os=r=>r==="shadow",Ya=()=>{const r=pe("color"),e=pe("font"),t=pe("text"),s=pe("font-weight"),n=pe("tracking"),a=pe("leading"),o=pe("breakpoint"),l=pe("container"),c=pe("spacing"),d=pe("radius"),u=pe("shadow"),p=pe("inset-shadow"),h=pe("text-shadow"),y=pe("drop-shadow"),x=pe("blur"),k=pe("perspective"),S=pe("aspect"),w=pe("ease"),g=pe("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],F=()=>[...V(),B,z],U=()=>["auto","hidden","clip","visible","scroll"],G=()=>["auto","contain","none"],_=()=>[B,z,c],D=()=>[Je,"full","auto",..._()],Q=()=>[Ue,"none","subgrid",B,z],Z=()=>["auto",{span:["full",Ue,B,z]},Ue,B,z],$=()=>[Ue,"auto",B,z],H=()=>["auto","min","max","fr",B,z],J=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],q=()=>["start","end","center","stretch","center-safe","end-safe"],X=()=>["auto",..._()],C=()=>[Je,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],m=()=>[r,B,z],W=()=>[...V(),Ir,Dr,{position:[B,z]}],E=()=>["no-repeat",{repeat:["","x","y","space","round"]}],j=()=>["auto","cover","contain",Za,za,{size:[B,z]}],O=()=>[Yt,ct,qe],I=()=>["","none","full",d,B,z],ee=()=>["",re,ct,qe],se=()=>["solid","dashed","dotted","double"],ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>[re,Yt,Ir,Dr],ae=()=>["","none",x,B,z],he=()=>["none",re,B,z],ge=()=>["none",re,B,z],te=()=>[re,B,z],ce=()=>[Je,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[$e],breakpoint:[$e],color:[$a],container:[$e],"drop-shadow":[$e],ease:["in","out","in-out"],font:[Pa],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[$e],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[$e],shadow:[$e],spacing:["px",re],text:[$e],"text-shadow":[$e],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Je,z,B,S]}],container:["container"],columns:[{columns:[re,z,B,l]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"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:F()}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{start:D()}],end:[{end:D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[Ue,"auto",B,z]}],basis:[{basis:[Je,"full","auto",l,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[re,Je,"auto","initial","none",z]}],grow:[{grow:["",re,B,z]}],shrink:[{shrink:["",re,B,z]}],order:[{order:[Ue,"first","last","none",B,z]}],"grid-cols":[{"grid-cols":Q()}],"col-start-end":[{col:Z()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":Q()}],"row-start-end":[{row:Z()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":H()}],"auto-rows":[{"auto-rows":H()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...J(),"normal"]}],"justify-items":[{"justify-items":[...q(),"normal"]}],"justify-self":[{"justify-self":["auto",...q()]}],"align-content":[{content:["normal",...J()]}],"align-items":[{items:[...q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...q(),{baseline:["","last"]}]}],"place-content":[{"place-content":J()}],"place-items":[{"place-items":[...q(),"baseline"]}],"place-self":[{"place-self":["auto",...q()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:X()}],mx:[{mx:X()}],my:[{my:X()}],ms:[{ms:X()}],me:[{me:X()}],mt:[{mt:X()}],mr:[{mr:X()}],mb:[{mb:X()}],ml:[{ml:X()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:C()}],w:[{w:[l,"screen",...C()]}],"min-w":[{"min-w":[l,"screen","none",...C()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...C()]}],h:[{h:["screen","lh",...C()]}],"min-h":[{"min-h":["screen","lh","none",...C()]}],"max-h":[{"max-h":["screen","lh",...C()]}],"font-size":[{text:["base",t,ct,qe]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,B,Ht]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Yt,z]}],"font-family":[{font:[Ua,z,e]}],"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,B,z]}],"line-clamp":[{"line-clamp":[re,"none",B,Ht]}],leading:[{leading:[a,..._()]}],"list-image":[{"list-image":["none",B,z]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",B,z]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:m()}],"text-color":[{text:m()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[re,"from-font","auto",B,qe]}],"text-decoration-color":[{decoration:m()}],"underline-offset":[{"underline-offset":[re,"auto",B,z]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",B,z]}],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",B,z]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:E()}],"bg-size":[{bg:j()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ue,B,z],radial:["",B,z],conic:[Ue,B,z]},Wa,Ba]}],"bg-color":[{bg:m()}],"gradient-from-pos":[{from:O()}],"gradient-via-pos":[{via:O()}],"gradient-to-pos":[{to:O()}],"gradient-from":[{from:m()}],"gradient-via":[{via:m()}],"gradient-to":[{to:m()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:m()}],"border-color-x":[{"border-x":m()}],"border-color-y":[{"border-y":m()}],"border-color-s":[{"border-s":m()}],"border-color-e":[{"border-e":m()}],"border-color-t":[{"border-t":m()}],"border-color-r":[{"border-r":m()}],"border-color-b":[{"border-b":m()}],"border-color-l":[{"border-l":m()}],"divide-color":[{divide:m()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[re,B,z]}],"outline-w":[{outline:["",re,ct,qe]}],"outline-color":[{outline:m()}],shadow:[{shadow:["","none",u,kt,wt]}],"shadow-color":[{shadow:m()}],"inset-shadow":[{"inset-shadow":["none",p,kt,wt]}],"inset-shadow-color":[{"inset-shadow":m()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:m()}],"ring-offset-w":[{"ring-offset":[re,qe]}],"ring-offset-color":[{"ring-offset":m()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":m()}],"text-shadow":[{"text-shadow":["none",h,kt,wt]}],"text-shadow-color":[{"text-shadow":m()}],opacity:[{opacity:[re,B,z]}],"mix-blend":[{"mix-blend":[...ue(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ue()}],"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":[re]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":m()}],"mask-image-linear-to-color":[{"mask-linear-to":m()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":m()}],"mask-image-t-to-color":[{"mask-t-to":m()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":m()}],"mask-image-r-to-color":[{"mask-r-to":m()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":m()}],"mask-image-b-to-color":[{"mask-b-to":m()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":m()}],"mask-image-l-to-color":[{"mask-l-to":m()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":m()}],"mask-image-x-to-color":[{"mask-x-to":m()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":m()}],"mask-image-y-to-color":[{"mask-y-to":m()}],"mask-image-radial":[{"mask-radial":[B,z]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":m()}],"mask-image-radial-to-color":[{"mask-radial-to":m()}],"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":V()}],"mask-image-conic-pos":[{"mask-conic":[re]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":m()}],"mask-image-conic-to-color":[{"mask-conic-to":m()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:W()}],"mask-repeat":[{mask:E()}],"mask-size":[{mask:j()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",B,z]}],filter:[{filter:["","none",B,z]}],blur:[{blur:ae()}],brightness:[{brightness:[re,B,z]}],contrast:[{contrast:[re,B,z]}],"drop-shadow":[{"drop-shadow":["","none",y,kt,wt]}],"drop-shadow-color":[{"drop-shadow":m()}],grayscale:[{grayscale:["",re,B,z]}],"hue-rotate":[{"hue-rotate":[re,B,z]}],invert:[{invert:["",re,B,z]}],saturate:[{saturate:[re,B,z]}],sepia:[{sepia:["",re,B,z]}],"backdrop-filter":[{"backdrop-filter":["","none",B,z]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[re,B,z]}],"backdrop-contrast":[{"backdrop-contrast":[re,B,z]}],"backdrop-grayscale":[{"backdrop-grayscale":["",re,B,z]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[re,B,z]}],"backdrop-invert":[{"backdrop-invert":["",re,B,z]}],"backdrop-opacity":[{"backdrop-opacity":[re,B,z]}],"backdrop-saturate":[{"backdrop-saturate":[re,B,z]}],"backdrop-sepia":[{"backdrop-sepia":["",re,B,z]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",B,z]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[re,"initial",B,z]}],ease:[{ease:["linear","initial",w,B,z]}],delay:[{delay:[re,B,z]}],animate:[{animate:["none",g,B,z]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,B,z]}],"perspective-origin":[{"perspective-origin":F()}],rotate:[{rotate:he()}],"rotate-x":[{"rotate-x":he()}],"rotate-y":[{"rotate-y":he()}],"rotate-z":[{"rotate-z":he()}],scale:[{scale:ge()}],"scale-x":[{"scale-x":ge()}],"scale-y":[{"scale-y":ge()}],"scale-z":[{"scale-z":ge()}],"scale-3d":["scale-3d"],skew:[{skew:te()}],"skew-x":[{"skew-x":te()}],"skew-y":[{"skew-y":te()}],transform:[{transform:[B,z,"","none","gpu","cpu"]}],"transform-origin":[{origin:F()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":["translate-none"],accent:[{accent:m()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:m()}],"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",B,z]}],"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":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"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",B,z]}],fill:[{fill:["none",...m()]}],"stroke-w":[{stroke:[re,ct,qe,Ht]}],stroke:[{stroke:["none",...m()]}],"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"]}},Ha=Ta(Ya);var xt=r=>r.type==="checkbox",Ge=r=>r instanceof Date,we=r=>r==null;const Rs=r=>typeof r=="object";var me=r=>!we(r)&&!Array.isArray(r)&&Rs(r)&&!Ge(r),Ms=r=>me(r)&&r.target?xt(r.target)?r.target.checked:r.target.value:r,Xa=r=>r.substring(0,r.search(/\.\d+(\.|$)/))||r,Vs=(r,e)=>r.has(Xa(e)),Ka=r=>{const e=r.constructor&&r.constructor.prototype;return me(e)&&e.hasOwnProperty("isPrototypeOf")},br=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ye(r){let e;const t=Array.isArray(r),s=typeof FileList<"u"?r instanceof FileList:!1;if(r instanceof Date)e=new Date(r);else if(r instanceof Set)e=new Set(r);else if(!(br&&(r instanceof Blob||s))&&(t||me(r)))if(e=t?[]:{},!t&&!Ka(r))e=r;else for(const n in r)r.hasOwnProperty(n)&&(e[n]=ye(r[n]));else return r;return e}var zt=r=>Array.isArray(r)?r.filter(Boolean):[],fe=r=>r===void 0,M=(r,e,t)=>{if(!e||!me(r))return t;const s=zt(e.split(/[,[\].]+?/)).reduce((n,a)=>we(n)?n:n[a],r);return fe(s)||s===r?fe(r[e])?t:r[e]:s},Ne=r=>typeof r=="boolean",yr=r=>/^\w*$/.test(r),$s=r=>zt(r.replace(/["|']|\]/g,"").split(/\.|\[/)),oe=(r,e,t)=>{let s=-1;const n=yr(e)?[e]:$s(e),a=n.length,o=a-1;for(;++s<a;){const l=n[s];let c=t;if(s!==o){const d=r[l];c=me(d)||Array.isArray(d)?d:isNaN(+n[s+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;r[l]=c,r=r[l]}};const Mt={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Fe={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},De={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ds=v.createContext(null),gt=()=>v.useContext(Ds),Ja=r=>{const{children:e,...t}=r;return v.createElement(Ds.Provider,{value:t},e)};var Is=(r,e,t,s=!0)=>{const n={defaultValues:e._defaultValues};for(const a in r)Object.defineProperty(n,a,{get:()=>{const o=a;return e._proxyFormState[o]!==Fe.all&&(e._proxyFormState[o]=!s||Fe.all),t&&(t[o]=!0),r[o]}});return n};const vr=typeof window<"u"?Y.useLayoutEffect:Y.useEffect;function Qa(r){const e=gt(),{control:t=e.control,disabled:s,name:n,exact:a}=r||{},[o,l]=v.useState(t._formState),c=v.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return vr(()=>t._subscribe({name:n,formState:c.current,exact:a,callback:d=>{!s&&l({...t._formState,...d})}}),[n,s,a]),v.useEffect(()=>{c.current.isValid&&t._setValid(!0)},[t]),v.useMemo(()=>Is(o,t,c.current,!1),[o,t])}var Ve=r=>typeof r=="string",Ls=(r,e,t,s,n)=>Ve(r)?(s&&e.watch.add(r),M(t,r,n)):Array.isArray(r)?r.map(a=>(s&&e.watch.add(a),M(t,a))):(s&&(e.watchAll=!0),t);function wr(r){const e=gt(),{control:t=e.control,name:s,defaultValue:n,disabled:a,exact:o}=r||{},l=v.useRef(n),[c,d]=v.useState(t._getWatch(s,l.current));return vr(()=>t._subscribe({name:s,formState:{values:!0},exact:o,callback:u=>!a&&d(Ls(s,t._names,u.values||t._formValues,!1,l.current))}),[s,t,a,o]),v.useEffect(()=>t._removeUnmounted()),c}function Ps(r){const e=gt(),{name:t,disabled:s,control:n=e.control,shouldUnregister:a}=r,o=Vs(n._names.array,t),l=wr({control:n,name:t,defaultValue:M(n._formValues,t,M(n._defaultValues,t,r.defaultValue)),exact:!0}),c=Qa({control:n,name:t,exact:!0}),d=v.useRef(r),u=v.useRef(n.register(t,{...r.rules,value:l,...Ne(r.disabled)?{disabled:r.disabled}:{}})),p=v.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!M(c.errors,t)},isDirty:{enumerable:!0,get:()=>!!M(c.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!M(c.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!M(c.validatingFields,t)},error:{enumerable:!0,get:()=>M(c.errors,t)}}),[c,t]),h=v.useCallback(S=>u.current.onChange({target:{value:Ms(S),name:t},type:Mt.CHANGE}),[t]),y=v.useCallback(()=>u.current.onBlur({target:{value:M(n._formValues,t),name:t},type:Mt.BLUR}),[t,n._formValues]),x=v.useCallback(S=>{const w=M(n._fields,t);w&&S&&(w._f.ref={focus:()=>S.focus(),select:()=>S.select(),setCustomValidity:g=>S.setCustomValidity(g),reportValidity:()=>S.reportValidity()})},[n._fields,t]),k=v.useMemo(()=>({name:t,value:l,...Ne(s)||c.disabled?{disabled:c.disabled||s}:{},onChange:h,onBlur:y,ref:x}),[t,s,c.disabled,h,y,x,l]);return v.useEffect(()=>{const S=n._options.shouldUnregister||a;n.register(t,{...d.current.rules,...Ne(d.current.disabled)?{disabled:d.current.disabled}:{}});const w=(g,T)=>{const V=M(n._fields,g);V&&V._f&&(V._f.mount=T)};if(w(t,!0),S){const g=ye(M(n._options.defaultValues,t));oe(n._defaultValues,t,g),fe(M(n._formValues,t))&&oe(n._formValues,t,g)}return!o&&n.register(t),()=>{(o?S&&!n._state.action:S)?n.unregister(t):w(t,!1)}},[t,n,o,a]),v.useEffect(()=>{n._setDisabledField({disabled:s,name:t})},[s,t,n]),v.useMemo(()=>({field:k,formState:c,fieldState:p}),[k,c,p])}const Ce=r=>r.render(Ps(r));var zs=(r,e,t,s,n)=>e?{...t[r],types:{...t[r]&&t[r].types?t[r].types:{},[s]:n||!0}}:{},mt=r=>Array.isArray(r)?r:[r],Lr=()=>{let r=[];return{get observers(){return r},next:n=>{for(const a of r)a.next&&a.next(n)},subscribe:n=>(r.push(n),{unsubscribe:()=>{r=r.filter(a=>a!==n)}}),unsubscribe:()=>{r=[]}}},or=r=>we(r)||!Rs(r);function We(r,e){if(or(r)||or(e))return r===e;if(Ge(r)&&Ge(e))return r.getTime()===e.getTime();const t=Object.keys(r),s=Object.keys(e);if(t.length!==s.length)return!1;for(const n of t){const a=r[n];if(!s.includes(n))return!1;if(n!=="ref"){const o=e[n];if(Ge(a)&&Ge(o)||me(a)&&me(o)||Array.isArray(a)&&Array.isArray(o)?!We(a,o):a!==o)return!1}}return!0}var ve=r=>me(r)&&!Object.keys(r).length,kr=r=>r.type==="file",Te=r=>typeof r=="function",Vt=r=>{if(!br)return!1;const e=r?r.ownerDocument:0;return r instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},Bs=r=>r.type==="select-multiple",jr=r=>r.type==="radio",eo=r=>jr(r)||xt(r),Xt=r=>Vt(r)&&r.isConnected;function to(r,e){const t=e.slice(0,-1).length;let s=0;for(;s<t;)r=fe(r)?s++:r[e[s++]];return r}function ro(r){for(const e in r)if(r.hasOwnProperty(e)&&!fe(r[e]))return!1;return!0}function xe(r,e){const t=Array.isArray(e)?e:yr(e)?[e]:$s(e),s=t.length===1?r:to(r,t),n=t.length-1,a=t[n];return s&&delete s[a],n!==0&&(me(s)&&ve(s)||Array.isArray(s)&&ro(s))&&xe(r,t.slice(0,-1)),r}var Us=r=>{for(const e in r)if(Te(r[e]))return!0;return!1};function $t(r,e={}){const t=Array.isArray(r);if(me(r)||t)for(const s in r)Array.isArray(r[s])||me(r[s])&&!Us(r[s])?(e[s]=Array.isArray(r[s])?[]:{},$t(r[s],e[s])):we(r[s])||(e[s]=!0);return e}function Zs(r,e,t){const s=Array.isArray(r);if(me(r)||s)for(const n in r)Array.isArray(r[n])||me(r[n])&&!Us(r[n])?fe(e)||or(t[n])?t[n]=Array.isArray(r[n])?$t(r[n],[]):{...$t(r[n])}:Zs(r[n],we(e)?{}:e[n],t[n]):t[n]=!We(r[n],e[n]);return t}var ut=(r,e)=>Zs(r,e,$t(e));const Pr={value:!1,isValid:!1},zr={value:!0,isValid:!0};var Ws=r=>{if(Array.isArray(r)){if(r.length>1){const e=r.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:e,isValid:!!e.length}}return r[0].checked&&!r[0].disabled?r[0].attributes&&!fe(r[0].attributes.value)?fe(r[0].value)||r[0].value===""?zr:{value:r[0].value,isValid:!0}:zr:Pr}return Pr},qs=(r,{valueAsNumber:e,valueAsDate:t,setValueAs:s})=>fe(r)?r:e?r===""?NaN:r&&+r:t&&Ve(r)?new Date(r):s?s(r):r;const Br={isValid:!1,value:null};var Gs=r=>Array.isArray(r)?r.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Br):Br;function Ur(r){const e=r.ref;return kr(e)?e.files:jr(e)?Gs(r.refs).value:Bs(e)?[...e.selectedOptions].map(({value:t})=>t):xt(e)?Ws(r.refs).value:qs(fe(e.value)?r.ref.value:e.value,r)}var so=(r,e,t,s)=>{const n={};for(const a of r){const o=M(e,a);o&&oe(n,a,o._f)}return{criteriaMode:t,names:[...r],fields:n,shouldUseNativeValidation:s}},Dt=r=>r instanceof RegExp,dt=r=>fe(r)?r:Dt(r)?r.source:me(r)?Dt(r.value)?r.value.source:r.value:r,Zr=r=>({isOnSubmit:!r||r===Fe.onSubmit,isOnBlur:r===Fe.onBlur,isOnChange:r===Fe.onChange,isOnAll:r===Fe.all,isOnTouch:r===Fe.onTouched});const Wr="AsyncFunction";var no=r=>!!r&&!!r.validate&&!!(Te(r.validate)&&r.validate.constructor.name===Wr||me(r.validate)&&Object.values(r.validate).find(e=>e.constructor.name===Wr)),ao=r=>r.mount&&(r.required||r.min||r.max||r.maxLength||r.minLength||r.pattern||r.validate),qr=(r,e,t)=>!t&&(e.watchAll||e.watch.has(r)||[...e.watch].some(s=>r.startsWith(s)&&/^\.\w+/.test(r.slice(s.length))));const ht=(r,e,t,s)=>{for(const n of t||Object.keys(r)){const a=M(r,n);if(a){const{_f:o,...l}=a;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],n)&&!s)return!0;if(o.ref&&e(o.ref,o.name)&&!s)return!0;if(ht(l,e))break}else if(me(l)&&ht(l,e))break}}};function Gr(r,e,t){const s=M(r,t);if(s||yr(t))return{error:s,name:t};const n=t.split(".");for(;n.length;){const a=n.join("."),o=M(e,a),l=M(r,a);if(o&&!Array.isArray(o)&&t!==a)return{name:t};if(l&&l.type)return{name:a,error:l};n.pop()}return{name:t}}var oo=(r,e,t,s)=>{t(r);const{name:n,...a}=r;return ve(a)||Object.keys(a).length>=Object.keys(e).length||Object.keys(a).find(o=>e[o]===(!s||Fe.all))},io=(r,e,t)=>!r||!e||r===e||mt(r).some(s=>s&&(t?s===e:s.startsWith(e)||e.startsWith(s))),lo=(r,e,t,s,n)=>n.isOnAll?!1:!t&&n.isOnTouch?!(e||r):(t?s.isOnBlur:n.isOnBlur)?!r:(t?s.isOnChange:n.isOnChange)?r:!0,co=(r,e)=>!zt(M(r,e)).length&&xe(r,e),uo=(r,e,t)=>{const s=mt(M(r,t));return oe(s,"root",e[t]),oe(r,t,s),r},At=r=>Ve(r);function Yr(r,e,t="validate"){if(At(r)||Array.isArray(r)&&r.every(At)||Ne(r)&&!r)return{type:t,message:At(r)?r:"",ref:e}}var Qe=r=>me(r)&&!Dt(r)?r:{value:r,message:""},Hr=async(r,e,t,s,n,a)=>{const{ref:o,refs:l,required:c,maxLength:d,minLength:u,min:p,max:h,pattern:y,validate:x,name:k,valueAsNumber:S,mount:w}=r._f,g=M(t,k);if(!w||e.has(k))return{};const T=l?l[0]:o,V=$=>{n&&T.reportValidity&&(T.setCustomValidity(Ne($)?"":$||""),T.reportValidity())},F={},U=jr(o),G=xt(o),_=U||G,D=(S||kr(o))&&fe(o.value)&&fe(g)||Vt(o)&&o.value===""||g===""||Array.isArray(g)&&!g.length,Q=zs.bind(null,k,s,F),Z=($,H,J,q=De.maxLength,X=De.minLength)=>{const C=$?H:J;F[k]={type:$?q:X,message:C,ref:o,...Q($?q:X,C)}};if(a?!Array.isArray(g)||!g.length:c&&(!_&&(D||we(g))||Ne(g)&&!g||G&&!Ws(l).isValid||U&&!Gs(l).isValid)){const{value:$,message:H}=At(c)?{value:!!c,message:c}:Qe(c);if($&&(F[k]={type:De.required,message:H,ref:T,...Q(De.required,H)},!s))return V(H),F}if(!D&&(!we(p)||!we(h))){let $,H;const J=Qe(h),q=Qe(p);if(!we(g)&&!isNaN(g)){const X=o.valueAsNumber||g&&+g;we(J.value)||($=X>J.value),we(q.value)||(H=X<q.value)}else{const X=o.valueAsDate||new Date(g),C=E=>new Date(new Date().toDateString()+" "+E),m=o.type=="time",W=o.type=="week";Ve(J.value)&&g&&($=m?C(g)>C(J.value):W?g>J.value:X>new Date(J.value)),Ve(q.value)&&g&&(H=m?C(g)<C(q.value):W?g<q.value:X<new Date(q.value))}if(($||H)&&(Z(!!$,J.message,q.message,De.max,De.min),!s))return V(F[k].message),F}if((d||u)&&!D&&(Ve(g)||a&&Array.isArray(g))){const $=Qe(d),H=Qe(u),J=!we($.value)&&g.length>+$.value,q=!we(H.value)&&g.length<+H.value;if((J||q)&&(Z(J,$.message,H.message),!s))return V(F[k].message),F}if(y&&!D&&Ve(g)){const{value:$,message:H}=Qe(y);if(Dt($)&&!g.match($)&&(F[k]={type:De.pattern,message:H,ref:o,...Q(De.pattern,H)},!s))return V(H),F}if(x){if(Te(x)){const $=await x(g,t),H=Yr($,T);if(H&&(F[k]={...H,...Q(De.validate,H.message)},!s))return V(H.message),F}else if(me(x)){let $={};for(const H in x){if(!ve($)&&!s)break;const J=Yr(await x[H](g,t),T,H);J&&($={...J,...Q(H,J.message)},V(J.message),s&&(F[k]=$))}if(!ve($)&&(F[k]={ref:T,...$},!s))return F}}return V(!0),F};const fo={mode:Fe.onSubmit,reValidateMode:Fe.onChange,shouldFocusError:!0};function mo(r={}){let e={...fo,...r},t={submitCount:0,isDirty:!1,isReady:!1,isLoading:Te(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1};const s={};let n=me(e.defaultValues)||me(e.values)?ye(e.defaultValues||e.values)||{}:{},a=e.shouldUnregister?{}:ye(n),o={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 p={...u};const h={array:Lr(),state:Lr()},y=e.criteriaMode===Fe.all,x=f=>b=>{clearTimeout(d),d=setTimeout(f,b)},k=async f=>{if(!e.disabled&&(u.isValid||p.isValid||f)){const b=e.resolver?ve((await G()).errors):await D(s,!0);b!==t.isValid&&h.state.next({isValid:b})}},S=(f,b)=>{!e.disabled&&(u.isValidating||u.validatingFields||p.isValidating||p.validatingFields)&&((f||Array.from(l.mount)).forEach(N=>{N&&(b?oe(t.validatingFields,N,b):xe(t.validatingFields,N))}),h.state.next({validatingFields:t.validatingFields,isValidating:!ve(t.validatingFields)}))},w=(f,b=[],N,P,R=!0,A=!0)=>{if(P&&N&&!e.disabled){if(o.action=!0,A&&Array.isArray(M(s,f))){const K=N(M(s,f),P.argA,P.argB);R&&oe(s,f,K)}if(A&&Array.isArray(M(t.errors,f))){const K=N(M(t.errors,f),P.argA,P.argB);R&&oe(t.errors,f,K),co(t.errors,f)}if((u.touchedFields||p.touchedFields)&&A&&Array.isArray(M(t.touchedFields,f))){const K=N(M(t.touchedFields,f),P.argA,P.argB);R&&oe(t.touchedFields,f,K)}(u.dirtyFields||p.dirtyFields)&&(t.dirtyFields=ut(n,a)),h.state.next({name:f,isDirty:Z(f,b),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else oe(a,f,b)},g=(f,b)=>{oe(t.errors,f,b),h.state.next({errors:t.errors})},T=f=>{t.errors=f,h.state.next({errors:t.errors,isValid:!1})},V=(f,b,N,P)=>{const R=M(s,f);if(R){const A=M(a,f,fe(N)?M(n,f):N);fe(A)||P&&P.defaultChecked||b?oe(a,f,b?A:Ur(R._f)):J(f,A),o.mount&&k()}},F=(f,b,N,P,R)=>{let A=!1,K=!1;const ie={name:f};if(!e.disabled){if(!N||P){(u.isDirty||p.isDirty)&&(K=t.isDirty,t.isDirty=ie.isDirty=Z(),A=K!==ie.isDirty);const le=We(M(n,f),b);K=!!M(t.dirtyFields,f),le?xe(t.dirtyFields,f):oe(t.dirtyFields,f,!0),ie.dirtyFields=t.dirtyFields,A=A||(u.dirtyFields||p.dirtyFields)&&K!==!le}if(N){const le=M(t.touchedFields,f);le||(oe(t.touchedFields,f,N),ie.touchedFields=t.touchedFields,A=A||(u.touchedFields||p.touchedFields)&&le!==N)}A&&R&&h.state.next(ie)}return A?ie:{}},U=(f,b,N,P)=>{const R=M(t.errors,f),A=(u.isValid||p.isValid)&&Ne(b)&&t.isValid!==b;if(e.delayError&&N?(c=x(()=>g(f,N)),c(e.delayError)):(clearTimeout(d),c=null,N?oe(t.errors,f,N):xe(t.errors,f)),(N?!We(R,N):R)||!ve(P)||A){const K={...P,...A&&Ne(b)?{isValid:b}:{},errors:t.errors,name:f};t={...t,...K},h.state.next(K)}},G=async f=>{S(f,!0);const b=await e.resolver(a,e.context,so(f||l.mount,s,e.criteriaMode,e.shouldUseNativeValidation));return S(f),b},_=async f=>{const{errors:b}=await G(f);if(f)for(const N of f){const P=M(b,N);P?oe(t.errors,N,P):xe(t.errors,N)}else t.errors=b;return b},D=async(f,b,N={valid:!0})=>{for(const P in f){const R=f[P];if(R){const{_f:A,...K}=R;if(A){const ie=l.array.has(A.name),le=R._f&&no(R._f);le&&u.validatingFields&&S([P],!0);const Se=await Hr(R,l.disabled,a,y,e.shouldUseNativeValidation&&!b,ie);if(le&&u.validatingFields&&S([P]),Se[A.name]&&(N.valid=!1,b))break;!b&&(M(Se,A.name)?ie?uo(t.errors,Se,A.name):oe(t.errors,A.name,Se[A.name]):xe(t.errors,A.name))}!ve(K)&&await D(K,b,N)}}return N.valid},Q=()=>{for(const f of l.unMount){const b=M(s,f);b&&(b._f.refs?b._f.refs.every(N=>!Xt(N)):!Xt(b._f.ref))&&ne(f)}l.unMount=new Set},Z=(f,b)=>!e.disabled&&(f&&b&&oe(a,f,b),!We(E(),n)),$=(f,b,N)=>Ls(f,l,{...o.mount?a:fe(b)?n:Ve(f)?{[f]:b}:b},N,b),H=f=>zt(M(o.mount?a:n,f,e.shouldUnregister?M(n,f,[]):[])),J=(f,b,N={})=>{const P=M(s,f);let R=b;if(P){const A=P._f;A&&(!A.disabled&&oe(a,f,qs(b,A)),R=Vt(A.ref)&&we(b)?"":b,Bs(A.ref)?[...A.ref.options].forEach(K=>K.selected=R.includes(K.value)):A.refs?xt(A.ref)?A.refs.forEach(K=>{(!K.defaultChecked||!K.disabled)&&(Array.isArray(R)?K.checked=!!R.find(ie=>ie===K.value):K.checked=R===K.value||!!R)}):A.refs.forEach(K=>K.checked=K.value===R):kr(A.ref)?A.ref.value="":(A.ref.value=R,A.ref.type||h.state.next({name:f,values:ye(a)})))}(N.shouldDirty||N.shouldTouch)&&F(f,R,N.shouldTouch,N.shouldDirty,!0),N.shouldValidate&&W(f)},q=(f,b,N)=>{for(const P in b){if(!b.hasOwnProperty(P))return;const R=b[P],A=`${f}.${P}`,K=M(s,A);(l.array.has(f)||me(R)||K&&!K._f)&&!Ge(R)?q(A,R,N):J(A,R,N)}},X=(f,b,N={})=>{const P=M(s,f),R=l.array.has(f),A=ye(b);oe(a,f,A),R?(h.array.next({name:f,values:ye(a)}),(u.isDirty||u.dirtyFields||p.isDirty||p.dirtyFields)&&N.shouldDirty&&h.state.next({name:f,dirtyFields:ut(n,a),isDirty:Z(f,A)})):P&&!P._f&&!we(A)?q(f,A,N):J(f,A,N),qr(f,l)&&h.state.next({...t}),h.state.next({name:o.mount?f:void 0,values:ye(a)})},C=async f=>{o.mount=!0;const b=f.target;let N=b.name,P=!0;const R=M(s,N),A=le=>{P=Number.isNaN(le)||Ge(le)&&isNaN(le.getTime())||We(le,M(a,N,le))},K=Zr(e.mode),ie=Zr(e.reValidateMode);if(R){let le,Se;const yt=b.type?Ur(R._f):Ms(f),Be=f.type===Mt.BLUR||f.type===Mt.FOCUS_OUT,Rn=!ao(R._f)&&!e.resolver&&!M(t.errors,N)&&!R._f.deps||lo(Be,M(t.touchedFields,N),t.isSubmitted,ie,K),qt=qr(N,l,Be);oe(a,N,yt),Be?(R._f.onBlur&&R._f.onBlur(f),c&&c(0)):R._f.onChange&&R._f.onChange(f);const Gt=F(N,yt,Be),Mn=!ve(Gt)||qt;if(!Be&&h.state.next({name:N,type:f.type,values:ye(a)}),Rn)return(u.isValid||p.isValid)&&(e.mode==="onBlur"?Be&&k():Be||k()),Mn&&h.state.next({name:N,...qt?{}:Gt});if(!Be&&qt&&h.state.next({...t}),e.resolver){const{errors:Tr}=await G([N]);if(A(yt),P){const Vn=Gr(t.errors,s,N),Ar=Gr(Tr,s,Vn.name||N);le=Ar.error,N=Ar.name,Se=ve(Tr)}}else S([N],!0),le=(await Hr(R,l.disabled,a,y,e.shouldUseNativeValidation))[N],S([N]),A(yt),P&&(le?Se=!1:(u.isValid||p.isValid)&&(Se=await D(s,!0)));P&&(R._f.deps&&W(R._f.deps),U(N,Se,le,Gt))}},m=(f,b)=>{if(M(t.errors,b)&&f.focus)return f.focus(),1},W=async(f,b={})=>{let N,P;const R=mt(f);if(e.resolver){const A=await _(fe(f)?f:R);N=ve(A),P=f?!R.some(K=>M(A,K)):N}else f?(P=(await Promise.all(R.map(async A=>{const K=M(s,A);return await D(K&&K._f?{[A]:K}:K)}))).every(Boolean),!(!P&&!t.isValid)&&k()):P=N=await D(s);return h.state.next({...!Ve(f)||(u.isValid||p.isValid)&&N!==t.isValid?{}:{name:f},...e.resolver||!f?{isValid:N}:{},errors:t.errors}),b.shouldFocus&&!P&&ht(s,m,f?R:l.mount),P},E=f=>{const b={...o.mount?a:n};return fe(f)?b:Ve(f)?M(b,f):f.map(N=>M(b,N))},j=(f,b)=>({invalid:!!M((b||t).errors,f),isDirty:!!M((b||t).dirtyFields,f),error:M((b||t).errors,f),isValidating:!!M(t.validatingFields,f),isTouched:!!M((b||t).touchedFields,f)}),O=f=>{f&&mt(f).forEach(b=>xe(t.errors,b)),h.state.next({errors:f?t.errors:{}})},I=(f,b,N)=>{const P=(M(s,f,{_f:{}})._f||{}).ref,R=M(t.errors,f)||{},{ref:A,message:K,type:ie,...le}=R;oe(t.errors,f,{...le,...b,ref:P}),h.state.next({name:f,errors:t.errors,isValid:!1}),N&&N.shouldFocus&&P&&P.focus&&P.focus()},ee=(f,b)=>Te(f)?h.state.subscribe({next:N=>f($(void 0,b),N)}):$(f,b,!0),se=f=>h.state.subscribe({next:b=>{io(f.name,b.name,f.exact)&&oo(b,f.formState||u,Zt,f.reRenderRoot)&&f.callback({values:{...a},...t,...b})}}).unsubscribe,ue=f=>(o.mount=!0,p={...p,...f.formState},se({...f,formState:p})),ne=(f,b={})=>{for(const N of f?mt(f):l.mount)l.mount.delete(N),l.array.delete(N),b.keepValue||(xe(s,N),xe(a,N)),!b.keepError&&xe(t.errors,N),!b.keepDirty&&xe(t.dirtyFields,N),!b.keepTouched&&xe(t.touchedFields,N),!b.keepIsValidating&&xe(t.validatingFields,N),!e.shouldUnregister&&!b.keepDefaultValue&&xe(n,N);h.state.next({values:ye(a)}),h.state.next({...t,...b.keepDirty?{isDirty:Z()}:{}}),!b.keepIsValid&&k()},ae=({disabled:f,name:b})=>{(Ne(f)&&o.mount||f||l.disabled.has(b))&&(f?l.disabled.add(b):l.disabled.delete(b))},he=(f,b={})=>{let N=M(s,f);const P=Ne(b.disabled)||Ne(e.disabled);return oe(s,f,{...N||{},_f:{...N&&N._f?N._f:{ref:{name:f}},name:f,mount:!0,...b}}),l.mount.add(f),N?ae({disabled:Ne(b.disabled)?b.disabled:e.disabled,name:f}):V(f,!0,b.value),{...P?{disabled:b.disabled||e.disabled}:{},...e.progressive?{required:!!b.required,min:dt(b.min),max:dt(b.max),minLength:dt(b.minLength),maxLength:dt(b.maxLength),pattern:dt(b.pattern)}:{},name:f,onChange:C,onBlur:C,ref:R=>{if(R){he(f,b),N=M(s,f);const A=fe(R.value)&&R.querySelectorAll&&R.querySelectorAll("input,select,textarea")[0]||R,K=eo(A),ie=N._f.refs||[];if(K?ie.find(le=>le===A):A===N._f.ref)return;oe(s,f,{_f:{...N._f,...K?{refs:[...ie.filter(Xt),A,...Array.isArray(M(n,f))?[{}]:[]],ref:{type:A.type,name:f}}:{ref:A}}}),V(f,!1,void 0,A)}else N=M(s,f,{}),N._f&&(N._f.mount=!1),(e.shouldUnregister||b.shouldUnregister)&&!(Vs(l.array,f)&&o.action)&&l.unMount.add(f)}}},ge=()=>e.shouldFocusError&&ht(s,m,l.mount),te=f=>{Ne(f)&&(h.state.next({disabled:f}),ht(s,(b,N)=>{const P=M(s,N);P&&(b.disabled=P._f.disabled||f,Array.isArray(P._f.refs)&&P._f.refs.forEach(R=>{R.disabled=P._f.disabled||f}))},0,!1))},ce=(f,b)=>async N=>{let P;N&&(N.preventDefault&&N.preventDefault(),N.persist&&N.persist());let R=ye(a);if(h.state.next({isSubmitting:!0}),e.resolver){const{errors:A,values:K}=await G();t.errors=A,R=K}else await D(s);if(l.disabled.size)for(const A of l.disabled)oe(R,A,void 0);if(xe(t.errors,"root"),ve(t.errors)){h.state.next({errors:{}});try{await f(R,N)}catch(A){P=A}}else b&&await b({...t.errors},N),ge(),setTimeout(ge);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ve(t.errors)&&!P,submitCount:t.submitCount+1,errors:t.errors}),P)throw P},_e=(f,b={})=>{M(s,f)&&(fe(b.defaultValue)?X(f,ye(M(n,f))):(X(f,b.defaultValue),oe(n,f,ye(b.defaultValue))),b.keepTouched||xe(t.touchedFields,f),b.keepDirty||(xe(t.dirtyFields,f),t.isDirty=b.defaultValue?Z(f,ye(M(n,f))):Z()),b.keepError||(xe(t.errors,f),u.isValid&&k()),h.state.next({...t}))},de=(f,b={})=>{const N=f?ye(f):n,P=ye(N),R=ve(f),A=R?n:P;if(b.keepDefaultValues||(n=N),!b.keepValues){if(b.keepDirtyValues){const K=new Set([...l.mount,...Object.keys(ut(n,a))]);for(const ie of Array.from(K))M(t.dirtyFields,ie)?oe(A,ie,M(a,ie)):X(ie,M(A,ie))}else{if(br&&fe(f))for(const K of l.mount){const ie=M(s,K);if(ie&&ie._f){const le=Array.isArray(ie._f.refs)?ie._f.refs[0]:ie._f.ref;if(Vt(le)){const Se=le.closest("form");if(Se){Se.reset();break}}}}for(const K of l.mount)X(K,M(A,K))}a=ye(A),h.array.next({values:{...A}}),h.state.next({values:{...A}})}l={mount:b.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!u.isValid||!!b.keepIsValid||!!b.keepDirtyValues,o.watch=!!e.shouldUnregister,h.state.next({submitCount:b.keepSubmitCount?t.submitCount:0,isDirty:R?!1:b.keepDirty?t.isDirty:!!(b.keepDefaultValues&&!We(f,n)),isSubmitted:b.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:R?{}:b.keepDirtyValues?b.keepDefaultValues&&a?ut(n,a):t.dirtyFields:b.keepDefaultValues&&f?ut(n,f):b.keepDirty?t.dirtyFields:{},touchedFields:b.keepTouched?t.touchedFields:{},errors:b.keepErrors?t.errors:{},isSubmitSuccessful:b.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},Oe=(f,b)=>de(Te(f)?f(a):f,b),at=(f,b={})=>{const N=M(s,f),P=N&&N._f;if(P){const R=P.refs?P.refs[0]:P.ref;R.focus&&(R.focus(),b.shouldSelect&&Te(R.select)&&R.select())}},Zt=f=>{t={...t,...f}},ot={control:{register:he,unregister:ne,getFieldState:j,handleSubmit:ce,setError:I,_subscribe:se,_runSchema:G,_getWatch:$,_getDirty:Z,_setValid:k,_setFieldArray:w,_setDisabledField:ae,_setErrors:T,_getFieldArray:H,_reset:de,_resetDefaultValues:()=>Te(e.defaultValues)&&e.defaultValues().then(f=>{Oe(f,e.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:Q,_disableForm:te,_subjects:h,_proxyFormState:u,get _fields(){return s},get _formValues(){return a},get _state(){return o},set _state(f){o=f},get _defaultValues(){return n},get _names(){return l},set _names(f){l=f},get _formState(){return t},get _options(){return e},set _options(f){e={...e,...f}}},subscribe:ue,trigger:W,register:he,handleSubmit:ce,watch:ee,setValue:X,getValues:E,reset:Oe,resetField:_e,clearErrors:O,unregister:ne,setError:I,setFocus:at,getFieldState:j};return{...ot,formControl:ot}}function ho(r={}){const e=v.useRef(void 0),t=v.useRef(void 0),[s,n]=v.useState({isDirty:!1,isValidating:!1,isLoading:Te(r.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1,isReady:!1,defaultValues:Te(r.defaultValues)?void 0:r.defaultValues});e.current||(e.current={...r.formControl?r.formControl:mo(r),formState:s},r.formControl&&r.defaultValues&&!Te(r.defaultValues)&&r.formControl.reset(r.defaultValues,r.resetOptions));const a=e.current.control;return a._options=r,vr(()=>{const o=a._subscribe({formState:a._proxyFormState,callback:()=>n({...a._formState}),reRenderRoot:!0});return n(l=>({...l,isReady:!0})),a._formState.isReady=!0,o},[a]),v.useEffect(()=>a._disableForm(r.disabled),[a,r.disabled]),v.useEffect(()=>{r.mode&&(a._options.mode=r.mode),r.reValidateMode&&(a._options.reValidateMode=r.reValidateMode),r.errors&&!ve(r.errors)&&a._setErrors(r.errors)},[a,r.errors,r.mode,r.reValidateMode]),v.useEffect(()=>{r.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,r.shouldUnregister]),v.useEffect(()=>{if(a._proxyFormState.isDirty){const o=a._getDirty();o!==s.isDirty&&a._subjects.state.next({isDirty:o})}},[a,s.isDirty]),v.useEffect(()=>{r.values&&!We(r.values,t.current)?(a._reset(r.values,a._options.resetOptions),t.current=r.values,n(o=>({...o}))):a._resetDefaultValues()},[a,r.values]),v.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()}),e.current.formState=Is(s,a),e.current}const Ys={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},po={sm:"h-6",md:"h-10",lg:"h-12"},xo={sm:"px-2",md:"px-2.5",lg:"px-3"};function Xr(r,e,t,s,n,a,o){const l=e?"datetime-local":"date",c=L("box-border w-full rounded-lg border outline-none transition font-[var(--font-primary)]",Ys[t],po[t],xo[t],a?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]"),p=Ha(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)]",o);return i.jsxs(i.Fragment,{children:[i.jsx("input",{id:r,type:l,disabled:n,"aria-disabled":n,"data-disabled":n?"true":"false",...s,className:p}),i.jsx("div",{children:a!=null&&a.message?i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:a.message}):i.jsx("span",{"aria-hidden":"true",children:" "})})]})}function Hs(r){const{control:e,name:t,rules:s,defaultValue:n,showTime:a=!1,size:o="sm",width:l="100%",label:c,labelHidden:d=!1,hasError:u=!1,errorMessage:p="",disabled:h=!1,className:y,onChange:x}=r,k=v.useId(),S=t||k;return i.jsxs("div",{className:L("flex flex-col",y),style:{width:l,maxWidth:"100%"},children:[c&&i.jsx("label",{htmlFor:S,className:L("pb-2 text-[var(--color-ds-text-primary)]",Ys[o],d&&"sr-only"),children:c}),e&&t?i.jsx(Ce,{name:t,control:e,rules:s,defaultValue:n,render:({field:w,fieldState:g})=>Xr(S,a,o,{value:w.value,onChange:w.onChange,onBlur:w.onBlur},h,g.error,y)}):Xr(S,a,o,{defaultValue:n,onChange:x},h,u?{message:p}:void 0,y)]})}const go=({trigger:r,items:e,align:t="left",className:s})=>{const[n,a]=v.useState(!1),o=v.useRef(null),l=v.useRef([]);v.useEffect(()=>{const d=u=>{o.current&&!o.current.contains(u.target)&&a(!1)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[]);const c=d=>{var p,h;const u=l.current.findIndex(y=>y===document.activeElement);if(d.key==="Escape")a(!1);else if(d.key==="ArrowDown"){d.preventDefault();const y=(u+1)%e.length;(p=l.current[y])==null||p.focus()}else if(d.key==="ArrowUp"){d.preventDefault();const y=(u-1+e.length)%e.length;(h=l.current[y])==null||h.focus()}};return i.jsxs("div",{className:L("relative inline-block",s),ref:o,children:[i.jsx("button",{type:"button",onClick:()=>a(d=>!d),className:"inline-flex items-center focus:outline-none","aria-haspopup":"menu","aria-expanded":n,children:r}),n&&i.jsx("div",{role:"menu","aria-orientation":"vertical",className:L("absolute mt-2 min-w-[160px] bg-[var(--color-ds-background-page)]","border border-[var(--color-ds-border-muted)] rounded shadow-lg z-10",t==="right"?"right-0":"left-0"),onKeyDown:c,children:e.map((d,u)=>{const{label:p,onSelect:h,disabled:y,icon:x}=d;return i.jsxs("button",{role:"menuitem",type:"button",disabled:y,ref:k=>{l.current[u]=k},className:L("w-full flex items-center px-4 py-2 text-[var(--color-ds-text-primary)] text-ds-md transition-colors",y?"opacity-50 cursor-not-allowed":"hover:bg-[var(--color-ds-background-surface)]"),onClick:()=>{y||(h(),a(!1))},children:[x&&i.jsx(x,{className:"w-5 h-5 mr-2 text-[var(--color-ds-text-secondary)]"}),p]},u)})})]})},bo=(r,e,t,s)=>{var a,o,l,c;const n=[t,{code:e,...s||{}}];if((o=(a=r==null?void 0:r.services)==null?void 0:a.logger)!=null&&o.forward)return r.services.logger.forward(n,"warn","react-i18next::",!0);Ye(n[0])&&(n[0]=`react-i18next:: ${n[0]}`),(c=(l=r==null?void 0:r.services)==null?void 0:l.logger)!=null&&c.warn?r.services.logger.warn(...n):console!=null&&console.warn&&console.warn(...n)},Kr={},ir=(r,e,t,s)=>{Ye(t)&&Kr[t]||(Ye(t)&&(Kr[t]=new Date),bo(r,e,t,s))},Xs=(r,e)=>()=>{if(r.isInitialized)e();else{const t=()=>{setTimeout(()=>{r.off("initialized",t)},0),e()};r.on("initialized",t)}},lr=(r,e,t)=>{r.loadNamespaces(e,Xs(r,t))},Jr=(r,e,t,s)=>{if(Ye(t)&&(t=[t]),r.options.preload&&r.options.preload.indexOf(e)>-1)return lr(r,t,s);t.forEach(n=>{r.options.ns.indexOf(n)<0&&r.options.ns.push(n)}),r.loadLanguages(e,Xs(r,s))},yo=(r,e,t={})=>!e.languages||!e.languages.length?(ir(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(r,{lng:t.lng,precheck:(s,n)=>{var a;if(((a=t.bindI18n)==null?void 0:a.indexOf("languageChanging"))>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!n(s.isLanguageChangingTo,r))return!1}}),Ye=r=>typeof r=="string",vo=r=>typeof r=="object"&&r!==null,wo=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,ko={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},jo=r=>ko[r],Eo=r=>r.replace(wo,jo);let No={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Eo};const So=()=>No;let _o;const Fo=()=>_o,To=v.createContext();class Ao{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(t=>{this.usedNamespaces[t]||(this.usedNamespaces[t]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Co=(r,e)=>{const t=v.useRef();return v.useEffect(()=>{t.current=r},[r,e]),t.current},Ks=(r,e,t,s)=>r.getFixedT(e,t,s),Oo=(r,e,t,s)=>v.useCallback(Ks(r,e,t,s),[r,e,t,s]),Er=(r,e={})=>{var V,F,U,G;const{i18n:t}=e,{i18n:s,defaultNS:n}=v.useContext(To)||{},a=t||s||Fo();if(a&&!a.reportNamespaces&&(a.reportNamespaces=new Ao),!a){ir(a,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const _=(Q,Z)=>Ye(Z)?Z:vo(Z)&&Ye(Z.defaultValue)?Z.defaultValue:Array.isArray(Q)?Q[Q.length-1]:Q,D=[_,{},!1];return D.t=_,D.i18n={},D.ready=!1,D}(V=a.options.react)!=null&&V.wait&&ir(a,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...So(),...a.options.react,...e},{useSuspense:l,keyPrefix:c}=o;let d=n||((F=a.options)==null?void 0:F.defaultNS);d=Ye(d)?[d]:d||["translation"],(G=(U=a.reportNamespaces).addUsedNamespaces)==null||G.call(U,d);const u=(a.isInitialized||a.initializedStoreOnce)&&d.every(_=>yo(_,a,o)),p=Oo(a,e.lng||null,o.nsMode==="fallback"?d:d[0],c),h=()=>p,y=()=>Ks(a,e.lng||null,o.nsMode==="fallback"?d:d[0],c),[x,k]=v.useState(h);let S=d.join();e.lng&&(S=`${e.lng}${S}`);const w=Co(S),g=v.useRef(!0);v.useEffect(()=>{const{bindI18n:_,bindI18nStore:D}=o;g.current=!0,!u&&!l&&(e.lng?Jr(a,e.lng,d,()=>{g.current&&k(y)}):lr(a,d,()=>{g.current&&k(y)})),u&&w&&w!==S&&g.current&&k(y);const Q=()=>{g.current&&k(y)};return _&&(a==null||a.on(_,Q)),D&&(a==null||a.store.on(D,Q)),()=>{g.current=!1,a&&(_==null||_.split(" ").forEach(Z=>a.off(Z,Q))),D&&a&&D.split(" ").forEach(Z=>a.store.off(Z,Q))}},[a,S]),v.useEffect(()=>{g.current&&u&&k(h)},[a,c,u]);const T=[x,a,u];if(T.t=x,T.i18n=a,T.ready=u,u||!u&&!l)return T;throw new Promise(_=>{e.lng?Jr(a,e.lng,d,()=>_()):lr(a,d,()=>_())})},cr={sm:"text-sm",md:"text-base",lg:"text-lg"};function Qr(r,e,t,s,n,a,o,l,c){const{t:d}=Er(),u=v.useRef(null),p=typeof s=="number"&&e.length>=s,h=()=>{var g;!o&&!p&&((g=u.current)==null||g.click())},y=g=>{const T=g.target.files;if(!T)return;const V=Array.from(T);let F=e.concat(V);s&&(F=F.slice(0,s)),t(F),g.target.value=""},x=g=>{if(g.preventDefault(),o||p)return;const T=Array.from(g.dataTransfer.files);let V=e.concat(T);s&&(V=V.slice(0,s)),t(V)},k=g=>{g.preventDefault()},S=g=>{const T=URL.createObjectURL(g);window.open(T)},w=g=>{const T=e.filter((V,F)=>F!==g);t(T)};return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"self-start mb-4 w-auto",children:i.jsx(Pe,{type:"button",variant:"outline",size:a,icon:Mr,onClick:h,disabled:o||p,children:d("ds.fileUploader.browse","Browse files")})}),!p&&i.jsxs("div",{className:L("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",o?"opacity-50 cursor-not-allowed":"hover:border-[var(--color-ds-border-default)]",cr[a],c),onDrop:x,onDragOver:k,children:[i.jsx("input",{id:r,type:"file",ref:u,className:"hidden",multiple:s!==1,accept:n,onChange:y,disabled:o}),i.jsx(Me,{component:ta,size:"md",className:"w-8 h-8 text-[var(--color-ds-text-secondary)]"}),i.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")})]}),e.length>0&&i.jsx("ul",{className:"mt-4 space-y-1",children:e.map((g,T)=>i.jsxs("li",{className:"flex items-center justify-between text-[var(--color-ds-text-secondary)] text-sm",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(Mr,{className:"w-4 h-4 mr-2","aria-hidden":"true"}),i.jsx("span",{className:"truncate pr-2",children:g.name})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx(Pe,{variant:"ghost",size:"sm",icon:ks,ariaLabel:d("ds.fileUploader.view","View"),onClick:()=>S(g)}),i.jsx(Pe,{variant:"ghost",size:"sm",icon:xr,ariaLabel:d("ds.fileUploader.remove","Remove"),onClick:()=>w(T)})]})]},T))}),i.jsx("div",{className:"pt-[5px] min-h-[18px] w-full",children:l!=null&&l.message?i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:l.message}):i.jsx("span",{"aria-hidden":"true",children:" "})})]})}function Js(r){const{control:e,name:t,rules:s,defaultValue:n,maxFiles:a,accept:o,size:l="sm",width:c="100%",label:d,labelHidden:u=!1,disabled:p=!1,hasError:h=!1,errorMessage:y="",className:x}=r,k=v.useId(),S=t||k;if(e&&t)return i.jsxs("div",{className:L("flex flex-col",x),style:{width:c},children:[d&&i.jsx("label",{htmlFor:S,className:L("pb-[10px] text-[var(--color-ds-text-primary)]",cr[l],u&&"sr-only"),children:d}),i.jsx(Ce,{name:t,control:e,rules:s,defaultValue:n instanceof FileList?Array.from(n):n||[],render:({field:T,fieldState:V})=>Qr(S,T.value,F=>T.onChange(F),a,o,l,p,V.error,x)})]});const[w,g]=v.useState(n instanceof FileList?Array.from(n):n||[]);return i.jsxs("div",{className:L("flex flex-col",x),style:{width:c},children:[d&&i.jsx("label",{htmlFor:S,className:L("pb-[10px] text-[var(--color-ds-text-primary)]",cr[l],u&&"sr-only"),children:d}),Qr(S,w,g,a,o,l,p,h?{message:y}:void 0,x)]})}const Xe=({count:r=1,width:e,height:t="1em",variant:s="rect",className:n})=>{const a=Array.from({length:r});return i.jsx(i.Fragment,{children:a.map((o,l)=>i.jsx("span",{role:"status","aria-label":"Cargando...",className:L("bg-[var(--color-ds-border-muted)] animate-pulse inline-block",s==="circle"?"rounded-full":"rounded",n),style:{width:e??"auto",height:t}},l))})},jt={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},Ro={sm:"h-6",md:"h-10",lg:"h-12"},Mo={sm:"px-2",md:"px-2.5",lg:"px-3"},es={sm:"pl-2",md:"pl-2.5",lg:"pl-3"},Vo={sm:"1.5rem",md:"2.5rem",lg:"3rem"};function Bt({id:r,type:e="text",size:t="sm",width:s="100%",label:n,labelHidden:a=!1,hasError:o=!1,errorMessage:l="",prefixIcon:c,suffixIcon:d,separator:u,suffixButton:p,disabled:h=!1,control:y,name:x,rules:k,defaultValue:S,reserveErrorSpace:w,disableErrorPlaceholder:g,loading:T=!1,className:V,...F}){const U=v.useId(),[G,_]=v.useState(!1),D=r||U,Q=e==="password",$=c??(e==="number"?ia:void 0),H=Q?G?na:ks:d,J=typeof w=="boolean"?w:typeof g=="boolean"?!g:!!y,q=L("box-border w-full rounded-lg border placeholder-[var(--color-ds-text-secondary)] outline-none transition font-[var(--font-primary)] appearance-none",jt[t],Ro[t],Mo[t],o?"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 T?i.jsxs("div",{className:"flex flex-col",style:{width:s,maxWidth:"100%"},children:[!a&&n&&i.jsx("label",{htmlFor:D,className:L("pb-2",jt[t]),children:n}),i.jsx(Xe,{width:"100%",height:Vo[t],variant:"rect",className:"rounded-lg"}),i.jsx("div",{className:"min-h-[18px] w-full",children:i.jsx("span",{"aria-hidden":"true",children:" "})})]}):y&&x?i.jsx(Ce,{name:x,control:y,rules:k,defaultValue:S,render:({field:X,fieldState:C})=>i.jsxs("div",{className:"flex flex-col",style:{width:s},children:[!a&&n&&i.jsx("label",{htmlFor:D,className:L("pb-2 text-[var(--color-ds-text-primary)]",jt[t]),children:n}),i.jsxs("div",{className:"relative flex items-center w-full",children:[$&&i.jsx("div",{className:L("absolute left-0 flex items-center h-full",es[t]),children:i.jsx(Me,{component:$,size:t,className:"text-[var(--color-ds-text-secondary)]"})}),i.jsx("input",{...X,id:D,type:Q?G?"text":"password":e,disabled:h,"aria-invalid":!!C.error,className:L(q,$&&"pl-9",H&&"pr-9",V),onInvalid:m=>m.preventDefault(),style:Q&&!G?{WebkitTextSecurity:"disc",MozTextSecurity:"disc"}:void 0}),u&&i.jsx("div",{className:"flex items-center h-full",children:u}),p&&i.jsx("div",{className:"flex items-center h-full pr-2",children:p}),H&&i.jsx("button",{type:"button",onClick:()=>_(m=>!m),className:"absolute right-0 flex items-center h-full pr-2",tabIndex:-1,children:i.jsx(Me,{component:H,size:t,className:"text-[var(--color-ds-text-secondary)]"})})]}),J?i.jsx("div",{className:"min-h-[18px]",children:C.error?i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:C.error.message}):i.jsx("span",{"aria-hidden":"true",children:" "})}):C.error?i.jsx("div",{className:"pt-1",children:i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:C.error.message})}):null]})}):i.jsxs("div",{className:"flex flex-col",style:{width:s},children:[!a&&n&&i.jsx("label",{htmlFor:D,className:L("pb-2 text-[var(--color-ds-text-primary)]",jt[t]),children:n}),i.jsxs("div",{className:"relative flex items-center w-full",children:[$&&i.jsx("div",{className:L("absolute left-0 flex items-center h-full",es[t]),children:i.jsx(Me,{component:$,size:t,className:"text-[var(--color-ds-text-secondary)]"})}),i.jsx("input",{...F,id:D,type:Q?G?"text":"password":e,disabled:h,"aria-invalid":o,className:L(q,$&&"pl-9",H&&"pr-9",V),onInvalid:X=>X.preventDefault(),style:Q&&!G?{WebkitTextSecurity:"disc",MozTextSecurity:"disc"}:void 0}),u&&i.jsx("div",{className:"flex items-center h-full",children:u}),p&&i.jsx("div",{className:"flex items-center h-full",children:p}),H&&i.jsx("button",{type:"button",onClick:()=>_(X=>!X),className:"absolute right-0 flex items-center h-full pr-2",tabIndex:-1,children:i.jsx(Me,{component:H,size:t,className:"text-[var(--color-ds-text-secondary)]"})})]}),J?i.jsx("div",{className:"min-h-[18px]",children:o&&l?i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:l}):i.jsx("span",{"aria-hidden":"true",children:" "})}):o&&l?i.jsx("div",{className:"pt-1",children:i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:l})}):null]})}const $o={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},Kt=400,Et=8,Qs=({children:r,size:e="sm",position:t="top",className:s})=>{const[n,a]=v.useState(!1),[o,l]=v.useState({x:0,y:0}),c=v.useRef(null),d=v.useId();v.useEffect(()=>{if(n&&c.current){const h=c.current.getBoundingClientRect();let y=0,x=0;switch(t){case"top":y=h.left+h.width/2-Kt/2,x=h.top-Et;break;case"bottom":y=h.left+h.width/2-Kt/2,x=h.bottom+Et;break;case"left":y=h.left-Kt-Et,x=h.top+h.height/2;break;case"right":y=h.right+Et,x=h.top+h.height/2;break}l({x:y,y:x})}},[n,t]);const u=()=>typeof r=="string"?i.jsx("div",{dangerouslySetInnerHTML:{__html:r}}):i.jsx(i.Fragment,{children:r}),p=n?i.jsx("div",{id:d,role:"tooltip",className:L("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:`${o.y}px`,left:`${o.x}px`,transform:t==="left"||t==="right"?"translateY(-50%)":t==="top"?"translateY(-100%)":void 0},children:u()}):null;return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button","aria-describedby":d,ref:c,className:L("inline-flex items-center justify-center focus:outline-none",$o[e],"text-[var(--color-ds-text-secondary)] hover:text-[var(--color-ds-text-primary)]",s),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onFocus:()=>a(!0),onBlur:()=>a(!1),children:i.jsx(ca,{className:"w-full h-full"})}),vs.createPortal(p,document.body)]})};function Do({name:r,label:e,type:t="text",size:s="sm",width:n,placeholder:a,validation:o,loadingDefaults:l,disabled:c,info:d}){var S;const{control:u,formState:{errors:p}}=gt(),h=!!p[r],y=((S=p[r])==null?void 0:S.message)||"",x="relative",k=n??"w-full";return i.jsxs("div",{className:x,children:[i.jsx(Ce,{name:r,control:u,rules:o,render:({field:w})=>i.jsx(Bt,{label:e,size:s,width:k,placeholder:a,hasError:h,errorMessage:y,loading:l,type:t,...w,disabled:c,reserveErrorSpace:!0})}),d&&i.jsx(Qs,{size:s,position:"left",className:"absolute top-1/2 right-2 -translate-y-1/2",children:d})]})}const Nr=v.memo(Do);Nr.displayName="FormFieldInput";function Io({title:r,headerButtons:e,children:t,className:s}){return i.jsxs("div",{className:L("flex flex-col h-full",s),children:[i.jsxs("div",{className:"flex items-center justify-between py-4",children:[i.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:r}),e&&i.jsx("div",{className:"flex items-center space-x-2",children:e})]}),i.jsx("main",{className:"flex-1 overflow-auto",children:t})]})}const ts=(r,e,t)=>{if(r&&"reportValidity"in r){const s=M(t,e);r.setCustomValidity(s&&s.message||""),r.reportValidity()}},en=(r,e)=>{for(const t in e.fields){const s=e.fields[t];s&&s.ref&&"reportValidity"in s.ref?ts(s.ref,t,r):s&&s.refs&&s.refs.forEach(n=>ts(n,t,r))}},Lo=(r,e)=>{e.shouldUseNativeValidation&&en(r,e);const t={};for(const s in r){const n=M(e.fields,s),a=Object.assign(r[s]||{},{ref:n&&n.ref});if(Po(e.names||Object.keys(r),s)){const o=Object.assign({},M(t,s));oe(o,"root",a),oe(t,s,o)}else oe(t,s,a)}return t},Po=(r,e)=>{const t=rs(e);return r.some(s=>rs(s).match(`^${t}\\.\\d+`))};function rs(r){return r.replace(/\]|\[/g,"")}function zo(r,e,t){return t===void 0&&(t={}),function(s,n,a){try{return Promise.resolve(function(o,l){try{var c=(e!=null&&e.context&&process.env.NODE_ENV==="development"&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(r[t.mode==="sync"?"validateSync":"validate"](s,Object.assign({abortEarly:!1},e,{context:n}))).then(function(d){return a.shouldUseNativeValidation&&en({},a),{values:t.raw?Object.assign({},s):d,errors:{}}}))}catch(d){return l(d)}return c&&c.then?c.then(void 0,l):c}(0,function(o){if(!o.inner)throw o;return{values:{},errors:Lo((l=o,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 p=d[u.path].types,h=p&&p[u.type];d[u.path]=zs(u.path,c,d,u.type,h?[].concat(h,u.message):u.message)}return d},{})),a)};var l,c}))}catch(o){return Promise.reject(o)}}}var Jt,ss;function Bo(){if(ss)return Jt;ss=1;function r(w){this._maxSize=w,this.clear()}r.prototype.clear=function(){this._size=0,this._values=Object.create(null)},r.prototype.get=function(w){return this._values[w]},r.prototype.set=function(w,g){return this._size>=this._maxSize&&this.clear(),w in this._values||this._size++,this._values[w]=g};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,t=/^\d+$/,s=/^\d/,n=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,a=/^\s*(['"]?)(.*?)(\1)\s*$/,o=512,l=new r(o),c=new r(o),d=new r(o);Jt={Cache:r,split:p,normalizePath:u,setter:function(w){var g=u(w);return c.get(w)||c.set(w,function(V,F){for(var U=0,G=g.length,_=V;U<G-1;){var D=g[U];if(D==="__proto__"||D==="constructor"||D==="prototype")return V;_=_[g[U++]]}_[g[U]]=F})},getter:function(w,g){var T=u(w);return d.get(w)||d.set(w,function(F){for(var U=0,G=T.length;U<G;)if(F!=null||!g)F=F[T[U++]];else return;return F})},join:function(w){return w.reduce(function(g,T){return g+(y(T)||t.test(T)?"["+T+"]":(g?".":"")+T)},"")},forEach:function(w,g,T){h(Array.isArray(w)?w:p(w),g,T)}};function u(w){return l.get(w)||l.set(w,p(w).map(function(g){return g.replace(a,"$2")}))}function p(w){return w.match(e)||[""]}function h(w,g,T){var V=w.length,F,U,G,_;for(U=0;U<V;U++)F=w[U],F&&(S(F)&&(F='"'+F+'"'),_=y(F),G=!_&&/^\d+$/.test(F),g.call(T,F,_,G,U,w))}function y(w){return typeof w=="string"&&w&&["'",'"'].indexOf(w.charAt(0))!==-1}function x(w){return w.match(s)&&!w.match(t)}function k(w){return n.test(w)}function S(w){return!y(w)&&(x(w)||k(w))}return Jt}var He=Bo(),Qt,ns;function Uo(){if(ns)return Qt;ns=1;const r=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,e=u=>u.match(r)||[],t=u=>u[0].toUpperCase()+u.slice(1),s=(u,p)=>e(u).join(p).toLowerCase(),n=u=>e(u).reduce((p,h)=>`${p}${p?h[0].toUpperCase()+h.slice(1).toLowerCase():h.toLowerCase()}`,"");return Qt={words:e,upperFirst:t,camelCase:n,pascalCase:u=>t(n(u)),snakeCase:u=>s(u,"_"),kebabCase:u=>s(u,"-"),sentenceCase:u=>t(s(u," ")),titleCase:u=>e(u).map(t).join(" ")},Qt}var er=Uo(),Nt={exports:{}},as;function Zo(){if(as)return Nt.exports;as=1,Nt.exports=function(n){return r(e(n),n)},Nt.exports.array=r;function r(n,a){var o=n.length,l=new Array(o),c={},d=o,u=t(a),p=s(n);for(a.forEach(function(y){if(!p.has(y[0])||!p.has(y[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(y,x,k){if(k.has(y)){var S;try{S=", node was:"+JSON.stringify(y)}catch{S=""}throw new Error("Cyclic dependency"+S)}if(!p.has(y))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(y));if(!c[x]){c[x]=!0;var w=u.get(y)||new Set;if(w=Array.from(w),x=w.length){k.add(y);do{var g=w[--x];h(g,p.get(g),k)}while(x);k.delete(y)}l[--o]=y}}}function e(n){for(var a=new Set,o=0,l=n.length;o<l;o++){var c=n[o];a.add(c[0]),a.add(c[1])}return Array.from(a)}function t(n){for(var a=new Map,o=0,l=n.length;o<l;o++){var c=n[o];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,o=0,l=n.length;o<l;o++)a.set(n[o],o);return a}return Nt.exports}var Wo=Zo();const qo=Dn(Wo),Go=Object.prototype.toString,Yo=Error.prototype.toString,Ho=RegExp.prototype.toString,Xo=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Ko=/^Symbol\((.*)\)(.*)$/;function Jo(r){return r!=+r?"NaN":r===0&&1/r<0?"-0":""+r}function os(r,e=!1){if(r==null||r===!0||r===!1)return""+r;const t=typeof r;if(t==="number")return Jo(r);if(t==="string")return e?`"${r}"`:r;if(t==="function")return"[Function "+(r.name||"anonymous")+"]";if(t==="symbol")return Xo.call(r).replace(Ko,"Symbol($1)");const s=Go.call(r).slice(8,-1);return s==="Date"?isNaN(r.getTime())?""+r:r.toISOString(r):s==="Error"||r instanceof Error?"["+Yo.call(r)+"]":s==="RegExp"?Ho.call(r):null}function ze(r,e){let t=os(r,e);return t!==null?t:JSON.stringify(r,function(s,n){let a=os(this[s],e);return a!==null?a:n},2)}function tn(r){return r==null?[]:[].concat(r)}let rn,sn,nn,Qo=/\$\{\s*(\w+)\s*\}/g;rn=Symbol.toStringTag;class is{constructor(e,t,s,n){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[rn]="Error",this.name="ValidationError",this.value=t,this.path=s,this.type=n,this.errors=[],this.inner=[],tn(e).forEach(a=>{if(je.isError(a)){this.errors.push(...a.errors);const o=a.inner.length?a.inner:[a];this.inner.push(...o)}else this.errors.push(a)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}sn=Symbol.hasInstance;nn=Symbol.toStringTag;class je extends Error{static formatError(e,t){const s=t.label||t.path||"this";return t=Object.assign({},t,{path:s,originalPath:t.path}),typeof e=="string"?e.replace(Qo,(n,a)=>ze(t[a])):typeof e=="function"?e(t):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,t,s,n,a){const o=new is(e,t,s,n);if(a)return o;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[nn]="Error",this.name=o.name,this.message=o.message,this.type=o.type,this.value=o.value,this.path=o.path,this.errors=o.errors,this.inner=o.inner,Error.captureStackTrace&&Error.captureStackTrace(this,je)}static[sn](e){return is[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Re={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:r,type:e,value:t,originalValue:s})=>{const n=s!=null&&s!==t?` (cast from the value \`${ze(s,!0)}\`).`:".";return e!=="mixed"?`${r} must be a \`${e}\` type, but the final value was: \`${ze(t,!0)}\``+n:`${r} must match the configured type. The validated value was: \`${ze(t,!0)}\``+n}},ke={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"},Ze={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"},ur={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},dr={isValue:"${path} field must be ${value}"},Ct={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Ot={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"},ei={notType:r=>{const{path:e,value:t,spec:s}=r,n=s.types.length;if(Array.isArray(t)){if(t.length<n)return`${e} tuple value has too few items, expected a length of ${n} but got ${t.length} for value: \`${ze(t,!0)}\``;if(t.length>n)return`${e} tuple value has too many items, expected a length of ${n} but got ${t.length} for value: \`${ze(t,!0)}\``}return je.formatError(Re.notType,r)}};Object.assign(Object.create(null),{mixed:Re,string:ke,number:Ze,date:ur,object:Ct,array:Ot,boolean:dr,tuple:ei});const Ut=r=>r&&r.__isYupSchema__;class It{static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:s,then:n,otherwise:a}=t,o=typeof s=="function"?s:(...l)=>l.every(c=>c===s);return new It(e,(l,c)=>{var d;let u=o(...l)?n:a;return(d=u==null?void 0:u(c))!=null?d:c})}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let s=this.refs.map(a=>a.getValue(t==null?void 0:t.value,t==null?void 0:t.parent,t==null?void 0:t.context)),n=this.fn(s,e,t);if(n===void 0||n===e)return e;if(!Ut(n))throw new TypeError("conditions must return a schema object");return n.resolve(t)}}const St={context:"$",value:"."};class Ke{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===St.context,this.isValue=this.key[0]===St.value,this.isSibling=!this.isContext&&!this.isValue;let s=this.isContext?St.context:this.isValue?St.value:"";this.path=this.key.slice(s.length),this.getter=this.path&&He.getter(this.path,!0),this.map=t.map}getValue(e,t,s){let n=this.isContext?s:this.isValue?e:t;return this.getter&&(n=this.getter(n||{})),this.map&&(n=this.map(n)),n}cast(e,t){return this.getValue(e,t==null?void 0:t.parent,t==null?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Ke.prototype.__isYupRef=!0;const Ae=r=>r==null;function et(r){function e({value:t,path:s="",options:n,originalValue:a,schema:o},l,c){const{name:d,test:u,params:p,message:h,skipAbsent:y}=r;let{parent:x,context:k,abortEarly:S=o.spec.abortEarly,disableStackTrace:w=o.spec.disableStackTrace}=n;function g(Z){return Ke.isRef(Z)?Z.getValue(t,x,k):Z}function T(Z={}){const $=Object.assign({value:t,originalValue:a,label:o.spec.label,path:Z.path||s,spec:o.spec,disableStackTrace:Z.disableStackTrace||w},p,Z.params);for(const J of Object.keys($))$[J]=g($[J]);const H=new je(je.formatError(Z.message||h,$),t,$.path,Z.type||d,$.disableStackTrace);return H.params=$,H}const V=S?l:c;let F={path:s,parent:x,type:d,from:n.from,createError:T,resolve:g,options:n,originalValue:a,schema:o};const U=Z=>{je.isError(Z)?V(Z):Z?c(null):V(T())},G=Z=>{je.isError(Z)?V(Z):l(Z)};if(y&&Ae(t))return U(!0);let D;try{var Q;if(D=u.call(F,t,F),typeof((Q=D)==null?void 0:Q.then)=="function"){if(n.sync)throw new Error(`Validation test of type: "${F.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(D).then(U,G)}}catch(Z){G(Z);return}U(D)}return e.OPTIONS=r,e}function ti(r,e,t,s=t){let n,a,o;return e?(He.forEach(e,(l,c,d)=>{let u=c?l.slice(1,l.length-1):l;r=r.resolve({context:s,parent:n,value:t});let p=r.type==="tuple",h=d?parseInt(u,10):0;if(r.innerType||p){if(p&&!d)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(t&&h>=t.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${l}, in the path: ${e}. because there is no value at that index. `);n=t,t=t&&t[h],r=p?r.spec.types[h]:r.innerType}if(!d){if(!r.fields||!r.fields[u])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${o} which is a type: "${r.type}")`);n=t,t=t&&t[u],r=r.fields[u]}a=u,o=c?"["+l+"]":"."+l}),{schema:r,parent:n,parentPath:a}):{parent:n,parentPath:e,schema:r}}class Lt extends Set{describe(){const e=[];for(const t of this.values())e.push(Ke.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const s of this.values())t.push(e(s));return t}clone(){return new Lt(this.values())}merge(e,t){const s=this.clone();return e.forEach(n=>s.add(n)),t.forEach(n=>s.delete(n)),s}}function rt(r,e=new Map){if(Ut(r)||!r||typeof r!="object")return r;if(e.has(r))return e.get(r);let t;if(r instanceof Date)t=new Date(r.getTime()),e.set(r,t);else if(r instanceof RegExp)t=new RegExp(r),e.set(r,t);else if(Array.isArray(r)){t=new Array(r.length),e.set(r,t);for(let s=0;s<r.length;s++)t[s]=rt(r[s],e)}else if(r instanceof Map){t=new Map,e.set(r,t);for(const[s,n]of r.entries())t.set(s,rt(n,e))}else if(r instanceof Set){t=new Set,e.set(r,t);for(const s of r)t.add(rt(s,e))}else if(r instanceof Object){t={},e.set(r,t);for(const[s,n]of Object.entries(r))t[s]=rt(n,e)}else throw Error(`Unable to clone ${r}`);return t}class Ee{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new Lt,this._blacklist=new Lt,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Re.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(t=>{t.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=rt(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(e.length===0)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let s=e(this);return this._mutate=t,s}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,s=e.clone();const n=Object.assign({},t.spec,s.spec);return s.spec=n,s.internalTests=Object.assign({},t.internalTests,s.internalTests),s._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),s._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),s.tests=t.tests,s.exclusiveTests=t.exclusiveTests,s.withMutation(a=>{e.tests.forEach(o=>{a.test(o.OPTIONS)})}),s.transforms=[...t.transforms,...s.transforms],s}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let s=t.conditions;t=t.clone(),t.conditions=[],t=s.reduce((n,a)=>a.resolve(n,e),t),t=t.resolve(e)}return t}resolveOptions(e){var t,s,n,a;return Object.assign({},e,{from:e.from||[],strict:(t=e.strict)!=null?t:this.spec.strict,abortEarly:(s=e.abortEarly)!=null?s:this.spec.abortEarly,recursive:(n=e.recursive)!=null?n:this.spec.recursive,disableStackTrace:(a=e.disableStackTrace)!=null?a:this.spec.disableStackTrace})}cast(e,t={}){let s=this.resolve(Object.assign({value:e},t)),n=t.assert==="ignore-optionality",a=s._cast(e,t);if(t.assert!==!1&&!s.isType(a)){if(n&&Ae(a))return a;let o=ze(e),l=ze(a);throw new TypeError(`The value of ${t.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
- attempted value: ${o}
29
- `+(l!==o?`result of cast: ${l}`:""))}return a}_cast(e,t){let s=e===void 0?e:this.transforms.reduce((n,a)=>a.call(this,n,e,this),e);return s===void 0&&(s=this.getDefault(t)),s}_validate(e,t={},s,n){let{path:a,originalValue:o=e,strict:l=this.spec.strict}=t,c=e;l||(c=this._cast(c,Object.assign({assert:!1},t)));let d=[];for(let u of Object.values(this.internalTests))u&&d.push(u);this.runTests({path:a,value:c,originalValue:o,options:t,tests:d},s,u=>{if(u.length)return n(u,c);this.runTests({path:a,value:c,originalValue:o,options:t,tests:this.tests},s,n)})}runTests(e,t,s){let n=!1,{tests:a,value:o,originalValue:l,path:c,options:d}=e,u=k=>{n||(n=!0,t(k,o))},p=k=>{n||(n=!0,s(k,o))},h=a.length,y=[];if(!h)return p([]);let x={value:o,originalValue:l,path:c,options:d,schema:this};for(let k=0;k<a.length;k++){const S=a[k];S(x,u,function(g){g&&(Array.isArray(g)?y.push(...g):y.push(g)),--h<=0&&p(y)})}}asNestedTest({key:e,index:t,parent:s,parentPath:n,originalParent:a,options:o}){const l=e??t;if(l==null)throw TypeError("Must include `key` or `index` for nested validations");const c=typeof l=="number";let d=s[l];const u=Object.assign({},o,{strict:!0,parent:s,value:d,originalValue:a[l],key:void 0,[c?"index":"key"]:l,path:c||l.includes(".")?`${n||""}[${c?l:`"${l}"`}]`:(n?`${n}.`:"")+e});return(p,h,y)=>this.resolve(u)._validate(d,u,h,y)}validate(e,t){var s;let n=this.resolve(Object.assign({},t,{value:e})),a=(s=t==null?void 0:t.disableStackTrace)!=null?s:n.spec.disableStackTrace;return new Promise((o,l)=>n._validate(e,t,(c,d)=>{je.isError(c)&&(c.value=d),l(c)},(c,d)=>{c.length?l(new je(c,d,void 0,void 0,a)):o(d)}))}validateSync(e,t){var s;let n=this.resolve(Object.assign({},t,{value:e})),a,o=(s=t==null?void 0:t.disableStackTrace)!=null?s:n.spec.disableStackTrace;return n._validate(e,Object.assign({},t,{sync:!0}),(l,c)=>{throw je.isError(l)&&(l.value=c),l},(l,c)=>{if(l.length)throw new je(l,e,void 0,void 0,o);a=c}),a}isValid(e,t){return this.validate(e,t).then(()=>!0,s=>{if(je.isError(s))return!1;throw s})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(s){if(je.isError(s))return!1;throw s}}_getDefault(e){let t=this.spec.default;return t==null?t:typeof t=="function"?t.call(this,e):rt(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const s=this.clone({nullable:e});return s.internalTests.nullable=et({message:t,name:"nullable",test(n){return n===null?this.schema.spec.nullable:!0}}),s}optionality(e,t){const s=this.clone({optional:e});return s.internalTests.optionality=et({message:t,name:"optionality",test(n){return n===void 0?this.schema.spec.optional:!0}}),s}optional(){return this.optionality(!0)}defined(e=Re.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Re.notNull){return this.nullability(!1,e)}required(e=Re.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(e.length===1?typeof e[0]=="function"?t={test:e[0]}:t=e[0]:e.length===2?t={name:e[0],test:e[1]}:t={name:e[0],message:e[1],test:e[2]},t.message===void 0&&(t.message=Re.default),typeof t.test!="function")throw new TypeError("`test` is a required parameters");let s=this.clone(),n=et(t),a=t.exclusive||t.name&&s.exclusiveTests[t.name]===!0;if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(s.exclusiveTests[t.name]=!!t.exclusive),s.tests=s.tests.filter(o=>!(o.OPTIONS.name===t.name&&(a||o.OPTIONS.test===n.OPTIONS.test))),s.tests.push(n),s}when(e,t){!Array.isArray(e)&&typeof e!="string"&&(t=e,e=".");let s=this.clone(),n=tn(e).map(a=>new Ke(a));return n.forEach(a=>{a.isSibling&&s.deps.push(a.key)}),s.conditions.push(typeof t=="function"?new It(n,t):It.fromOptions(n,t)),s}typeError(e){let t=this.clone();return t.internalTests.typeError=et({message:e,name:"typeError",skipAbsent:!0,test(s){return this.schema._typeCheck(s)?!0:this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=Re.oneOf){let s=this.clone();return e.forEach(n=>{s._whitelist.add(n),s._blacklist.delete(n)}),s.internalTests.whiteList=et({message:t,name:"oneOf",skipAbsent:!0,test(n){let a=this.schema._whitelist,o=a.resolveAll(this.resolve);return o.includes(n)?!0:this.createError({params:{values:Array.from(a).join(", "),resolved:o}})}}),s}notOneOf(e,t=Re.notOneOf){let s=this.clone();return e.forEach(n=>{s._blacklist.add(n),s._whitelist.delete(n)}),s.internalTests.blacklist=et({message:t,name:"notOneOf",test(n){let a=this.schema._blacklist,o=a.resolveAll(this.resolve);return o.includes(n)?this.createError({params:{values:Array.from(a).join(", "),resolved:o}}):!0}}),s}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:s,meta:n,optional:a,nullable:o}=t.spec;return{meta:n,label:s,optional:a,nullable:o,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.map(c=>({name:c.OPTIONS.name,params:c.OPTIONS.params})).filter((c,d,u)=>u.findIndex(p=>p.name===c.name)===d)}}}Ee.prototype.__isYupSchema__=!0;for(const r of["validate","validateSync"])Ee.prototype[`${r}At`]=function(e,t,s={}){const{parent:n,parentPath:a,schema:o}=ti(this,e,t,s.context);return o[r](n&&n[a],Object.assign({},s,{parent:n,path:e}))};for(const r of["equals","is"])Ee.prototype[r]=Ee.prototype.oneOf;for(const r of["not","nope"])Ee.prototype[r]=Ee.prototype.notOneOf;const ri=()=>!0;function fr(r){return new an(r)}class an extends Ee{constructor(e){super(typeof e=="function"?{type:"mixed",check:e}:Object.assign({type:"mixed",check:ri},e))}}fr.prototype=an.prototype;function on(){return new ln}class ln extends Ee{constructor(){super({type:"boolean",check(e){return e instanceof Boolean&&(e=e.valueOf()),typeof e=="boolean"}}),this.withMutation(()=>{this.transform((e,t,s)=>{if(s.spec.coerce&&!s.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e})})}isTrue(e=dr.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test(t){return Ae(t)||t===!0}})}isFalse(e=dr.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"false"},test(t){return Ae(t)||t===!1}})}default(e){return super.default(e)}defined(e){return super.defined(e)}optional(){return super.optional()}required(e){return super.required(e)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(e){return super.nonNullable(e)}strip(e){return super.strip(e)}}on.prototype=ln.prototype;const si=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function ni(r){const e=mr(r);if(!e)return Date.parse?Date.parse(r):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let t=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(t=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(t=0-t)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+t,e.second,e.millisecond)}function mr(r){var e,t;const s=si.exec(r);return s?{year:Ie(s[1]),month:Ie(s[2],1)-1,day:Ie(s[3],1),hour:Ie(s[4]),minute:Ie(s[5]),second:Ie(s[6]),millisecond:s[7]?Ie(s[7].substring(0,3)):0,precision:(e=(t=s[7])==null?void 0:t.length)!=null?e:void 0,z:s[8]||void 0,plusMinus:s[9]||void 0,hourOffset:Ie(s[10]),minuteOffset:Ie(s[11])}:null}function Ie(r,e=0){return Number(r)||e}let ai=/^[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])?)*$/,oi=/^((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,ii=/^(?:[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,li="^\\d{4}-\\d{2}-\\d{2}",ci="\\d{2}:\\d{2}:\\d{2}",ui="(([+-]\\d{2}(:?\\d{2})?)|Z)",di=new RegExp(`${li}T${ci}(\\.\\d+)?${ui}$`),fi=r=>Ae(r)||r===r.trim(),mi={}.toString();function tt(){return new cn}class cn extends Ee{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,t,s)=>{if(!s.spec.coerce||s.isType(e)||Array.isArray(e))return e;const n=e!=null&&e.toString?e.toString():e;return n===mi?e:n})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||Re.required,name:"required",skipAbsent:!0,test:s=>!!s.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(t=>t.OPTIONS.name!=="required"),e))}length(e,t=ke.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(s){return s.length===this.resolve(e)}})}min(e,t=ke.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s.length>=this.resolve(e)}})}max(e,t=ke.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(s){return s.length<=this.resolve(e)}})}matches(e,t){let s=!1,n,a;return t&&(typeof t=="object"?{excludeEmptyString:s=!1,message:n,name:a}=t:n=t),this.test({name:a||"matches",message:n||ke.matches,params:{regex:e},skipAbsent:!0,test:o=>o===""&&s||o.search(e)!==-1})}email(e=ke.email){return this.matches(ai,{name:"email",message:e,excludeEmptyString:!0})}url(e=ke.url){return this.matches(oi,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=ke.uuid){return this.matches(ii,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t="",s,n;return e&&(typeof e=="object"?{message:t="",allowOffset:s=!1,precision:n=void 0}=e:t=e),this.matches(di,{name:"datetime",message:t||ke.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:t||ke.datetime_offset,params:{allowOffset:s},skipAbsent:!0,test:a=>{if(!a||s)return!0;const o=mr(a);return o?!!o.z:!1}}).test({name:"datetime_precision",message:t||ke.datetime_precision,params:{precision:n},skipAbsent:!0,test:a=>{if(!a||n==null)return!0;const o=mr(a);return o?o.precision===n:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=ke.trim){return this.transform(t=>t!=null?t.trim():t).test({message:e,name:"trim",test:fi})}lowercase(e=ke.lowercase){return this.transform(t=>Ae(t)?t:t.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Ae(t)||t===t.toLowerCase()})}uppercase(e=ke.uppercase){return this.transform(t=>Ae(t)?t:t.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>Ae(t)||t===t.toUpperCase()})}}tt.prototype=cn.prototype;let hi=r=>r!=+r;function un(){return new dn}class dn extends Ee{constructor(){super({type:"number",check(e){return e instanceof Number&&(e=e.valueOf()),typeof e=="number"&&!hi(e)}}),this.withMutation(()=>{this.transform((e,t,s)=>{if(!s.spec.coerce)return e;let n=e;if(typeof n=="string"){if(n=n.replace(/\s/g,""),n==="")return NaN;n=+n}return s.isType(n)||n===null?n:parseFloat(n)})})}min(e,t=Ze.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s>=this.resolve(e)}})}max(e,t=Ze.max){return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(s){return s<=this.resolve(e)}})}lessThan(e,t=Ze.lessThan){return this.test({message:t,name:"max",exclusive:!0,params:{less:e},skipAbsent:!0,test(s){return s<this.resolve(e)}})}moreThan(e,t=Ze.moreThan){return this.test({message:t,name:"min",exclusive:!0,params:{more:e},skipAbsent:!0,test(s){return s>this.resolve(e)}})}positive(e=Ze.positive){return this.moreThan(0,e)}negative(e=Ze.negative){return this.lessThan(0,e)}integer(e=Ze.integer){return this.test({name:"integer",message:e,skipAbsent:!0,test:t=>Number.isInteger(t)})}truncate(){return this.transform(e=>Ae(e)?e:e|0)}round(e){var t;let s=["ceil","floor","round","trunc"];if(e=((t=e)==null?void 0:t.toLowerCase())||"round",e==="trunc")return this.truncate();if(s.indexOf(e.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+s.join(", "));return this.transform(n=>Ae(n)?n:Math[e](n))}}un.prototype=dn.prototype;let fn=new Date(""),pi=r=>Object.prototype.toString.call(r)==="[object Date]";function Sr(){return new bt}class bt extends Ee{constructor(){super({type:"date",check(e){return pi(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,t,s)=>!s.spec.coerce||s.isType(e)||e===null?e:(e=ni(e),isNaN(e)?bt.INVALID_DATE:new Date(e)))})}prepareParam(e,t){let s;if(Ke.isRef(e))s=e;else{let n=this.cast(e);if(!this._typeCheck(n))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);s=n}return s}min(e,t=ur.min){let s=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(n){return n>=this.resolve(s)}})}max(e,t=ur.max){let s=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(n){return n<=this.resolve(s)}})}}bt.INVALID_DATE=fn;Sr.prototype=bt.prototype;Sr.INVALID_DATE=fn;function xi(r,e=[]){let t=[],s=new Set,n=new Set(e.map(([o,l])=>`${o}-${l}`));function a(o,l){let c=He.split(o)[0];s.add(c),n.has(`${l}-${c}`)||t.push([l,c])}for(const o of Object.keys(r)){let l=r[o];s.add(o),Ke.isRef(l)&&l.isSibling?a(l.path,o):Ut(l)&&"deps"in l&&l.deps.forEach(c=>a(c,o))}return qo.array(Array.from(s),t).reverse()}function ls(r,e){let t=1/0;return r.some((s,n)=>{var a;if((a=e.path)!=null&&a.includes(s))return t=n,!0}),t}function mn(r){return(e,t)=>ls(r,e)-ls(r,t)}const hn=(r,e,t)=>{if(typeof r!="string")return r;let s=r;try{s=JSON.parse(r)}catch{}return t.isType(s)?s:r};function Rt(r){if("fields"in r){const e={};for(const[t,s]of Object.entries(r.fields))e[t]=Rt(s);return r.setFields(e)}if(r.type==="array"){const e=r.optional();return e.innerType&&(e.innerType=Rt(e.innerType)),e}return r.type==="tuple"?r.optional().clone({types:r.spec.types.map(Rt)}):"optional"in r?r.optional():r}const gi=(r,e)=>{const t=[...He.normalizePath(e)];if(t.length===1)return t[0]in r;let s=t.pop(),n=He.getter(He.join(t),!0)(r);return!!(n&&s in n)};let cs=r=>Object.prototype.toString.call(r)==="[object Object]";function us(r,e){let t=Object.keys(r.fields);return Object.keys(e).filter(s=>t.indexOf(s)===-1)}const bi=mn([]);function pn(r){return new xn(r)}class xn extends Ee{constructor(e){super({type:"object",check(t){return cs(t)||typeof t=="function"}}),this.fields=Object.create(null),this._sortErrors=bi,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){var s;let n=super._cast(e,t);if(n===void 0)return this.getDefault(t);if(!this._typeCheck(n))return n;let a=this.fields,o=(s=t.stripUnknown)!=null?s:this.spec.noUnknown,l=[].concat(this._nodes,Object.keys(n).filter(p=>!this._nodes.includes(p))),c={},d=Object.assign({},t,{parent:c,__validating:t.__validating||!1}),u=!1;for(const p of l){let h=a[p],y=p in n;if(h){let x,k=n[p];d.path=(t.path?`${t.path}.`:"")+p,h=h.resolve({value:k,context:t.context,parent:c});let S=h instanceof Ee?h.spec:void 0,w=S==null?void 0:S.strict;if(S!=null&&S.strip){u=u||p in n;continue}x=!t.__validating||!w?h.cast(n[p],d):n[p],x!==void 0&&(c[p]=x)}else y&&!o&&(c[p]=n[p]);(y!==p in c||c[p]!==n[p])&&(u=!0)}return u?c:n}_validate(e,t={},s,n){let{from:a=[],originalValue:o=e,recursive:l=this.spec.recursive}=t;t.from=[{schema:this,value:o},...a],t.__validating=!0,t.originalValue=o,super._validate(e,t,s,(c,d)=>{if(!l||!cs(d)){n(c,d);return}o=o||d;let u=[];for(let p of this._nodes){let h=this.fields[p];!h||Ke.isRef(h)||u.push(h.asNestedTest({options:t,key:p,parent:d,parentPath:t.path,originalParent:o}))}this.runTests({tests:u,value:d,originalValue:o,options:t},s,p=>{n(p.sort(this._sortErrors).concat(c),d)})})}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),s=t.fields;for(let[n,a]of Object.entries(this.fields)){const o=s[n];s[n]=o===void 0?a:o}return t.withMutation(n=>n.setFields(s,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach(s=>{var n;const a=this.fields[s];let o=e;(n=o)!=null&&n.value&&(o=Object.assign({},o,{parent:o.value,value:o.value[s]})),t[s]=a&&"getDefault"in a?a.getDefault(o):void 0}),t}setFields(e,t){let s=this.clone();return s.fields=e,s._nodes=xi(e,t),s._sortErrors=mn(Object.keys(e)),t&&(s._excludedEdges=t),s}shape(e,t=[]){return this.clone().withMutation(s=>{let n=s._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),n=[...s._excludedEdges,...t]),s.setFields(Object.assign(s.fields,e),n)})}partial(){const e={};for(const[t,s]of Object.entries(this.fields))e[t]="optional"in s&&s.optional instanceof Function?s.optional():s;return this.setFields(e)}deepPartial(){return Rt(this)}pick(e){const t={};for(const s of e)this.fields[s]&&(t[s]=this.fields[s]);return this.setFields(t,this._excludedEdges.filter(([s,n])=>e.includes(s)&&e.includes(n)))}omit(e){const t=[];for(const s of Object.keys(this.fields))e.includes(s)||t.push(s);return this.pick(t)}from(e,t,s){let n=He.getter(e,!0);return this.transform(a=>{if(!a)return a;let o=a;return gi(a,e)&&(o=Object.assign({},a),s||delete o[e],o[t]=n(a)),o})}json(){return this.transform(hn)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Ct.exact,test(t){if(t==null)return!0;const s=us(this.schema,t);return s.length===0||this.createError({params:{properties:s.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=Ct.noUnknown){typeof e!="boolean"&&(t=e,e=!0);let s=this.test({name:"noUnknown",exclusive:!0,message:t,test(n){if(n==null)return!0;const a=us(this.schema,n);return!e||a.length===0||this.createError({params:{unknown:a.join(", ")}})}});return s.spec.noUnknown=e,s}unknown(e=!0,t=Ct.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;const s={};for(const n of Object.keys(t))s[e(n)]=t[n];return s})}camelCase(){return this.transformKeys(er.camelCase)}snakeCase(){return this.transformKeys(er.snakeCase)}constantCase(){return this.transformKeys(e=>er.snakeCase(e).toUpperCase())}describe(e){const t=(e?this.resolve(e):this).clone(),s=super.describe(e);s.fields={};for(const[a,o]of Object.entries(t.fields)){var n;let l=e;(n=l)!=null&&n.value&&(l=Object.assign({},l,{parent:l.value,value:l.value[a]})),s.fields[a]=o.describe(l)}return s}}pn.prototype=xn.prototype;function hr(r){return new gn(r)}class gn extends Ee{constructor(e){super({type:"array",spec:{types:e},check(t){return Array.isArray(t)}}),this.innerType=void 0,this.innerType=e}_cast(e,t){const s=super._cast(e,t);if(!this._typeCheck(s)||!this.innerType)return s;let n=!1;const a=s.map((o,l)=>{const c=this.innerType.cast(o,Object.assign({},t,{path:`${t.path||""}[${l}]`}));return c!==o&&(n=!0),c});return n?a:s}_validate(e,t={},s,n){var a;let o=this.innerType,l=(a=t.recursive)!=null?a:this.spec.recursive;t.originalValue!=null&&t.originalValue,super._validate(e,t,s,(c,d)=>{var u;if(!l||!o||!this._typeCheck(d)){n(c,d);return}let p=new Array(d.length);for(let y=0;y<d.length;y++){var h;p[y]=o.asNestedTest({options:t,index:y,parent:d,parentPath:t.path,originalParent:(h=t.originalValue)!=null?h:e})}this.runTests({value:d,tests:p,originalValue:(u=t.originalValue)!=null?u:e,options:t},s,y=>n(y.concat(c),d))})}clone(e){const t=super.clone(e);return t.innerType=this.innerType,t}json(){return this.transform(hn)}concat(e){let t=super.concat(e);return t.innerType=this.innerType,e.innerType&&(t.innerType=t.innerType?t.innerType.concat(e.innerType):e.innerType),t}of(e){let t=this.clone();if(!Ut(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+ze(e));return t.innerType=e,t.spec=Object.assign({},t.spec,{types:e}),t}length(e,t=Ot.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(s){return s.length===this.resolve(e)}})}min(e,t){return t=t||Ot.min,this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(s){return s.length>=this.resolve(e)}})}max(e,t){return t=t||Ot.max,this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(s){return s.length<=this.resolve(e)}})}ensure(){return this.default(()=>[]).transform((e,t)=>this._typeCheck(e)?e:t==null?[]:[].concat(t))}compact(e){let t=e?(s,n,a)=>!e(s,n,a):s=>!!s;return this.transform(s=>s!=null?s.filter(t):s)}describe(e){const t=(e?this.resolve(e):this).clone(),s=super.describe(e);if(t.innerType){var n;let a=e;(n=a)!=null&&n.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[0]})),s.innerType=t.innerType.describe(a)}return s}}hr.prototype=gn.prototype;function yi(r){return r.validation??{}}function vi(r){return!!r.multiple}function tr(r){const e=r.maxFiles;return typeof e=="number"?e:void 0}function Le(r,e){return e.required?r.required(e.requiredMessage||"Requerido"):r}function _t(r,e){var s,n,a;let t=r;return((s=e.minLength)==null?void 0:s.value)!=null&&(t=t.min(e.minLength.value,e.minLength.message||`Mín. ${e.minLength.value} caracteres`)),((n=e.maxLength)==null?void 0:n.value)!=null&&(t=t.max(e.maxLength.value,e.maxLength.message||`Máx. ${e.maxLength.value} caracteres`)),((a=e.pattern)==null?void 0:a.value)instanceof RegExp&&(t=t.matches(e.pattern.value,e.pattern.message||"Formato inválido")),t}function wi(r){var t;const e=yi(r);switch(r.type){case"text":case"password":{let s=tt().trim();return s=_t(s,e),Le(s,e)}case"email":{let s=tt().trim().email(e.emailMessage||"Email inválido");return s=_t(s,e),Le(s,e)}case"number":{let s=un().transform((n,a)=>a===""||a===null?void 0:n).typeError(e.typeError||"Debe ser un número");return((t=e.pattern)==null?void 0:t.value)instanceof RegExp&&(s=s.test("pattern-number",e.pattern.message||"Formato inválido",n=>n==null||e.pattern.value.test(String(n)))),Le(s,e)}case"select":{if(vi(r)){const n=hr().of(tt());return Le(n,e)}let s=tt().trim();return s=_t(s,e),Le(s,e)}case"checkbox":{let s=on();return e.required&&(s=s.oneOf([!0],e.requiredMessage||"Debes marcar esta casilla")),s}case"textarea":{let s=tt().trim();return s=_t(s,e),Le(s,e)}case"date":{const s=Sr().typeError(e.typeError||"Fecha inválida").transform((n,a)=>a?new Date(a):void 0);return Le(s,e)}case"file":{const s=hr().of(fr()).test("max-files",tr(r)?`Máx. ${tr(r)} fichero(s)`:"Número de ficheros inválido",n=>{const a=tr(r);return!Array.isArray(n)||!a||n.length<=a});return Le(s,e)}default:{const s=fr();return Le(s,e)}}}function ki(r){const e={};for(const t of r.fields){const s=t;s.name&&(e[s.name]=wi(s))}return pn(e)}function bn({options:r,value:e,onChange:t,children:s}){const n=v.useRef(null),[a,o]=v.useState({left:0,width:0});return v.useLayoutEffect(()=>{const l=n.current;if(!l)return;const c=()=>{const d=r.findIndex(S=>S.value===e);if(d<0)return;const u=l.children[d],p=u.querySelector("span"),h=(p==null?void 0:p.offsetWidth)??u.offsetWidth,y=u.offsetWidth,k=u.offsetLeft+(y-h)/2;o({left:k,width:h})};return c(),window.addEventListener("resize",c),l.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),l.removeEventListener("scroll",c)}},[e,r]),i.jsxs("div",{children:[i.jsxs("div",{className:"relative",children:[i.jsx("ul",{ref:n,role:"tablist",className:"flex justify-center overflow-x-auto border-b border-[var(--color-ds-border-default-50)]",children:r.map(l=>{const c=l.value===e;return i.jsx("li",{role:"tab","aria-selected":c,onClick:()=>t(l.value),className:L("cursor-pointer whitespace-nowrap px-4 py-2 transition-colors duration-150 ease-in-out",c?"text-[var(--color-ds-background-accent)]":"text-[var(--color-ds-text-primary)]"),children:i.jsx("span",{className:"inline-block",children:l.label})},l.value)})}),i.jsx("span",{className:"absolute bottom-0 h-1 bg-[var(--color-ds-background-accent)] transition-all duration-200 ease-in-out rounded-t-full",style:{left:a.left,width:a.width}})]}),i.jsx("div",{className:"mt-4 pb-4 border-b border-[var(--color-ds-border-default-50)]",children:s[e]})]})}const Ft={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},ds={sm:"h-6",md:"h-10",lg:"h-12"},fs={sm:"px-2",md:"px-2.5",lg:"px-3"},ms={sm:"1.5rem",md:"2.5rem",lg:"3rem"};function hs({id:r,size:e,disabled:t,error:s,reserveErrorSpace:n,className:a,suffixButton:o,children:l}){return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"relative flex items-center w-full",children:[l,o&&i.jsx("div",{className:"flex items-center h-full pr-2",children:o})]}),n?i.jsx("div",{className:"min-h-[18px] w-full",children:s!=null&&s.message?i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:s.message}):i.jsx("span",{"aria-hidden":"true",children:" "})}):s!=null&&s.message?i.jsx("div",{className:"pt-1",children:i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:s.message})}):null]})}function pt(r){const{control:e,name:t,rules:s,defaultValue:n,options:a=[],loadOptions:o,reloadDeps:l=[],value:c,onChange:d,size:u="sm",width:p="100%",label:h,labelHidden:y=!1,hasError:x=!1,errorMessage:k="",reserveErrorSpace:S,disableErrorPlaceholder:w,disabled:g=!1,className:T,suffixButton:V,loading:F=!1,coerceFirstValid:U=!0}=r,G=v.useId(),_=t||G,[D,Q]=v.useState(a),[Z,$]=v.useState(!!o);v.useEffect(()=>{o&&($(!0),o().then(q=>Q(q)).finally(()=>$(!1)))},[o,...l]);const H=q=>q.find(X=>X.value!==""&&X.value!==void 0)??q[0],J=typeof S=="boolean"?S:!!e;if(e&&t){const{field:q,fieldState:X}=Ps({name:t,control:e,rules:s,defaultValue:n});return v.useEffect(()=>{if(!Z&&D.length>0&&U){const C=q.value,m=D.some(W=>String(W.value)===String(C));(C===void 0||!m)&&q.onChange(H(D).value)}},[D,Z,q,U]),i.jsxs("div",{className:L("flex flex-col",T),style:{width:p,maxWidth:"100%"},children:[h&&i.jsx("label",{htmlFor:_,className:L("pb-2 text-[var(--color-ds-text-primary)]",Ft[u],y&&"sr-only"),children:h}),F||Z?i.jsx(Xe,{width:"100%",height:ms[u],variant:"rect",className:"rounded-lg"}):i.jsx(hs,{id:_,size:u,disabled:g,error:X.error,reserveErrorSpace:typeof w=="boolean"?!w:J,className:T,suffixButton:V,children:i.jsx("select",{id:_,value:q.value,onChange:C=>q.onChange(C.target.value),disabled:g,className:L("box-border w-full rounded-lg border bg-[var(--color-ds-background-page)] outline-none transition font-[var(--font-primary)]",Ft[u],ds[u],fs[u],X.error?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",g?"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)]",T),children:D.map(C=>i.jsx("option",{value:C.value,className:"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",children:C.label},C.value))})})]})}return v.useEffect(()=>{if(!e&&D.length>0&&U){const q=D.some(C=>String(C.value)===String(c));(c===void 0||c===""||!q)&&d&&d(H(D).value)}},[D,c,d,e,U]),i.jsxs("div",{className:L("flex flex-col",T),style:{width:p,maxWidth:"100%"},children:[h&&i.jsx("label",{htmlFor:_,className:L("pb-2 text-[var(--color-ds-text-primary)]",Ft[u],y&&"sr-only"),children:h}),F||Z?i.jsx(Xe,{width:"100%",height:ms[u],variant:"rect",className:"rounded-lg"}):i.jsx(hs,{id:_,size:u,disabled:g,error:x?{message:k}:void 0,reserveErrorSpace:typeof w=="boolean"?!w:!!(S??!1),className:T,suffixButton:V,children:i.jsx("select",{id:_,value:c,onChange:q=>d==null?void 0:d(q.target.value),disabled:g,className:L("box-border w-full rounded-lg border bg-[var(--color-ds-background-page)] outline-none transition font-[var(--font-primary)]",Ft[u],ds[u],fs[u],x?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",g?"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)]",T),children:D.map(q=>i.jsx("option",{value:q.value,className:"bg-[var(--color-ds-background-page)] text-[var(--color-ds-text-primary)]",children:q.label},q.value))})})]})}const ps={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"};function yn({groupLabel:r,inputs:e=[],separator:t=i.jsx("span",{className:"px-1 select-none",children:"/"}),useSeparator:s=!0,className:n,showVisibleLabel:a=!1,size:o="sm",width:l}){const c=e.length;return i.jsxs("div",{className:L("flex flex-col",n),style:l?{width:l}:void 0,children:[i.jsx("label",{className:L("sr-only pb-2",ps[o]),children:r}),a&&i.jsx("label",{className:L("pb-2",ps[o]),children:r}),i.jsx("div",{className:"flex items-center flex-nowrap",children:e.map((d,u)=>{const{width:p,className:h,options:y,loadOptions:x,...k}=d,S=Array.isArray(y)||typeof x=="function";let w="rounded-lg";!s&&c>1&&(u===0?w="rounded-l-lg rounded-r-none":u===c-1?w="rounded-r-lg rounded-l-none !rounded-l-none":w="rounded-none !rounded-l-none !rounded-r-none");const g=[],T=typeof p=="string"&&p.split(/\s+/).some(G=>G.startsWith("w-")||G.includes(":w-")),V=L("inline-flex items-center flex-shrink-0",typeof p=="string"&&T?p:void 0,!s&&c>1&&u>0?"-ml-px focus-within:z-10 relative":void 0),F=typeof p=="string"&&!T?{width:p}:void 0,U=L(h,w,g);return i.jsxs("div",{className:V,style:F,children:[S?i.jsx(pt,{...k,size:o,className:U,options:y,loadOptions:x}):i.jsx(Bt,{...k,size:o,className:U}),s&&u<c-1&&t]},u)})})]})}const xs={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},ji={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function vn({groupLabel:r,options:e,control:t,name:s,rules:n,defaultValue:a,multiple:o=!0,size:l="sm",vertical:c=!0,className:d,showVisibleLabel:u=!0}){return i.jsx(Ce,{name:s,control:t,rules:n,defaultValue:a,render:({field:p,fieldState:h})=>{const{value:y,onChange:x}=p;h.error;const k=w=>o?Array.isArray(y)&&y.includes(w):y===w,S=w=>{if(o){const g=Array.isArray(y)?[...y]:[],T=g.indexOf(w);T>=0?g.splice(T,1):g.push(w),x(g)}else x(w)};return i.jsxs("div",{className:L("w-full",d),children:[i.jsx("label",{className:L("sr-only pb-2 text-[var(--color-ds-text-primary)]",xs[l]),children:r}),u&&i.jsx("label",{className:L("block pb-2 text-[var(--color-ds-text-primary)]",xs[l]),children:r}),i.jsx("div",{className:L(c?"flex flex-col gap-2":"flex flex-wrap gap-4"),children:e.map(w=>i.jsxs("label",{className:"inline-flex items-center space-x-2 cursor-pointer select-none",children:[i.jsx("input",{type:o?"checkbox":"radio",name:s,value:w.value,checked:k(w.value),onChange:()=>S(w.value),className:L(ji[l],"text-[var(--color-ds-button-primary-bg)]","border-[var(--color-ds-border-default)]")}),i.jsx("span",{className:"text-[var(--color-ds-text-primary)] text-ds-md",children:w.label})]},w.value))})]})}})}function Ei(r){function e(o){var l,c;for(const d of Object.keys(o)){if((l=o[d])!=null&&l.types||(c=o[d])!=null&&c.message)return d;if(typeof o[d]=="object"){const u=e(o[d]);if(u)return`${d}.${u}`}}return null}const t=e(r);if(!t)return;const s=`[name="${t}"]`,n=`[name^="${t}["], [name^="${t}."]`,a=document.querySelector(s)??document.querySelector(n);a&&(a.scrollIntoView({behavior:"smooth",block:"center"}),a.focus({preventScroll:!0}))}const Ni={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"},wn=({id:r,message:e,variant:t="info",duration:s=5e3,onClose:n})=>(v.useEffect(()=>{const a=setTimeout(()=>n(r),s);return()=>clearTimeout(a)},[r,s,n]),i.jsxs("div",{className:L("w-80 max-w-full border-l-4 rounded shadow-md p-4 mb-2 flex justify-between items-start",Ni[t]),role:"alert","aria-live":"assertive",children:[i.jsx("span",{className:"flex-1",children:e}),i.jsx("button",{onClick:()=>n(r),className:"ml-4 text-xl font-bold leading-none focus:outline-none",children:"×"})]}));let Tt;const Si=new Uint8Array(16);function _i(){if(!Tt&&(Tt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Tt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Tt(Si)}const be=[];for(let r=0;r<256;++r)be.push((r+256).toString(16).slice(1));function Fi(r,e=0){return be[r[e+0]]+be[r[e+1]]+be[r[e+2]]+be[r[e+3]]+"-"+be[r[e+4]]+be[r[e+5]]+"-"+be[r[e+6]]+be[r[e+7]]+"-"+be[r[e+8]]+be[r[e+9]]+"-"+be[r[e+10]]+be[r[e+11]]+be[r[e+12]]+be[r[e+13]]+be[r[e+14]]+be[r[e+15]]}const Ti=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),gs={randomUUID:Ti};function Ai(r,e,t){if(gs.randomUUID&&!r)return gs.randomUUID();r=r||{};const s=r.random||(r.rng||_i)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Fi(s)}const kn=v.createContext(null),jn=()=>{const r=v.useContext(kn);if(!r)throw new Error("useToast debe usarse dentro de <ToastProvider>");return r},Ci=({children:r})=>{const[e,t]=v.useState([]),s=(a,o="info",l=5e3)=>{const c=Ai();t(d=>[...d,{id:c,message:a,variant:o,duration:l}])},n=a=>{t(o=>o.filter(l=>l.id!==a))};return i.jsxs(kn.Provider,{value:{show:s},children:[r,i.jsx("div",{className:"fixed top-4 right-4 z-50 flex flex-col items-end",children:e.map(a=>i.jsx(wn,{id:a.id,message:a.message,variant:a.variant,duration:a.duration,onClose:n},a.id))})]})},Oi=r=>r.type==="inputGroup",Ri=r=>r.type==="button",Mi=r=>!Oi(r)&&!Ri(r);function Vi(r){const e=Array.isArray(r)?r:[];return v.useMemo(()=>{const t={};for(const s of e)Mi(s)&&s.name&&(t[s.name]=s);return t},[e])}function $i(r=[],e=[]){if(r===e)return!0;if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++){const s=r[t],n=e[t];if(s.value!==n.value||s.label!==n.label)return!1}return!0}function Di(r){const[e,t]=v.useState({}),[s,n]=v.useState(0),a=v.useMemo(()=>r.filter(c=>(c==null?void 0:c.type)==="select"&&(c==null?void 0:c.name)&&!Array.isArray(c==null?void 0:c.options)&&typeof(c==null?void 0:c.loadOptions)=="function").map(c=>({name:c.name,load:c.loadOptions})),[r]),o=v.useMemo(()=>a.map(c=>c.name).sort().join("|"),[a]),l=v.useRef("");return v.useEffect(()=>{if(o===l.current)return;l.current=o;let c=!1;return(async()=>{a.length&&(n(u=>u+a.length),await Promise.all(a.map(async({name:u,load:p})=>{try{const h=await p();if(c)return;t(y=>{const x=y[u]??[];return $i(x,h)?y:{...y,[u]:h}})}catch{}finally{c||n(h=>Math.max(0,h-1))}})))})(),()=>{c=!0}},[o,a]),{optionsMap:e,loadingCount:s}}const Ii=r=>r.type==="inputGroup",Li=r=>r.type==="button",Pi=r=>!Ii(r)&&!Li(r);function zi(r){return typeof r=="object"&&r!==null}const Bi=r=>{const e=r.disabledWhen;if(!zi(e))return!1;const t="watchField"in e,s="rule"in e;return t&&!s};function Ui(r,e){const t=Array.isArray(r)?r:[],s=v.useMemo(()=>t.filter(Pi).filter(Bi),[t]),n=v.useMemo(()=>s.map(c=>c.disabledWhen.watchField),[s]),a=wr({control:e,...n.length>0?{name:n}:{}}),o=Array.isArray(a)?a:[],l={};return s.forEach((c,d)=>{const u=o[d];l[c.name??`__unnamed_${d}`]=u===c.disabledWhen.watchValue}),l}const bs={sm:"text-ds-sm",md:"text-ds-md",lg:"text-ds-lg"},Zi={sm:"px-2 py-1",md:"px-3 py-2",lg:"px-4 py-3"};function _r({control:r,name:e,rules:t,defaultValue:s,size:n="sm",width:a="100%",label:o,labelHidden:l=!1,hasError:c=!1,errorMessage:d="",maxLength:u,showCounter:p=!1,className:h,suffixButton:y,...x}){const k=v.useId(),S=e||k,[w,g]=v.useState(s||"");if(r&&e)return i.jsx(Ce,{name:e,control:r,rules:t,defaultValue:s||"",render:({field:V,fieldState:F})=>{var U;return i.jsx(_r,{...x,size:n,width:a,label:o,labelHidden:l,hasError:!!F.error,errorMessage:((U=F.error)==null?void 0:U.message)||"",maxLength:u,showCounter:p,className:h,suffixButton:y,value:V.value,onChange:V.onChange})}});v.useEffect(()=>{g(s||"")},[s]);const T=V=>{var F;u!==void 0&&V.target.value.length>u||(g(V.target.value),(F=x.onChange)==null||F.call(x,V))};return i.jsxs("div",{className:L("flex flex-col",h),style:{width:a},children:[o&&i.jsx("label",{htmlFor:S,className:L("pb-2 text-[var(--color-ds-text-primary)]",bs[n],l&&"sr-only"),children:o}),i.jsxs("div",{className:"flex items-stretch gap-2",children:[i.jsx("textarea",{id:S,className:L("box-border bg-[var(--color-ds-background-page)] w-full resize vertical rounded-lg border outline-none transition font-[var(--font-primary)]",bs[n],Zi[n],c?"border-[var(--color-ds-border-error)]":"border-[var(--color-ds-border-default)]",x.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:w,onChange:T,maxLength:u,...x}),y?i.jsx("div",{className:"shrink-0",children:y}):null]}),i.jsxs("div",{className:"flex justify-between pt-1 min-h-[18px]",children:[c&&d?i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:d}):i.jsx("span",{"aria-hidden":"true",children:" "}),p&&u!==void 0&&i.jsxs("span",{className:"text-xs text-[var(--color-ds-text-secondary)]",children:[w.length,"/",u]})]})]})}const Wi={sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"};function En({control:r=null,name:e,rules:t,defaultValue:s=!1,label:n,labelHidden:a=!1,disabled:o=!1,size:l="sm",className:c,hasError:d=!1,errorMessage:u="",checked:p,onChange:h}){const y=L(Wi[l],"text-[var(--color-ds-button-primary-bg)]","border-[var(--color-ds-border-default)]",o&&"opacity-50 cursor-not-allowed"),x=L("text-[var(--color-ds-text-primary)] text-ds-md",o&&"text-[var(--color-ds-text-secondary)]",a&&"sr-only");return r?i.jsx("div",{className:L("flex flex-col",c),children:i.jsx(Ce,{name:e||"",control:r,rules:t,defaultValue:s,render:({field:k,fieldState:S})=>{const w=S.error;return i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"flex items-center space-x-2",children:[i.jsx("input",{id:e,type:"checkbox",className:y,checked:!!k.value,onChange:g=>k.onChange(g.target.checked),disabled:o}),n&&i.jsx("span",{className:x,children:n})]}),(d||w)&&((w==null?void 0:w.message)||u)&&i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:(w==null?void 0:w.message)||u})]})}})}):i.jsxs("div",{className:L("flex flex-col",c),children:[i.jsxs("label",{className:"flex items-center space-x-2",children:[i.jsx("input",{id:e,type:"checkbox",className:y,checked:!!p,onChange:k=>h==null?void 0:h(k.target.checked),disabled:o}),n&&i.jsx("span",{className:x,children:n})]}),d&&!!u&&i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:u})]})}function Nn({name:r,control:e,searchFn:t,resolveByValue:s,label:n,size:a="sm",width:o="100%",disabled:l=!1,searchMode:c="button",minChars:d=3,debounceMs:u=600}){const p=gt(),{watch:h,getValues:y,setValue:x}=p,k=wr({control:e,name:r}),[S,w]=v.useState([]),[g,T]=v.useState(!1),[V,F]=v.useState(!1),[U,G]=v.useState(""),_=v.useRef(null),D=v.useRef(null),Q=v.useRef(!1),Z=v.useRef(!1),$=v.useRef(!0),H=v.useMemo(()=>{const m=new Map;for(const W of S)m.set(String(W.value).trim(),W.label??"");return m},[S]),J=async m=>{const W=(m??"").trim();if(!W){w([]),F(!1);return}T(!0);try{const E=await t(W,{watch:h,getValues:y});w(E??[]),F(!0)}finally{T(!1)}};v.useEffect(()=>{function m(W){_.current&&!_.current.contains(W.target)&&F(!1)}if(V)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[V]),v.useEffect(()=>{if(Q.current)return;const W=(k?String(k):"").trim();if(!W){G(""),F(!1);return}const E=H.get(W);if(E){G(E),F(!1),$.current=!0;return}let j=!1;return(async()=>{if(s)try{const O=await s(W,{watch:h,getValues:y});j||(G((O==null?void 0:O.label)??W),F(!1),$.current=!0)}catch{j||(G(W),F(!1),$.current=!0)}else G(W),F(!1),$.current=!0})(),()=>{j=!0}},[k,H,s,h,y]),v.useEffect(()=>{if(c!=="debounced"||l)return;if($.current){$.current=!1;return}if(!Z.current)return;D.current&&(window.clearTimeout(D.current),D.current=null);const m=(U||"").trim();return m.length>=d?D.current=window.setTimeout(()=>{J(m)},u):(w([]),F(!1)),()=>{D.current&&(window.clearTimeout(D.current),D.current=null)}},[U,c,d,u,l]);const q=a==="sm"?"text-ds-sm":a==="md"?"text-ds-md":"text-ds-lg",X=a==="sm"?"h-6":a==="md"?"h-10":"h-12",C=m=>{if(l)return;const W=(U||"").trim();m.key==="Enter"&&(m.preventDefault(),c==="debounced"?W.length>=d&&J(W):J(W)),m.key==="Escape"&&F(!1)};return i.jsx(Ce,{name:r,control:e,render:({field:m,fieldState:W})=>{var E;return i.jsxs("div",{ref:_,className:"relative flex flex-col",style:{width:o},children:[n&&i.jsx("label",{className:`pb-2 text-[var(--color-ds-text-primary)] ${q}`,children:n}),i.jsx(Bt,{className:c==="button"?"rounded-r-none":void 0,type:"text",size:a,width:"100%",value:U,onChange:j=>{const O=j.target.value;Q.current=!0,Z.current=!0,G(O),(k?String(k):"").trim()&&x(r,"",{shouldDirty:!0})},onKeyDown:C,onBlur:()=>{Q.current=!1},disabled:l,hasError:W.invalid,errorMessage:(E=W.error)==null?void 0:E.message,onFocus:()=>{if(Q.current=!0,c==="button"&&Z.current){const j=(U||"").trim();j&&J(j)}},suffixButton:c==="button"?i.jsx(Pe,{type:"button",className:"!rounded-l-none",size:a,variant:"primary",onClick:()=>J((U||"").trim()),disabled:l,children:"Buscar"}):void 0}),g&&i.jsx("div",{className:"absolute top-14 left-0 right-0 z-10",children:i.jsx(Xe,{width:"100%",height:a==="sm"?"1.5rem":a==="md"?"2.5rem":"3rem",variant:"rect",className:"rounded-lg"})}),V&&!g&&S.length>0&&i.jsx("ul",{className:`
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=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
- shadow-lg ${q} max-h-48 overflow-auto z-10
34
- `,children:S.map(j=>i.jsx("li",{className:`px-2 ${X} flex items-center cursor-pointer
33
+ shadow-lg ${E} max-h-48 overflow-auto z-10
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 O=String(j.value).trim();x(r,O,{shouldDirty:!0,shouldValidate:!0}),G(j.label??O),Q.current=!1,Z.current=!1,F(!1)},children:j.label},String(j.value)))})]})}})}const ft=(r,e)=>r[e],ys=r=>r instanceof Date?r.getTime():r;function qi(r,e,t){const s=ys(r),n=ys(e);return typeof s=="number"&&typeof n=="number"||typeof s=="string"&&typeof n=="string"?t==="gt"?s>n:t==="gte"?s>=n:t==="lt"?s<n:s<=n:!1}function Pt(r,e){if(!r)return!1;switch(r.op){case"eq":return ft(e,r.field)===r.value;case"neq":return ft(e,r.field)!==r.value;case"in":return r.values.includes(ft(e,r.field));case"notIn":return!r.values.includes(ft(e,r.field));case"gt":case"gte":case"lt":case"lte":return qi(ft(e,r.field),r.value,r.op);case"and":return r.rules.every(t=>Pt(t,e));case"or":return r.rules.some(t=>Pt(t,e));default:return!1}}const Gi=r=>r.type!=="inputGroup"&&r.type!=="button";function Yi({schema:r,resolver:e}){const{layout:t,fields:s=[],onSubmit:n,successMessage:a,errorMessage:o,footerButtons:l,defaultValues:c,loadDefaultValues:d,validationSchema:u}=r,{show:p}=jn(),{t:h}=Er(),y=v.useMemo(()=>{if(e)return e;try{const C=u??ki(r);return zo(C)}catch{return}},[e,r,u]),x=ho({resolver:y,mode:"onBlur",reValidateMode:"onChange",defaultValues:c??{}}),{control:k,reset:S,handleSubmit:w,formState:{errors:g,isSubmitting:T}}=x,[V,F]=v.useState(!1);v.useEffect(()=>{d&&(F(!0),d().then(C=>S(C)).finally(()=>F(!1)))},[d,S]);const U=v.useMemo(()=>(s??[]).filter(Gi),[s]),{loadingCount:G,optionsMap:_}=Di(U),D=Vi(s),Q=Ui(s,k),Z=v.useMemo(()=>{const C={};return t.forEach((m,W)=>{m.type==="tabs"&&(C[W]=m.tabs[0].key)}),C},[t]),[$,H]=v.useState(Z),J=v.useCallback((C,m)=>{if(!(C!=null&&C.enabled)||!C.rule)return m;try{return!!Pt(C.rule,x.getValues())}catch{return m}},[x]),q=v.useMemo(()=>s.map(C=>C).filter(C=>{var m;return((m=C.clearWhen)==null?void 0:m.enabled)&&C.clearWhen.rule}).map(C=>({name:C.name,rule:C.clearWhen.rule,clearTo:C.clearWhen.clearTo})),[s]);v.useEffect(()=>{if(!q.length)return;const C=W=>{q.forEach(({name:E,rule:j,clearTo:O})=>{try{if(!!Pt(j,W)){const ee=O??"";W[E]!==ee&&x.setValue(E,ee,{shouldDirty:!0,shouldValidate:!0})}}catch{}})};C(x.getValues());const m=x.watch(()=>C(x.getValues()));return()=>{var W;return(W=m==null?void 0:m.unsubscribe)==null?void 0:W.call(m)}},[x,q]);const X=v.useCallback(C=>{var ne,ae,he,ge;let m;if(typeof C=="string"){if(m=D[C],!m){const te=(s??[]).find(ce=>(ce==null?void 0:ce.name)===C);if(te)m=te;else return null}}else m=C;const W=m.visibleWhen;if(!J(W,!0))return null;let j=!!m.disabled;const O=m.disabledWhen,I=J(O,!1);if(O!=null&&O.enabled&&(j=I),!(O!=null&&O.enabled)&&"name"in m&&m.name&&Q[m.name]&&(j=!0),m.type==="search"){const te=_e=>m.searchFn(_e,{getValues:x.getValues,watch:x.watch}),ce={};return m.searchMode&&(ce.searchMode=m.searchMode),m.minChars&&(ce.minChars=m.minChars),m.debounceMs&&(ce.debounceMs=m.debounceMs),m.resolveByValue&&(ce.resolveByValue=m.resolveByValue),i.jsx(Nn,{name:m.name,control:k,searchFn:te,label:m.label,size:m.size,width:m.width,disabled:j||T,...ce},m.name)}if(m.type==="inputGroup"){const te=m,ce=(te.inputs??[]).map(_e=>{var ot;const de=typeof _e=="string"?D[_e]??(s??[]).find(f=>(f==null?void 0:f.name)===_e):_e;if(!de)return null;const Oe=de.disabledWhen;let at=!!de.disabled;const Zt=J(Oe,!1);Oe!=null&&Oe.enabled&&(at=Zt),!(Oe!=null&&Oe.enabled)&&Q[de.name]&&(at=!0);const Wt={name:de.name,control:k,label:de.label,size:de.size,width:de.width,placeholder:de.placeholder,hasError:!!g[de.name],errorMessage:((ot=g[de.name])==null?void 0:ot.message)||"",loading:V,disabled:at||T,suffixButton:de.suffixButton,reserveErrorSpace:!0};return de.type==="select"?{...Wt,options:de.options??_[de.name]??[],loadOptions:de.options?void 0:de.loadOptions}:{...Wt,type:de.type}}).filter(Boolean);return i.jsx(yn,{groupLabel:te.groupLabel,inputs:ce,separator:te.separator,useSeparator:te.useSeparator,className:te.className,showVisibleLabel:te.showVisibleLabel,size:te.size},`inputGroup_${te.name??te.groupLabel??"group"}`)}if(m.type==="button"){const te=m;return i.jsx("div",{className:"self-center",children:i.jsx(Pe,{type:"button",variant:te.variant,size:te.size,width:te.width,icon:te.icon,iconPosition:te.iconPosition,ariaLabel:te.ariaLabel,onClick:te.onClick,disabled:j||T,children:te.label})},te.name)}const ee=m.suffixButton,se=typeof ee=="string"?X(ee):ee,ue={name:m.name,control:k,disabled:j||T,label:m.label,size:m.size,width:m.width,placeholder:m.placeholder,info:m.info,suffixButton:se};switch(m.type){case"select":return i.jsx(Ce,{name:m.name,control:k,render:({field:te})=>{var ce;return i.jsx(pt,{...ue,value:te.value,onChange:te.onChange,options:m.options??_[m.name]??[],loadOptions:m.options?void 0:m.loadOptions,hasError:!!g[m.name],errorMessage:(ce=g[m.name])==null?void 0:ce.message,suffixButton:se})}},m.name);case"textarea":return i.jsx(Ce,{name:m.name,control:k,render:({field:te,fieldState:ce})=>{var _e;return i.jsx(_r,{...ue,value:te.value,onChange:te.onChange,maxLength:m.maxLength,showCounter:!!m.showCounter,hasError:!!ce.error,errorMessage:((_e=ce.error)==null?void 0:_e.message)||""})}},m.name);case"file":return i.jsx(Js,{...ue,defaultValue:[],maxFiles:m.maxFiles,accept:m.accept,hasError:!!g[m.name],errorMessage:(ne=g[m.name])==null?void 0:ne.message},m.name);case"checkbox":return i.jsx(En,{...ue,defaultValue:!1,hasError:!!g[m.name],errorMessage:(ae=g[m.name])==null?void 0:ae.message,name:m.name},m.name);case"date":return i.jsx(Hs,{...ue,defaultValue:"",showTime:!!m.showTime,hasError:!!g[m.name],errorMessage:(he=g[m.name])==null?void 0:he.message},m.name);case"optionGroup":return i.jsx(vn,{...ue,options:m.options||[],multiple:m.multiple,vertical:m.vertical,groupLabel:m.groupLabel,defaultValue:m.defaultValue,className:m.width?void 0:"w-full",name:m.name},m.name);default:return i.jsx(Nr,{...ue,type:m.type,loadingDefaults:V,hasError:!!g[m.name],errorMessage:(ge=g[m.name])==null?void 0:ge.message,suffixButton:se,name:m.name},m.name)}},[s,D,k,g,T,V,_,J,Q,x.getValues,x.watch]);return i.jsx(Ja,{...x,children:i.jsxs("form",{noValidate:!0,onSubmit:w(async C=>{await n(C),p(a??h("ds.form.saveSuccess"),"success")},C=>{console.log("❌ errores de validación:",C),Ei(C),p(o??h("ds.form.saveError"),"error")}),className:"space-y-6",children:[t.map((C,m)=>C.type==="rows"?i.jsx(v.Fragment,{children:C.sections.map((W,E)=>i.jsx("div",{className:"mb-6",children:i.jsx(rr,{title:W.sectionTitle,defaultOpen:W.defaultOpen,children:W.rows.map((j,O)=>i.jsxs("div",{children:[j.title&&i.jsx("h2",{className:"mb-2 text-lg text-[var(--color-ds-text-primary)]",children:j.title}),i.jsx("div",{className:"flex flex-wrap -mx-2",children:j.columns.map((I,ee)=>{var se;return i.jsx("div",{className:`${I.width} px-2 flex flex-col`,children:i.jsx("div",{className:"space-y-4",children:I.fields?I.fields.map(ue=>X(ue)):(se=I.rows)==null?void 0:se.map((ue,ne)=>i.jsx("div",{className:"mb-1",children:i.jsx("div",{className:"flex flex-wrap -mx-2",children:ue.columns.map((ae,he)=>{var ge;return i.jsx("div",{className:`${ae.width} px-2`,children:(ge=ae.fields)==null?void 0:ge.map(te=>X(te))},he)})})},ne))})},ee)})})]},O))})},E))},m):i.jsx(bn,{options:C.tabs.map(W=>({label:W.label,value:W.key})),value:$[m],onChange:W=>H(E=>({...E,[m]:W})),children:Object.fromEntries(C.tabs.map(W=>[W.key,i.jsx("div",{className:"space-y-6",children:W.sections.map((E,j)=>i.jsx("div",{className:"mb-6",children:i.jsx(rr,{title:E.sectionTitle,defaultOpen:E.defaultOpen,children:E.rows.map((O,I)=>i.jsx("div",{children:i.jsx("div",{className:"flex flex-wrap -mx-2",children:O.columns.map((ee,se)=>{var ue;return i.jsx("div",{className:`${ee.width??"flex-1"} px-2 flex flex-col`,children:i.jsx("div",{className:"space-y-4",children:(ue=ee.fields)==null?void 0:ue.map((ne,ae)=>i.jsx(v.Fragment,{children:X(ne)},ae))})},se)})})},I))})},j))},W.key)]))},m)),i.jsx("footer",{className:"py-4 w-full flex justify-center space-x-4",children:l??i.jsx(Pe,{type:"submit",variant:"primary",icon:Yn,size:"sm",disabled:T||V||G>0,children:h(T?"ds.form.sending":"ds.form.submit")})})]})})}const Hi={sm:"h-8 w-8",md:"h-10 w-10",lg:"h-12 w-12"};function Sn({icon:r,size:e="md",ariaLabel:t,disabled:s=!1,onClick:n,...a}){return i.jsx("button",{type:"button","aria-label":t,disabled:s,onClick:n,className:L("inline-flex items-center justify-center","rounded-full","bg-transparent","text-[var(--color-ds-text-primary)]","transition-transform","focus:outline-none",Hi[e],s?"opacity-50 cursor-not-allowed":["hover:scale-110","hover:animate-pulse"]),...a,children:i.jsx(r,{className:L(e==="sm"?"h-4 w-4":e==="md"?"h-5 w-5":"h-6 w-6")})})}function _n({dark:r,onToggle:e}){return i.jsx("button",{type:"button","aria-pressed":r,"aria-label":r?"Cambiar a modo claro":"Cambiar a modo oscuro",onClick:e,className:L("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:i.jsxs("div",{className:L("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",r?"translate-x-6":"translate-x-1"),children:[i.jsx(Me,{component:ma,size:"sm",className:L("absolute transition-opacity duration-200 ease-in-out",r?"opacity-0":"opacity-100 text-[var(--color-ds-background-accent)]")}),i.jsx(Me,{component:da,size:"sm",className:L("absolute transition-opacity duration-200 ease-in-out",r?"opacity-100 text-[var(--color-ds-background-accent)]":"opacity-0")})]})})}const Fn=v.createContext({theme:"light",toggle:()=>{}});function Xi({children:r}){const[e,t]=v.useState(!1),[s,n]=v.useState("light");v.useEffect(()=>{if(typeof window>"u")return;const o=localStorage.getItem("ds-theme");o==="light"||o==="dark"?n(o):window.matchMedia("(prefers-color-scheme: dark)").matches&&n("dark"),t(!0)},[]),v.useEffect(()=>{e&&(document.documentElement.classList.toggle("dark",s==="dark"),s==="dark"?localStorage.setItem("ds-theme","dark"):localStorage.removeItem("ds-theme"))},[s,e]);const a=()=>n(o=>o==="light"?"dark":"light");return e?i.jsx(Fn.Provider,{value:{theme:s,toggle:a},children:r}):null}const Tn=()=>v.useContext(Fn),An=({pinnedPages:r,onRemovePinned:e,onBack:t,dark:s,locale:n,languageOptions:a,onChangeLocale:o,profile:l,profileOptions:c,onChangeProfile:d})=>{const u=r.slice(0,3),{toggle:p}=Tn(),{t:h,i18n:y}=Er(),x=k=>{o(k)};return i.jsxs("header",{className:"flex items-center bg-[var(--color-ds-background-page)] py-2",children:[i.jsx("div",{className:"flex items-center space-x-2",children:u.map(k=>i.jsxs("div",{className:"flex items-center",children:[i.jsx("a",{href:k.href,className:L("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:k.label}),i.jsx(Sn,{icon:xr,size:"sm",ariaLabel:`${h("remove")} ${k.label}`,onClick:()=>e(k.id)})]},k.id))}),i.jsx("div",{className:"flex-grow"}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(pt,{size:"sm",width:"auto",options:a,value:n,onChange:x,disableErrorPlaceholder:!0}),i.jsx(pt,{size:"sm",width:"auto",options:c,value:l,onChange:d,disableErrorPlaceholder:!0}),i.jsx(_n,{dark:s,onToggle:p})]})]})},Ki=({loading:r=!1,ariaLabel:e="Cargando..."})=>r?i.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
40
40
  z-50\r
41
- `,role:"status","aria-live":"polite","aria-label":e,children:[i.jsx("div",{className:`\r
41
+ `,role:"status","aria-live":"polite","aria-label":t,children:[o.jsx("div",{className:`\r
42
42
  w-12 h-12\r
43
43
  border-4 rounded-full\r
44
44
  border-gray-200\r
45
45
  border-t-[var(--color-ds-button-primary-bg)]\r
46
46
  animate-spin\r
47
- `}),i.jsx("span",{className:"sr-only",children:e})]}):null,Ji=({isOpen:r,onClose:e,title:t,children:s,footer:n})=>(v.useEffect(()=>{const a=o=>o.key==="Escape"&&e();return r&&(document.addEventListener("keydown",a),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",a),document.body.style.overflow=""}},[r,e]),r?vs.createPortal(i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fixed inset-0 bg-[var(--color-ds-text-primary)]/50 z-40",onClick:e}),i.jsx("div",{className:"fixed inset-0 flex items-center justify-center px-4 z-50",children:i.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
@@ -52,10 +52,31 @@ attempted value: ${o}
52
52
  shadow-2xl\r
53
53
  w-full max-w-lg\r
54
54
  overflow-hidden\r
55
- `,children:[i.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[var(--color-ds-border-muted)]",children:[t?i.jsx("h3",{className:"text-ds-lg font-semibold text-[var(--color-ds-text-primary)]",children:t}):i.jsx("div",{}),i.jsxs("button",{onClick:e,className:`\r
55
+ `,children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[var(--color-ds-border-muted)]",children:[r?o.jsx("h3",{className:"text-ds-lg font-semibold text-[var(--color-ds-text-primary)]",children:r}):o.jsx("div",{}),o.jsxs("button",{onClick:t,className:`\r
56
56
  p-1 rounded-full\r
57
57
  bg-[var(--color-ds-background-page)]\r
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:[i.jsx(xr,{className:"w-5 h-5 text-[var(--color-ds-text-secondary)] hover:text-[var(--color-ds-text-primary)]"}),i.jsx("span",{className:"sr-only",children:"Cerrar modal"})]})]}),i.jsx("div",{className:"px-6 py-6 text-[var(--color-ds-text-primary)]",children:s}),n&&i.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),Fr=({items:r,selected:e,onSelect:t,level:s=0})=>{const[n,a]=v.useState(new Set),o=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 i.jsx("ul",{className:L(s>0?"mt-1":"mt-0"),children:r.map(l=>{var x;const c=l.value===e,d=n.has(l.value),u=["pl-2","pl-2","pl-2"][s]||"pl-4",p=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)]",y=!!((x=l.children)!=null&&x.length);return i.jsxs("li",{children:[i.jsxs("button",{type:"button",onClick:()=>y?o(l.value):t(l.value),"aria-expanded":y?d:void 0,className:L("w-full flex items-center justify-between h-8 transition-colors",u,p),children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[s===0&&l.icon&&i.jsx(l.icon,{className:"w-5 h-5 ml-2"}),i.jsx("span",{className:"text-ds-sm",children:l.label})]}),y&&(d?i.jsx(pr,{className:L("w-4 h-4",h)}):i.jsx(Kn,{className:L("w-4 h-4",h)}))]}),y&&i.jsx("div",{className:L("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:i.jsx(Fr,{items:l.children,selected:e,onSelect:t,level:s+1})})]},l.value)})})},Qi="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",el="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",Cn=({appName:r,orgName:e,username:t,footerText:s,navItems:n,selectedNav:a,onSelectNav:o,width:l="200px"})=>{const{theme:c}=Tn(),d=c==="dark"?Qi:el;return i.jsxs("aside",{className:"flex flex-col h-screen bg-[var(--color-ds-background-page)]",style:{width:l},children:[i.jsxs("div",{className:"flex gap-1 flex-col items-center py-4 space-y-1",children:[i.jsx("img",{src:d,alt:"Logo Diputación",className:"w-20 h-20"}),i.jsx("span",{className:"text-[var(--color-ds-text-primary)] text-ds-lg ",children:r}),i.jsx("span",{className:"text-ds-sm text-[var(--color-ds-text-secondary)]",children:e}),i.jsx("span",{className:"text-ds-sm text-[var(--color-ds-text-secondary)]",children:t}),i.jsx("div",{className:"w-1/5 h-0.5 rounded-full bg-[var(--color-ds-background-accent)] mt-2"})]}),i.jsx("nav",{className:"flex-1 overflow-auto pt-3",children:i.jsx(Fr,{items:n,selected:a,onSelect:o})}),i.jsx("div",{className:"px-4 w-full py-3",children:i.jsx("span",{className:"text-ds-sm w-full text-center text-[var(--color-ds-text-secondary)]",children:s})})]})};function tl({hideSidebar:r=!1,sidebar:e,header:t,children:s}){return i.jsxs("div",{className:"flex h-screen overflow-hidden bg-[var(--color-ds-background-page)]",children:[!r&&i.jsx(Cn,{...e}),i.jsxs("div",{className:`flex-1 flex flex-col overflow-auto [scrollbar-gutter:stable_both-edges] ${r?"px-0":"px-10"}`,children:[i.jsx(An,{...t}),i.jsx("main",{className:"flex-1",children:s})]})]})}function rl({columns:r,data:e,loadData:t,loading:s,idAccessor:n,multiSelect:a=!1,onSelectionChange:o,pageSize:l=10,initialSort:c,onSort:d,className:u,onRowDoubleClick:p}){const h=e!==void 0,[y,x]=v.useState([]),[k,S]=v.useState(!1),w=v.useRef(null);v.useEffect(()=>{var O;if(!t||h)return;(O=w.current)==null||O.abort();const j=new AbortController;return w.current=j,S(!0),t().then(I=>{j.signal.aborted||x(I)}).finally(()=>{j.signal.aborted||S(!1)}),()=>j.abort()},[t,h]);const g=v.useMemo(()=>h?e:y,[e,y,h]),T=s??(t?k:!1),[V,F]=v.useState(new Set),[U,G]=v.useState(1),[_,D]=v.useState(c==null?void 0:c.sortBy),[Q,Z]=v.useState((c==null?void 0:c.sortDir)??"asc"),$=j=>typeof n=="function"?n(j):j[n],H=v.useRef(null);v.useEffect(()=>{H.current!==g&&(F(new Set),G(1),H.current=g)},[g]);const J=v.useMemo(()=>{if(!_)return g;const j=Q==="asc"?1:-1;return[...g].sort((O,I)=>{const ee=O[_],se=I[_];return ee==null?-j:se==null||ee>se?j:ee<se?-j:0})},[g,_,Q]),q=Math.max(1,Math.ceil(J.length/l)),X=v.useMemo(()=>{const j=(U-1)*l;return J.slice(j,j+l)},[J,U,l]),C=j=>{const O=new Set(V);O.has(j)?O.delete(j):O.add(j),F(O),o==null||o(g.filter(I=>O.has($(I))))},m=()=>{const j=X.every(I=>V.has($(I))),O=new Set(V);X.forEach(I=>{j?O.delete($(I)):O.add($(I))}),F(O),o==null||o(g.filter(I=>O.has($(I))))},W=j=>{if(!j.sortable)return;const O=typeof j.accessor=="string"?j.accessor:j.sortKey;if(_===O){const I=Q==="asc"?"desc":"asc";Z(I),d==null||d(O,I)}else D(O),Z("asc"),d==null||d(O,"asc");G(1)},E=()=>T?i.jsx("tbody",{children:Array.from({length:l}).map((j,O)=>i.jsxs("tr",{children:[a&&i.jsx("td",{children:i.jsx(Xe,{width:"1rem",height:"1rem",variant:"circle"})}),r.map((I,ee)=>i.jsx("td",{children:i.jsx(Xe,{width:"100%",height:"1em",variant:"rect"})},ee))]},O))}):X.length?i.jsx("tbody",{children:X.map(j=>{const O=$(j);return i.jsxs("tr",{className:L("hover:bg-gray-50",p&&"cursor-pointer select-none"),onDoubleClick:p?()=>p(j):void 0,title:p?"Doble clic para abrir":void 0,children:[a&&i.jsx("td",{children:i.jsx("input",{type:"checkbox",checked:V.has(O),onChange:()=>C(O),onDoubleClick:I=>I.stopPropagation()})}),r.map((I,ee)=>{const se=I.render?I.render(j):typeof I.accessor=="function"?I.accessor(j):j[I.accessor];return i.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-sm",children:se},ee)})]},O)})}):i.jsx("tbody",{children:i.jsx("tr",{children:i.jsx("td",{colSpan:r.length+(a?1:0),children:"No hay datos"})})});return i.jsxs("div",{className:L("w-full overflow-auto",u),children:[i.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[i.jsx("thead",{className:"bg-gray-50",children:i.jsxs("tr",{children:[a&&i.jsx("th",{children:i.jsx("input",{type:"checkbox",checked:X.length>0&&X.every(j=>V.has($(j))),onChange:m,onDoubleClick:j=>j.stopPropagation()})}),r.map(j=>{const O=typeof j.accessor=="string"?j.accessor:j.header,I=_===(typeof j.accessor=="string"?j.accessor:j.sortKey);return i.jsx("th",{className:L("px-4 py-2 text-left text-sm font-medium text-gray-700",j.width),onClick:()=>W(j),children:i.jsxs("div",{className:"inline-flex items-center space-x-1 cursor-pointer",children:[i.jsx("span",{children:j.header}),j.sortable&&i.jsx("span",{className:"text-xs",children:I?Q==="asc"?"▲":"▼":"⇵"})]})},O)})]})}),E()]}),i.jsxs("div",{className:"flex items-center justify-between py-2 px-4",children:[i.jsx("span",{className:"text-sm text-gray-700",children:T?"Cargando...":`Página ${U} de ${q}`}),i.jsxs("div",{className:"space-x-2",children:[i.jsx(Pe,{size:"sm",variant:"outline",disabled:T||U<=1,onClick:()=>G(j=>Math.max(1,j-1)),children:"Prev"}),i.jsx(Pe,{size:"sm",variant:"outline",disabled:T||U>=q,onClick:()=>G(j=>Math.min(q,j+1)),children:"Next"})]})]})]})}function On({control:r,name:e,rules:t,defaultValue:s=!1,checked:n,onChange:a,disabled:o=!1,label:l,labelPosition:c="right",errorMessage:d="",className:u}){const p=v.useId();if(r&&e)return i.jsx(Ce,{name:e,control:r,rules:t,defaultValue:s,render:({field:y,fieldState:x})=>{var k;return i.jsx(On,{checked:y.value,onChange:y.onChange,disabled:o,label:l,labelPosition:c,errorMessage:((k=x.error)==null?void 0:k.message)||"",className:u})}});const h=!!n;return i.jsxs("div",{className:L("flex flex-col",u),children:[i.jsxs("label",{className:L("inline-flex items-center space-x-3 select-none",o&&"opacity-50 cursor-not-allowed"),htmlFor:p,children:[l&&c==="left"&&i.jsx("span",{className:"text-ds-md text-[var(--color-ds-text-primary)]",children:l}),i.jsx("button",{id:p,type:"button",role:"switch","aria-checked":h,disabled:o,onClick:()=>!o&&(a==null?void 0:a(!h)),className:L("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:i.jsx("div",{className:L("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"&&i.jsx("span",{className:"text-ds-md text-[var(--color-ds-text-primary)]",children:l})]}),i.jsx("div",{className:"pt-1 min-h-[18px] w-full",children:d?i.jsx("span",{className:"text-xs text-[var(--color-ds-text-error)]",children:d}):i.jsx("span",{"aria-hidden":"true",children:" "})})]})}function sl({items:r,value:e,onValueChange:t,multiple:s=!0,dense:n=!1,className:a}){const o=v.useMemo(()=>r.filter(x=>x.defaultOpen&&!x.disabled).map(x=>x.id),[r]),[l,c]=v.useState(o),d=e??l,u=x=>{t?t(x):c(x)},p=(x,k)=>{k&&u(s?d.includes(x)?d.filter(S=>S!==x):[...d,x]:d.includes(x)?[]:[x])},h=(x,k,S)=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),p(k,S))},y=n?"py-1":"py-2";return i.jsx("div",{className:["divide-y","divide-[var(--color-ds-border-default-50)]",a].filter(Boolean).join(" "),children:r.map(x=>{const k=d.includes(x.id),S=!x.disabled;return i.jsxs("section",{"aria-disabled":x.disabled||void 0,children:[i.jsxs("button",{type:"button",onClick:()=>p(x.id,S),onKeyDown:w=>h(w,x.id,S),"aria-expanded":k,className:["w-full flex items-center justify-between gap-2 text-left select-none",y,"text-[var(--color-ds-text-primary)]",x.disabled?"opacity-60 cursor-not-allowed":"hover:bg-[color-mix(in_srgb,var(--color-ds-background-surface)_80%,transparent)]"].join(" "),children:[i.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[x.leftAdornment&&i.jsx("span",{className:"shrink-0",children:x.leftAdornment}),i.jsx("span",{className:"font-medium truncate",children:x.title})]}),i.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[x.actions,i.jsx(pr,{className:["h-4 w-4 transition-transform",k?"rotate-180":"",x.disabled?"opacity-40":""].join(" ")})]})]}),k&&i.jsx("div",{className:[n?"py-1":"py-2"].join(" "),children:x.content})]},x.id)})})}exports.Button=Pe;exports.Checkbox=En;exports.CollapsibleSection=rr;exports.CompactAccordion=sl;exports.DateInput=Hs;exports.DropdownMenu=go;exports.FileUploader=Js;exports.FormFieldInput=Nr;exports.FormPageLayout=Io;exports.FormRenderer=Yi;exports.Header=An;exports.Icon=Me;exports.IconButton=Sn;exports.InfoButton=Qs;exports.Input=Bt;exports.InputGroup=yn;exports.LoadingScreen=Ki;exports.Modal=Ji;exports.OptionGroup=vn;exports.PageLayout=tl;exports.SearchField=Nn;exports.Select=pt;exports.Sidebar=Cn;exports.SidebarNav=Fr;exports.SkeletonLoader=Xe;exports.Table=rl;exports.Tabs=bn;exports.TextArea=_r;exports.ThemeProvider=Xi;exports.ThemeToggle=_n;exports.Toast=wn;exports.ToastProvider=Ci;exports.ToggleSwitch=On;exports.useToast=jn;
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
+ To pick up a draggable item, press the space bar.
63
+ While dragging, use the arrow keys to move the item.
64
+ Press space again to drop the item in its new position, or press escape to cancel.
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
+ `);return`/* eslint-disable */
67
+ // Auto-generated with generateYupCode(schema)
68
+ import * as yup from "yup";
69
+
70
+ export const ${t} = yup.object({
71
+ ${n}
72
+ });
73
+
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
+ border-[var(--color-ds-border-default-50)]\r
76
+ text-[var(--color-ds-text-primary)]\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
+ bg-[var(--color-ds-background-surface)]\r
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(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
+ 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((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;