@mateosuarezdev/react-ui 1.0.51 → 1.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -8,15 +8,15 @@
8
8
  * See LICENSE file for full terms.
9
9
  */
10
10
 
11
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),f=require("react"),dr=require("react-dom"),dn=require("clsx"),fn=require("tailwind-merge"),mn=require("@mateosuarezdev/atoms"),I=require("lucide-react"),L=require("framer-motion"),ue=require("@mateosuarezdev/react-router"),J=require("react-hook-form"),Ue=require("@hookform/resolvers"),fr=require("@mateosuarezdev/gestures"),k=(...e)=>fn.twMerge(dn.clsx(e));function Oe(e,t=100){let r=null,n=null;return function(...s){const o=Date.now();r===null||o-r>=t?(e.apply(this,s),r=o):(n&&clearTimeout(n),n=setTimeout(()=>{e.apply(this,s),r=Date.now()},t-(o-r)))}}function hn(e,t=500){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{e.apply(this,n),r=null},t)}}function mr(e){if(!e)return"";const r=e.trim().replace(/\s+/g," ").split(" ");return r.length===0||r[0]===""?"":r.length===1?r[0].charAt(0).toUpperCase():(r[0].charAt(0)+r[1].charAt(0)).toUpperCase()}function hr(e){e.focus();const t=e.value.length;e.setSelectionRange(t,t)}function br(e){return e.replace(/\s/g,"")}function bn(e){return e.toLowerCase().split(" ").map(s=>{if(s.length===0)return s;const o=[...s][0],a=s.slice(o.length);return o.toUpperCase()+a}).join(" ")}function Mt(e){return e===null?"":e}function et(e){return br(e)===""?null:e}function pn(e,t,r={}){const n={...r};return Object.keys(t).forEach(s=>{if(t[s]===!0&&s in e){const o=s;n[o]=e[o]}}),n}class gn{constructor(){this.container=null,this.previouslyFocusedElement=null}enable(){this.container&&(this.previouslyFocusedElement=document.activeElement,this.container.addEventListener("keydown",this.trapFocus.bind(this)),document.addEventListener("click",this.handleClickOutside.bind(this)))}disable(){this.container&&(this.container.removeEventListener("keydown",this.trapFocus.bind(this)),document.removeEventListener("click",this.handleClickOutside.bind(this)),this.previouslyFocusedElement&&this.previouslyFocusedElement.focus&&this.previouslyFocusedElement.focus())}setContainer(t){this.disable(),this.container=t,this.enable()}trapFocus(t){const r=this.container?.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!r)return;const n=r[0],s=r[r.length-1];t.key==="Tab"&&(t.shiftKey&&document.activeElement===n?(t.preventDefault(),s.focus()):!t.shiftKey&&document.activeElement===s&&(t.preventDefault(),n.focus()))}handleClickOutside(t){this.container&&!this.container.contains(t.target)&&(t.preventDefault(),this.previouslyFocusedElement&&this.previouslyFocusedElement.focus&&this.previouslyFocusedElement.focus())}}const _e=e=>{const t=e.scrollWidth>e.clientWidth,r=e.scrollHeight>e.clientHeight,n=Math.max(0,e.scrollWidth-e.clientWidth),s=Math.max(0,e.scrollHeight-e.clientHeight);return{horizontal:t,vertical:r,scrollWidth:e.scrollWidth,clientWidth:e.clientWidth,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,canScrollLeft:e.scrollLeft>10,canScrollRight:e.scrollLeft<n-10,canScrollUp:e.scrollTop>0,canScrollDown:e.scrollTop<s,scrollPercentageX:t&&n>0?e.scrollLeft/n*100:0,scrollPercentageY:r&&s>0?e.scrollTop/s*100:0}},pr=({onOverflow:e,trackScroll:t=!1,withObserver:r=!1,enabled:n=!0,deps:s=[]}={})=>{const o=f.useRef(null);return f.useEffect(()=>{if(!o.current||!n)return;let a=!1;const u=Oe(()=>{if(o.current){const h=_e(o.current);e?.(h)}}),c=_e(o.current);a=c.horizontal||c.vertical,e?.(c),window.addEventListener("resize",u);let d=null;r&&(d=new ResizeObserver(u),o.current&&d.observe(o.current));let m=null;return t&&a&&(m=o.current,m.addEventListener("scroll",u)),()=>{window.removeEventListener("resize",u),d&&d.disconnect(),m&&a&&m.removeEventListener("scroll",u)}},[n,...s]),{ref:o}},vn=({trackScroll:e=!1,withObserver:t=!1,enabled:r=!0,deps:n=[]}={})=>{const s=f.useRef(null),[o,a]=f.useState(null);return f.useEffect(()=>{if(!s.current||!r)return;let i=!1;const c=Oe(()=>{if(s.current){const p=_e(s.current);a(p)}}),d=_e(s.current);i=d.horizontal||d.vertical,a(d),window.addEventListener("resize",c);let m=null;t&&(m=new ResizeObserver(c),s.current&&m.observe(s.current));let h=null;return e&&i&&(h=s.current,h.addEventListener("scroll",c)),()=>{window.removeEventListener("resize",c),m&&m.disconnect(),h&&i&&h.removeEventListener("scroll",c)}},[r,...n]),{ref:s,overflowInfo:o}},gt={xs:"w-8 h-8",sm:"w-10 h-10 text-lg",md:"w-14 h-14 text-xl",lg:"h-20 w-20 text-2xl",xl:"h-24 w-24 text-2xl"},xn=({src:e,name:t,size:r="md",className:n})=>e?l.jsx("img",{alt:"avatar",src:e,className:k("rounded-full bg-base-3",gt[r])}):t?l.jsx("p",{className:k("rounded-full font-medium dark-theme:bg-base-3 border border-base-6 dark-theme:border-base-4 flex items-center justify-center",gt[r],n),children:mr(t)}):l.jsx("div",{className:k("rounded-full text-2xl font-medium flex items-center justify-center","bg-base-2 dark-theme:bg-base-3 border border-base-4","lg:hover:bg-base-3 max-lg:active:bg-base-4 transition-colors",gt[r],n),children:l.jsxs(Br,{size:r==="xs"?16:r==="sm"?20:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),l.jsx("circle",{cx:"12",cy:"7",r:"4"})]})});function wn({className:e,children:t,animate:r=!1,...n}){return l.jsx("div",{className:k("flex -space-x-3 rtl:space-x-reverse",e),...n,children:t})}function yn(e){return f.useSyncExternalStore(t=>e.subscribe(t),()=>e.get(),()=>e.get())}const kt=mn.atom(typeof window<"u"?window.innerWidth>1024:!0);let vt=!1;const qt=Oe(()=>{kt.set(window.innerWidth>1024)});typeof window<"u"&&(vt&&(window.removeEventListener("resize",qt),vt=!1),window.addEventListener("resize",qt),vt=!0);const Be=()=>(f.useLayoutEffect(()=>{kt.set(window.innerWidth>1024)},[]),yn(kt));function Dt(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}const gr=(e=!0,t)=>{const r=Be(),n=f.useRef(null),s=f.useCallback(o=>{if(!e||r)return;const a=n.current;if(!a)return;const i=a.getBoundingClientRect(),u=Math.max(i.width,i.height),c=o.clientX-i.left-u/2,d=o.clientY-i.top-u/2,m=document.createElement("span");m.classList.add("ripple-wrapper");const h=document.createElement("span");h.classList.add("ripple"),h.style.backgroundColor=t?"var(--ripple-contrast)":"var(--ripple-main)",h.style.width=`${u}px`,h.style.height=`${u}px`,h.style.left=`${c}px`,h.style.top=`${d}px`,m.appendChild(h);const p=a.getElementsByClassName("ripple-wrapper");if(p?.length)for(const b of p)b.remove();a.appendChild(m),setTimeout(()=>{m.remove()},700)},[e,r,t]);return{ref:n,ripple:s,styles:{position:"relative"}}},ct=({scrollerId:e,align:t="start",side:r="bottom",offset:n=8,collisionPadding:s=8,avoidCollisions:o=!0,closeOnScroll:a=!0,onOpen:i,onClose:u}={})=>{const[c,d]=f.useState(!1),[m,h]=f.useState({width:192,height:300}),p=f.useRef(null),b=f.useRef(null),v=f.useRef({left:0,right:0,top:0,bottom:0,x:0,y:0,width:0,height:0}),x=f.useRef(null),$=f.useId(),j=f.useCallback(y=>{const N=y??v.current;if(!N)return{x:0,top:0,bottom:void 0};const P=m.width,A=m.height;return vr({triggerRect:N,popoverWidth:P,popoverHeight:A,align:t,side:r,offset:n,collisionPadding:s,avoidCollisions:o})},[v.current,m,t,r]);f.useEffect(()=>{if(!c||!e||(x.current=document.getElementById(e),!x.current))return;c&&R();const y=()=>{x.current&&(d(!1),i?.(),x.current.removeEventListener("scroll",y))};return a&&x.current.addEventListener("scroll",y,{passive:!0}),()=>{x.current&&x.current.removeEventListener("scroll",y)}},[c,e]);const R=()=>{b.current&&h({width:b.current.offsetWidth,height:b.current.offsetHeight})},T=f.useCallback(()=>{if(!p.current)return;const y=p.current.getBoundingClientRect();v.current={left:y.left,right:y.right,top:y.top,bottom:y.bottom,x:y.x,y:y.y,width:y.width,height:y.height},d(N=>(N?u?.():i?.(),!N))},[]),M=f.useCallback(()=>{d(!1),u?.()},[]);return{triggerRef:p,triggerProps:{id:$,"aria-expanded":c,"aria-haspopup":!0},popoverRef:b,getPopoverPosition:j,open:c,toggle:T,close:M}},vr=({triggerRect:e,popoverWidth:t,popoverHeight:r,align:n="start",side:s="bottom",offset:o=4,collisionPadding:a=8,avoidCollisions:i=!0})=>{const u={width:window.innerWidth,height:window.innerHeight};let c=0,d=0;if(i){if(s==="right"){const p=e.right+o,b=e.left-t-o,v=Math.max(0,p+t-(u.width-a)),x=Math.max(0,a-b);v<=x?(c=p,v>0&&(c=u.width-t-a)):(c=b,x>0&&(c=a)),d=e.top,d+r>u.height-a&&(d=u.height-r-a),d<a&&(d=a)}else if(s==="left"){const p=e.left-t-o,b=e.right+o,v=Math.max(0,a-p),x=Math.max(0,b+t-(u.width-a));v<=x?(c=p,v>0&&(c=a)):(c=b,x>0&&(c=u.width-t-a)),d=e.top,d+r>u.height-a&&(d=u.height-r-a),d<a&&(d=a)}else if(s==="bottom"){const p=u.height-e.bottom,b=e.top;p>=r+o?d=e.bottom+o:b>=r+o?d=e.top-r-o:(d=e.bottom+o,d=Math.min(d,u.height-r-a));const v=u.width-e.left,x=e.right;if(n==="start")c=e.left,c+t>u.width-a&&(x>=t?c=e.right-t:c=u.width-t-a);else if(n==="end")c=e.right-t,c<a&&(v>=t?c=e.left:c=a);else{const $=e.left+e.width/2-t/2;$>=a&&$+t<=u.width-a?c=$:$<a?c=a:c=u.width-t-a}}else{const p=e.top,b=u.height-e.bottom;p>=r+o?d=e.top-r-o:b>=r+o?d=e.bottom+o:(d=e.top-r-o,d=Math.max(a,d));const v=u.width-e.left,x=e.right;if(n==="start")c=e.left,c+t>u.width-a&&(x>=t?c=e.right-t:c=u.width-t-a);else if(n==="end")c=e.right-t,c<a&&(v>=t?c=e.left:c=a);else{const $=e.left+e.width/2-t/2;$>=a&&$+t<=u.width-a?c=$:$<a?c=a:c=u.width-t-a}}c=Math.max(a,Math.min(c,u.width-t-a)),d=Math.max(a,Math.min(d,u.height-r-a))}else s==="right"?(c=e.right+o,d=e.top):s==="left"?(c=e.left-t-o,d=e.top):s==="bottom"?d=e.bottom+o:d=e.top-r-o,(s==="top"||s==="bottom")&&(n==="start"?c=e.left:n==="end"?c=e.right-t:c=e.left+e.width/2-t/2);let m,h;return d+r<=e.top?h=window.innerHeight-(d+r):m=d,{x:c,top:m,bottom:h}};function kn(e){const t=f.useRef(null);return f.useEffect(()=>{const r=n=>{t.current&&!t.current.contains(n.target)&&e()};return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r)}},[e]),t}function Nn(e,t={}){const{enabled:r=!0,events:n=["mousedown","touchstart"],excludeRefs:s=[]}=t,o=f.useRef(null);return f.useEffect(()=>{if(!r)return;const a=i=>{const u=i.target;o.current?.contains(u)||s.some(d=>d.current?.contains(u))||e()};return n.forEach(i=>{document.addEventListener(i,a)}),()=>{n.forEach(i=>{document.removeEventListener(i,a)})}},[e,r,n,s]),o}function ut(e,t,r=!0){f.useEffect(()=>{if(!r)return;const n=s=>{e.current&&!e.current.contains(s.target)&&t(s)};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[e,t,r])}function xr(e,{target:t=window,event:r="keydown",enabled:n}={}){const s=f.useRef(e);f.useEffect(()=>{s.current=e},[e]),f.useEffect(()=>{if(!n)return;const o=a=>{const i=a.key,u=s.current[i];u&&u(a)};return t.addEventListener(r,o),()=>{t.removeEventListener(r,o)}},[t,r,n])}const En="relative shrink-0 select-none transition outline-none duration-200 ease-out focus-visible:ring-border-brand-light flex items-center justify-center cursor-pointer",$n={xs:"text-xs px-1 gap-x-1 py-1",sm:"text-sm px-2.5 gap-x-1 py-1.5",mdsm:"text-sm px-3 gap-x-1.5 py-2.5",md:"text-base px-4 gap-x-1.5 py-2.5",lg:"text-base px-4 gap-x-1.5 py-3.5",picker:"text-base px-2 py-2 gap-x-1.5",iconXs:"text-xs p-1",iconSm:"text-sm p-2",iconMd:"text-base p-3",iconLg:"text-base p-4"},jn={all:"focus-visible:ring-1",desktop:"lg:focus-visible:ring-1",mobile:"focus-visible:ring-1 lg:focus-ring-0",none:""},Cn={light:"font-light",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},Sn={none:"rounded-none",1:"rounded-1",2:"rounded-2",3:"rounded-3",4:"rounded-4",5:"rounded-5",6:"rounded-6",7:"rounded-7",8:"rounded-8",9:"rounded-9",10:"rounded-10",11:"rounded-11",12:"rounded-12",full:"rounded-full"},Tn={transparent:"text-base-12 lg:hover:bg-base-4 focus-visible:ring-base-6",transparentinactive:"text-base-11 lg:hover:bg-base-4",brand:"bg-brand text-brand-text lg:hover:bg-brand-hover focus-visible:ring-base-6 border border-transparent",accent:"bg-accent text-accent-text lg:hover:bg-accent-hover",contrast:"bg-base-12 text-base-1 lg:hover:bg-base-11 focus-visible:ring-base-6",solid:"bg-base-3 dark-theme:bg-base-3 lg:hover:bg-base-4 border border-base-4 focus-visible:ring-base-5",solidhybrid:"border border-base-5 dark-theme:border-base-4 dark-theme:bg-base-3 lg:hover:bg-base-4 focus-visible:ring-base-6",outline:"border border-base-6 lg:hover:bg-base-3 focus-visible:ring-base-6",info:"bg-blue-3 text-blue-9 lg:hover:bg-blue-4 lg:active:bg-blue-5 focus-visible:ring-blue-9 border border-transparent",success:"bg-green-4 text-green-9 lg:hover:bg-green-5 lg:active:bg-green-6 focus-visible:ring-green-9 border border-transparent",warning:"bg-yellow-4 text-yellow-9 lg:hover:bg-yellow-5 lg:active:bg-yellow-6 focus-visible:ring-yellow-9 border border-transparent",danger:"bg-red-4 text-red-9 lg:hover:bg-red-5 focus-visible:ring-red-9 border border-transparent",dangersolid:"bg-red-9 text-base-1 dark-theme:text-base-12 lg:hover:bg-red-8 focus-visible:ring-base-6 border border-transparent",disabled:"bg-base-3 text-base-11 border border-transparent"},Mn={enabled:"",disabled:"opacity-75",loading:""},q=f.forwardRef(({color:e="transparent",size:t="mdsm",fontWeight:r="normal",rounded:n="6",state:s="enabled",onClick:o,className:a,children:i,withRipple:u=!0,contrastRipple:c,showFocus:d="desktop",withDisabledDelay:m=!1,type:h="button",...p},b)=>{const[v,x]=f.useState(!1),$=M=>{s==="enabled"&&(m?(x(!0),o&&o(M),setTimeout(()=>x(!1),1e3)):o&&o(M))},{ref:j,ripple:R}=gr(u,e==="contrast"||c),T=Dt(j,b);return l.jsx("button",{ref:T,type:h,disabled:p.disabled?p.disabled:s==="disabled"||s==="loading",onMouseDown:R,onClick:M=>v?null:$(M),className:k(En,$n[t],Cn[r],Sn[n],jn[d],Tn[e],Mn[s],p.disabled&&"opacity-50",a),...p,children:i})});q.displayName="Button";const wr=6048e5,Dn=864e5,Xt=Symbol.for("constructDateFrom");function se(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Xt in e?e[Xt](t):e instanceof Date?new e.constructor(t):new Date(t)}function Z(e,t){return se(t||e,e)}function Ze(e,t,r){const n=Z(e,r?.in);if(isNaN(t))return se(e,NaN);if(!t)return n;const s=n.getDate(),o=se(e,n.getTime());o.setMonth(n.getMonth()+t+1,0);const a=o.getDate();return s>=a?o:(n.setFullYear(o.getFullYear(),o.getMonth(),s),n)}let Pn={};function dt(){return Pn}function Ye(e,t){const r=dt(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=Z(e,t?.in),o=s.getDay(),a=(o<n?7:0)+o-n;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function tt(e,t){return Ye(e,{...t,weekStartsOn:1})}function yr(e,t){const r=Z(e,t?.in),n=r.getFullYear(),s=se(r,0);s.setFullYear(n+1,0,4),s.setHours(0,0,0,0);const o=tt(s),a=se(r,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const i=tt(a);return r.getTime()>=o.getTime()?n+1:r.getTime()>=i.getTime()?n:n-1}function Vt(e){const t=Z(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function ft(e,...t){const r=se.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}function rt(e,t){const r=Z(e,t?.in);return r.setHours(0,0,0,0),r}function On(e,t,r){const[n,s]=ft(r?.in,e,t),o=rt(n),a=rt(s),i=+o-Vt(o),u=+a-Vt(a);return Math.round((i-u)/Dn)}function Fn(e,t){const r=yr(e,t),n=se(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),tt(n)}function xt(e,t,r){const[n,s]=ft(r?.in,e,t);return+rt(n)==+rt(s)}function Ln(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Rn(e){return!(!Ln(e)&&typeof e!="number"||isNaN(+Z(e)))}function An(e,t){const r=Z(e,t?.in),n=r.getMonth();return r.setFullYear(r.getFullYear(),n+1,0),r.setHours(23,59,59,999),r}function Wn(e,t){const[r,n]=ft(e,t.start,t.end);return{start:r,end:n}}function _n(e,t){const{start:r,end:n}=Wn(t?.in,e);let s=+r>+n;const o=s?+r:+n,a=s?n:r;a.setHours(0,0,0,0);let i=1;const u=[];for(;+a<=o;)u.push(se(r,a)),a.setDate(a.getDate()+i),a.setHours(0,0,0,0);return s?u.reverse():u}function Yn(e,t){const r=Z(e,t?.in);return r.setDate(1),r.setHours(0,0,0,0),r}function In(e,t){const r=Z(e,t?.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}const zn={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Hn=(e,t,r)=>{let n;const s=zn[e];return typeof s=="string"?n=s:t===1?n=s.one:n=s.other.replace("{{count}}",t.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function Te(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const Bn={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},qn={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Xn={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Vn={date:Te({formats:Bn,defaultWidth:"full"}),time:Te({formats:qn,defaultWidth:"full"}),dateTime:Te({formats:Xn,defaultWidth:"full"})},Kn={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Un=(e,t,r,n)=>Kn[e];function ie(e){return(t,r)=>{const n=r?.context?String(r.context):"standalone";let s;if(n==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,i=r?.width?String(r.width):a;s=e.formattingValues[i]||e.formattingValues[a]}else{const a=e.defaultWidth,i=r?.width?String(r.width):e.defaultWidth;s=e.values[i]||e.values[a]}const o=e.argumentCallback?e.argumentCallback(t):t;return s[o]}}const Gn={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Qn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Jn={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Zn={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},es={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},ts={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},rs=(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},ns={ordinalNumber:rs,era:ie({values:Gn,defaultWidth:"wide"}),quarter:ie({values:Qn,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ie({values:Jn,defaultWidth:"wide"}),day:ie({values:Zn,defaultWidth:"wide"}),dayPeriod:ie({values:es,defaultWidth:"wide",formattingValues:ts,defaultFormattingWidth:"wide"})};function le(e){return(t,r={})=>{const n=r.width,s=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],o=t.match(s);if(!o)return null;const a=o[0],i=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(i)?os(i,m=>m.test(a)):ss(i,m=>m.test(a));let c;c=e.valueCallback?e.valueCallback(u):u,c=r.valueCallback?r.valueCallback(c):c;const d=t.slice(a.length);return{value:c,rest:d}}}function ss(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function os(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function kr(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const s=n[0],o=t.match(e.parsePattern);if(!o)return null;let a=e.valueCallback?e.valueCallback(o[0]):o[0];a=r.valueCallback?r.valueCallback(a):a;const i=t.slice(s.length);return{value:a,rest:i}}}const as=/^(\d+)(th|st|nd|rd)?/i,is=/\d+/i,ls={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},cs={any:[/^b/i,/^(a|c)/i]},us={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ds={any:[/1/i,/2/i,/3/i,/4/i]},fs={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},ms={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},hs={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},bs={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ps={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},gs={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},vs={ordinalNumber:kr({matchPattern:as,parsePattern:is,valueCallback:e=>parseInt(e,10)}),era:le({matchPatterns:ls,defaultMatchWidth:"wide",parsePatterns:cs,defaultParseWidth:"any"}),quarter:le({matchPatterns:us,defaultMatchWidth:"wide",parsePatterns:ds,defaultParseWidth:"any",valueCallback:e=>e+1}),month:le({matchPatterns:fs,defaultMatchWidth:"wide",parsePatterns:ms,defaultParseWidth:"any"}),day:le({matchPatterns:hs,defaultMatchWidth:"wide",parsePatterns:bs,defaultParseWidth:"any"}),dayPeriod:le({matchPatterns:ps,defaultMatchWidth:"any",parsePatterns:gs,defaultParseWidth:"any"})},Nr={code:"en-US",formatDistance:Hn,formatLong:Vn,formatRelative:Un,localize:ns,match:vs,options:{weekStartsOn:0,firstWeekContainsDate:1}};function xs(e,t){const r=Z(e,t?.in);return On(r,In(r))+1}function ws(e,t){const r=Z(e,t?.in),n=+tt(r)-+Fn(r);return Math.round(n/wr)+1}function Er(e,t){const r=Z(e,t?.in),n=r.getFullYear(),s=dt(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=se(t?.in||e,0);a.setFullYear(n+1,0,o),a.setHours(0,0,0,0);const i=Ye(a,t),u=se(t?.in||e,0);u.setFullYear(n,0,o),u.setHours(0,0,0,0);const c=Ye(u,t);return+r>=+i?n+1:+r>=+c?n:n-1}function ys(e,t){const r=dt(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=Er(e,t),o=se(t?.in||e,0);return o.setFullYear(s,0,n),o.setHours(0,0,0,0),Ye(o,t)}function ks(e,t){const r=Z(e,t?.in),n=+Ye(r,t)-+ys(r,t);return Math.round(n/wr)+1}function Y(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const he={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return Y(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):Y(r+1,2)},d(e,t){return Y(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return Y(e.getHours()%12||12,t.length)},H(e,t){return Y(e.getHours(),t.length)},m(e,t){return Y(e.getMinutes(),t.length)},s(e,t){return Y(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),s=Math.trunc(n*Math.pow(10,r-3));return Y(s,t.length)}},Ce={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Kt={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),s=n>0?n:1-n;return r.ordinalNumber(s,{unit:"year"})}return he.y(e,t)},Y:function(e,t,r,n){const s=Er(e,n),o=s>0?s:1-s;if(t==="YY"){const a=o%100;return Y(a,2)}return t==="Yo"?r.ordinalNumber(o,{unit:"year"}):Y(o,t.length)},R:function(e,t){const r=yr(e);return Y(r,t.length)},u:function(e,t){const r=e.getFullYear();return Y(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return Y(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return Y(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return he.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return Y(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const s=ks(e,n);return t==="wo"?r.ordinalNumber(s,{unit:"week"}):Y(s,t.length)},I:function(e,t,r){const n=ws(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):Y(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):he.d(e,t)},D:function(e,t,r){const n=xs(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):Y(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const s=e.getDay(),o=(s-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return Y(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const s=e.getDay(),o=(s-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return Y(o,t.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),s=n===0?7:n;switch(t){case"i":return String(s);case"ii":return Y(s,t.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let s;switch(n===12?s=Ce.noon:n===0?s=Ce.midnight:s=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let s;switch(n>=17?s=Ce.evening:n>=12?s=Ce.afternoon:n>=4?s=Ce.morning:s=Ce.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return he.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):he.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):Y(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):Y(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):he.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):he.s(e,t)},S:function(e,t){return he.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return Gt(n);case"XXXX":case"XX":return we(n);case"XXXXX":case"XXX":default:return we(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return Gt(n);case"xxxx":case"xx":return we(n);case"xxxxx":case"xxx":default:return we(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Ut(n,":");case"OOOO":default:return"GMT"+we(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Ut(n,":");case"zzzz":default:return"GMT"+we(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return Y(n,t.length)},T:function(e,t,r){return Y(+e,t.length)}};function Ut(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),s=Math.trunc(n/60),o=n%60;return o===0?r+String(s):r+String(s)+t+Y(o,2)}function Gt(e,t){return e%60===0?(e>0?"-":"+")+Y(Math.abs(e)/60,2):we(e,t)}function we(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),s=Y(Math.trunc(n/60),2),o=Y(n%60,2);return r+s+t+o}const Qt=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},$r=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Ns=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],s=r[2];if(!s)return Qt(e,t);let o;switch(n){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",Qt(n,t)).replace("{{time}}",$r(s,t))},Es={p:$r,P:Ns},$s=/^D+$/,js=/^Y+$/,Cs=["D","DD","YY","YYYY"];function Ss(e){return $s.test(e)}function Ts(e){return js.test(e)}function Ms(e,t,r){const n=Ds(e,t,r);if(console.warn(n),Cs.includes(e))throw new RangeError(n)}function Ds(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Ps=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Os=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Fs=/^'([^]*?)'?$/,Ls=/''/g,Rs=/[a-zA-Z]/;function Ne(e,t,r){const n=dt(),s=r?.locale??n.locale??Nr,o=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Z(e,r?.in);if(!Rn(i))throw new RangeError("Invalid time value");let u=t.match(Os).map(d=>{const m=d[0];if(m==="p"||m==="P"){const h=Es[m];return h(d,s.formatLong)}return d}).join("").match(Ps).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const m=d[0];if(m==="'")return{isToken:!1,value:As(d)};if(Kt[m])return{isToken:!0,value:d};if(m.match(Rs))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:d}});s.localize.preprocessor&&(u=s.localize.preprocessor(i,u));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:s};return u.map(d=>{if(!d.isToken)return d.value;const m=d.value;(!r?.useAdditionalWeekYearTokens&&Ts(m)||!r?.useAdditionalDayOfYearTokens&&Ss(m))&&Ms(m,t,String(e));const h=Kt[m[0]];return h(i,m,s.localize,c)}).join("")}function As(e){const t=e.match(Fs);return t?t[1].replace(Ls,"'"):e}function Jt(e,t,r){const[n,s]=ft(r?.in,e,t);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()}function wt(e,t,r){return Ze(e,-t,r)}const Ws={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},_s=(e,t,r)=>{let n;const s=Ws[e];return typeof s=="string"?n=s:t===1?n=s.one:n=s.other.replace("{{count}}",t.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"en "+n:"hace "+n:n},Ys={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},Is={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},zs={full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Hs={date:Te({formats:Ys,defaultWidth:"full"}),time:Te({formats:Is,defaultWidth:"full"}),dateTime:Te({formats:zs,defaultWidth:"full"})},Bs={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},qs={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},Xs=(e,t,r,n)=>t.getHours()!==1?qs[e]:Bs[e],Vs={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},Ks={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},Us={narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},Gs={narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},Qs={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},Js={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},Zs=(e,t)=>Number(e)+"º",eo={ordinalNumber:Zs,era:ie({values:Vs,defaultWidth:"wide"}),quarter:ie({values:Ks,defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:ie({values:Us,defaultWidth:"wide"}),day:ie({values:Gs,defaultWidth:"wide"}),dayPeriod:ie({values:Qs,defaultWidth:"wide",formattingValues:Js,defaultFormattingWidth:"wide"})},to=/^(\d+)(º)?/i,ro=/\d+/i,no={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},so={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},oo={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},ao={any:[/1/i,/2/i,/3/i,/4/i]},io={narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},lo={narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},co={narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},uo={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},fo={narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},mo={any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},ho={ordinalNumber:kr({matchPattern:to,parsePattern:ro,valueCallback:function(e){return parseInt(e,10)}}),era:le({matchPatterns:no,defaultMatchWidth:"wide",parsePatterns:so,defaultParseWidth:"any"}),quarter:le({matchPatterns:oo,defaultMatchWidth:"wide",parsePatterns:ao,defaultParseWidth:"any",valueCallback:e=>e+1}),month:le({matchPatterns:io,defaultMatchWidth:"wide",parsePatterns:lo,defaultParseWidth:"any"}),day:le({matchPatterns:co,defaultMatchWidth:"wide",parsePatterns:uo,defaultParseWidth:"any"}),dayPeriod:le({matchPatterns:fo,defaultMatchWidth:"any",parsePatterns:mo,defaultParseWidth:"any"})},Ie={code:"es",formatDistance:_s,formatLong:Hs,formatRelative:Xs,localize:eo,match:ho,options:{weekStartsOn:1,firstWeekContainsDate:1}},ce=typeof document<"u"?f.useLayoutEffect:()=>{},K=e=>{var t;return(t=e?.ownerDocument)!==null&&t!==void 0?t:document},nt=e=>e&&"window"in e&&e.window===e?e:K(e).defaultView||window;function bo(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function po(e){return bo(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let go=!1;function mt(){return go}function Zt(e,t){if(!mt())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let r=t;for(;r!==null;){if(r===e)return!0;r.tagName==="SLOT"&&r.assignedSlot?r=r.assignedSlot.parentNode:po(r)?r=r.host:r=r.parentNode}return!1}const ne=(e=document)=>{var t;if(!mt())return e.activeElement;let r=e.activeElement;for(;r&&"shadowRoot"in r&&(!((t=r.shadowRoot)===null||t===void 0)&&t.activeElement);)r=r.shadowRoot.activeElement;return r};function Se(e){return mt()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}class vo{get currentNode(){return this._currentNode}set currentNode(t){if(!Zt(this.root,t))throw new Error("Cannot set currentNode to a node that is not contained by the root node.");const r=[];let n=t,s=t;for(this._currentNode=t;n&&n!==this.root;)if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const a=n,i=this._doc.createTreeWalker(a,this.whatToShow,{acceptNode:this._acceptNode});r.push(i),i.currentNode=s,this._currentSetFor.add(i),n=s=a.host}else n=n.parentNode;const o=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});r.push(o),o.currentNode=s,this._currentSetFor.add(o),this._walkerStack=r}get doc(){return this._doc}firstChild(){let t=this.currentNode,r=this.nextNode();return Zt(t,r)?(r&&(this.currentNode=r),r):(this.currentNode=t,null)}lastChild(){let r=this._walkerStack[0].lastChild();return r&&(this.currentNode=r),r}nextNode(){const t=this._walkerStack[0].nextNode();if(t){if(t.shadowRoot){var r;let s;if(typeof this.filter=="function"?s=this.filter(t):!((r=this.filter)===null||r===void 0)&&r.acceptNode&&(s=this.filter.acceptNode(t)),s===NodeFilter.FILTER_ACCEPT)return this.currentNode=t,t;let o=this.nextNode();return o&&(this.currentNode=o),o}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let n=this.nextNode();return n&&(this.currentNode=n),n}else return null}previousNode(){const t=this._walkerStack[0];if(t.currentNode===t.root){if(this._currentSetFor.has(t))if(this._currentSetFor.delete(t),this._walkerStack.length>1){this._walkerStack.shift();let s=this.previousNode();return s&&(this.currentNode=s),s}else return null;return null}const r=t.previousNode();if(r){if(r.shadowRoot){var n;let o;if(typeof this.filter=="function"?o=this.filter(r):!((n=this.filter)===null||n===void 0)&&n.acceptNode&&(o=this.filter.acceptNode(r)),o===NodeFilter.FILTER_ACCEPT)return r&&(this.currentNode=r),r;let a=this.lastChild();return a&&(this.currentNode=a),a}return r&&(this.currentNode=r),r}else if(this._walkerStack.length>1){this._walkerStack.shift();let s=this.previousNode();return s&&(this.currentNode=s),s}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}constructor(t,r,n,s){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=a=>{if(a.nodeType===Node.ELEMENT_NODE){const u=a.shadowRoot;if(u){const c=this._doc.createTreeWalker(u,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(c),NodeFilter.FILTER_ACCEPT}else{var i;if(typeof this.filter=="function")return this.filter(a);if(!((i=this.filter)===null||i===void 0)&&i.acceptNode)return this.filter.acceptNode(a);if(this.filter===null)return NodeFilter.FILTER_ACCEPT}}return NodeFilter.FILTER_SKIP},this._doc=t,this.root=r,this.filter=s??null,this.whatToShow=n??NodeFilter.SHOW_ALL,this._currentNode=r,this._walkerStack.unshift(t.createTreeWalker(r,n,this._acceptNode));const o=r.shadowRoot;if(o){const a=this._doc.createTreeWalker(o,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(a)}}}function xo(e,t,r,n){return mt()?new vo(e,t,r,n):e.createTreeWalker(t,r,n)}function er(e){if(wo())e.focus({preventScroll:!0});else{let t=yo(e);e.focus(),ko(t)}}let Ge=null;function wo(){if(Ge==null){Ge=!1;try{document.createElement("div").focus({get preventScroll(){return Ge=!0,!0}})}catch{}}return Ge}function yo(e){let t=e.parentNode,r=[],n=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==n;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&r.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return n instanceof HTMLElement&&r.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),r}function ko(e){for(let{element:t,scrollTop:r,scrollLeft:n}of e)t.scrollTop=r,t.scrollLeft=n}function ht(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let r=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(r)&&r.some(n=>e.test(n.brand))||e.test(window.navigator.userAgent)}function Pt(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function me(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Ot=me(function(){return Pt(/^Mac/i)}),No=me(function(){return Pt(/^iPhone/i)}),Eo=me(function(){return Pt(/^iPad/i)||Ot()&&navigator.maxTouchPoints>1}),$o=me(function(){return No()||Eo()});me(function(){return Ot()||$o()});me(function(){return ht(/AppleWebKit/i)&&!jr()});const jr=me(function(){return ht(/Chrome/i)}),Cr=me(function(){return ht(/Android/i)});me(function(){return ht(/Firefox/i)});let pe=new Map,Nt=new Set;function tr(){if(typeof window>"u")return;function e(n){return"propertyName"in n}let t=n=>{if(!e(n)||!n.target)return;let s=pe.get(n.target);s||(s=new Set,pe.set(n.target,s),n.target.addEventListener("transitioncancel",r,{once:!0})),s.add(n.propertyName)},r=n=>{if(!e(n)||!n.target)return;let s=pe.get(n.target);if(s&&(s.delete(n.propertyName),s.size===0&&(n.target.removeEventListener("transitioncancel",r),pe.delete(n.target)),pe.size===0)){for(let o of Nt)o();Nt.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",r)}typeof document<"u"&&(document.readyState!=="loading"?tr():document.addEventListener("DOMContentLoaded",tr));function jo(){for(const[e]of pe)"isConnected"in e&&!e.isConnected&&pe.delete(e)}function Co(e){requestAnimationFrame(()=>{jo(),pe.size===0?e():Nt.add(e)})}function So(e){return e.pointerType===""&&e.isTrusted?!0:Cr()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}const To=typeof Element<"u"&&"checkVisibility"in Element.prototype;function Mo(e){const t=nt(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:r,visibility:n}=e.style,s=r!=="none"&&n!=="hidden"&&n!=="collapse";if(s){const{getComputedStyle:o}=e.ownerDocument.defaultView;let{display:a,visibility:i}=o(e);s=a!=="none"&&i!=="hidden"&&i!=="collapse"}return s}function Do(e,t){return!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&(e.nodeName==="DETAILS"&&t&&t.nodeName!=="SUMMARY"?e.hasAttribute("open"):!0)}function Ft(e,t){return To?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&Mo(e)&&Do(e,t)&&(!e.parentElement||Ft(e.parentElement,e))}const Lt=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable^="false"])',"permission"],Po=Lt.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Lt.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const Oo=Lt.join(':not([hidden]):not([tabindex="-1"]),');function Fo(e){return e.matches(Po)&&Ft(e)&&!Sr(e)}function Lo(e){return e.matches(Oo)&&Ft(e)&&!Sr(e)}function Sr(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}let Ro=!1,qe=null,Ao=new Set,We=new Map,Ee=!1,Et=!1;function Rt(e,t){for(let r of Ao)r(e,t)}function Wo(e){return!(e.metaKey||!Ot()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function st(e){Ee=!0,Wo(e)&&(qe="keyboard",Rt("keyboard",e))}function ee(e){qe="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Ee=!0,Rt("pointer",e))}function Tr(e){So(e)&&(Ee=!0,qe="virtual")}function Mr(e){e.target===window||e.target===document||Ro||!e.isTrusted||(!Ee&&!Et&&(qe="virtual",Rt("virtual",e)),Ee=!1,Et=!1)}function Dr(){Ee=!1,Et=!0}function rr(e){if(typeof window>"u"||typeof document>"u"||We.get(nt(e)))return;const t=nt(e),r=K(e);let n=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Ee=!0,n.apply(this,arguments)},r.addEventListener("keydown",st,!0),r.addEventListener("keyup",st,!0),r.addEventListener("click",Tr,!0),t.addEventListener("focus",Mr,!0),t.addEventListener("blur",Dr,!1),typeof PointerEvent<"u"?(r.addEventListener("pointerdown",ee,!0),r.addEventListener("pointermove",ee,!0),r.addEventListener("pointerup",ee,!0)):process.env.NODE_ENV==="test"&&(r.addEventListener("mousedown",ee,!0),r.addEventListener("mousemove",ee,!0),r.addEventListener("mouseup",ee,!0)),t.addEventListener("beforeunload",()=>{Pr(e)},{once:!0}),We.set(t,{focus:n})}const Pr=(e,t)=>{const r=nt(e),n=K(e);t&&n.removeEventListener("DOMContentLoaded",t),We.has(r)&&(r.HTMLElement.prototype.focus=We.get(r).focus,n.removeEventListener("keydown",st,!0),n.removeEventListener("keyup",st,!0),n.removeEventListener("click",Tr,!0),r.removeEventListener("focus",Mr,!0),r.removeEventListener("blur",Dr,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",ee,!0),n.removeEventListener("pointermove",ee,!0),n.removeEventListener("pointerup",ee,!0)):process.env.NODE_ENV==="test"&&(n.removeEventListener("mousedown",ee,!0),n.removeEventListener("mousemove",ee,!0),n.removeEventListener("mouseup",ee,!0)),We.delete(r))};function _o(e){const t=K(e);let r;return t.readyState!=="loading"?rr(e):(r=()=>{rr(e)},t.addEventListener("DOMContentLoaded",r)),()=>Pr(e,r)}typeof document<"u"&&_o();function Or(){return qe}function Yo(e){const t=K(e),r=ne(t);if(Or()==="virtual"){let n=r;Co(()=>{ne(t)===n&&e.isConnected&&er(e)})}else er(e)}const nr=f.createContext(null),$t="react-aria-focus-scope-restore";let z=null;function Io(e){let{children:t,contain:r,restoreFocus:n,autoFocus:s}=e,o=f.useRef(null),a=f.useRef(null),i=f.useRef([]),{parentNode:u}=f.useContext(nr)||{},c=f.useMemo(()=>new Ct({scopeRef:i}),[i]);ce(()=>{let h=u||B.root;if(B.getTreeNode(h.scopeRef)&&z&&!ot(z,h.scopeRef)){let p=B.getTreeNode(z);p&&(h=p)}h.addChild(c),B.addNode(c)},[c,u]),ce(()=>{let h=B.getTreeNode(i);h&&(h.contain=!!r)},[r]),ce(()=>{var h;let p=(h=o.current)===null||h===void 0?void 0:h.nextSibling,b=[],v=x=>x.stopPropagation();for(;p&&p!==a.current;)b.push(p),p.addEventListener($t,v),p=p.nextSibling;return i.current=b,()=>{for(let x of b)x.removeEventListener($t,v)}},[t]),Xo(i,n,r),Bo(i,r),Vo(i,n,r),qo(i,s),f.useEffect(()=>{const h=ne(K(i.current?i.current[0]:void 0));let p=null;if(te(h,i.current)){for(let b of B.traverse())b.scopeRef&&te(h,b.scopeRef.current)&&(p=b);p===B.getTreeNode(i)&&(z=p.scopeRef)}},[i]),ce(()=>()=>{var h,p,b;let v=(b=(p=B.getTreeNode(i))===null||p===void 0||(h=p.parent)===null||h===void 0?void 0:h.scopeRef)!==null&&b!==void 0?b:null;(i===z||ot(i,z))&&(!v||B.getTreeNode(v))&&(z=v),B.removeTreeNode(i)},[i]);let d=f.useMemo(()=>zo(i),[]),m=f.useMemo(()=>({focusManager:d,parentNode:c}),[c,d]);return f.createElement(nr.Provider,{value:m},f.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,f.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:a}))}function zo(e){return{focusNext(t={}){let r=e.current,{from:n,tabbable:s,wrap:o,accept:a}=t;var i;let u=n||ne(K((i=r[0])!==null&&i!==void 0?i:void 0)),c=r[0].previousElementSibling,d=ye(r),m=ge(d,{tabbable:s,accept:a},r);m.currentNode=te(u,r)?u:c;let h=m.nextNode();return!h&&o&&(m.currentNode=c,h=m.nextNode()),h&&de(h,!0),h},focusPrevious(t={}){let r=e.current,{from:n,tabbable:s,wrap:o,accept:a}=t;var i;let u=n||ne(K((i=r[0])!==null&&i!==void 0?i:void 0)),c=r[r.length-1].nextElementSibling,d=ye(r),m=ge(d,{tabbable:s,accept:a},r);m.currentNode=te(u,r)?u:c;let h=m.previousNode();return!h&&o&&(m.currentNode=c,h=m.previousNode()),h&&de(h,!0),h},focusFirst(t={}){let r=e.current,{tabbable:n,accept:s}=t,o=ye(r),a=ge(o,{tabbable:n,accept:s},r);a.currentNode=r[0].previousElementSibling;let i=a.nextNode();return i&&de(i,!0),i},focusLast(t={}){let r=e.current,{tabbable:n,accept:s}=t,o=ye(r),a=ge(o,{tabbable:n,accept:s},r);a.currentNode=r[r.length-1].nextElementSibling;let i=a.previousNode();return i&&de(i,!0),i}}}function ye(e){return e[0].parentElement}function Re(e){let t=B.getTreeNode(z);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function Ho(e){if(e.checked)return!0;let t=[];if(!e.form)t=[...K(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)].filter(o=>!o.form);else{var r,n;let o=(n=e.form)===null||n===void 0||(r=n.elements)===null||r===void 0?void 0:r.namedItem(e.name);t=[...o??[]]}return t?!t.some(o=>o.checked):!1}function Bo(e,t){let r=f.useRef(void 0),n=f.useRef(void 0);ce(()=>{let s=e.current;if(!t){n.current&&(cancelAnimationFrame(n.current),n.current=void 0);return}const o=K(s?s[0]:void 0);let a=c=>{if(c.key!=="Tab"||c.altKey||c.ctrlKey||c.metaKey||!Re(e)||c.isComposing)return;let d=ne(o),m=e.current;if(!m||!te(d,m))return;let h=ye(m),p=ge(h,{tabbable:!0},m);if(!d)return;p.currentNode=d;let b=c.shiftKey?p.previousNode():p.nextNode();b||(p.currentNode=c.shiftKey?m[m.length-1].nextElementSibling:m[0].previousElementSibling,b=c.shiftKey?p.previousNode():p.nextNode()),c.preventDefault(),b&&de(b,!0)},i=c=>{(!z||ot(z,e))&&te(Se(c),e.current)?(z=e,r.current=Se(c)):Re(e)&&!ke(Se(c),e)?r.current?r.current.focus():z&&z.current&&jt(z.current):Re(e)&&(r.current=Se(c))},u=c=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{let d=Or(),m=(d==="virtual"||d===null)&&Cr()&&jr(),h=ne(o);if(!m&&h&&Re(e)&&!ke(h,e)){z=e;let b=Se(c);if(b&&b.isConnected){var p;r.current=b,(p=r.current)===null||p===void 0||p.focus()}else z.current&&jt(z.current)}})};return o.addEventListener("keydown",a,!1),o.addEventListener("focusin",i,!1),s?.forEach(c=>c.addEventListener("focusin",i,!1)),s?.forEach(c=>c.addEventListener("focusout",u,!1)),()=>{o.removeEventListener("keydown",a,!1),o.removeEventListener("focusin",i,!1),s?.forEach(c=>c.removeEventListener("focusin",i,!1)),s?.forEach(c=>c.removeEventListener("focusout",u,!1))}},[e,t]),ce(()=>()=>{n.current&&cancelAnimationFrame(n.current)},[n])}function Fr(e){return ke(e)}function te(e,t){return!e||!t?!1:t.some(r=>r.contains(e))}function ke(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:r}of B.traverse(B.getTreeNode(t)))if(r&&te(e,r.current))return!0;return!1}function ot(e,t){var r;let n=(r=B.getTreeNode(t))===null||r===void 0?void 0:r.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function de(e,t=!1){if(e!=null&&!t)try{Yo(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function Lr(e,t=!0){let r=e[0].previousElementSibling,n=ye(e),s=ge(n,{tabbable:t},e);s.currentNode=r;let o=s.nextNode();return t&&!o&&(n=ye(e),s=ge(n,{tabbable:!1},e),s.currentNode=r,o=s.nextNode()),o}function jt(e,t=!0){de(Lr(e,t))}function qo(e,t){const r=f.useRef(t);f.useEffect(()=>{if(r.current){z=e;const n=K(e.current?e.current[0]:void 0);!te(ne(n),z.current)&&e.current&&jt(e.current)}r.current=!1},[e])}function Xo(e,t,r){ce(()=>{if(t||r)return;let n=e.current;const s=K(n?n[0]:void 0);let o=a=>{let i=Se(a);te(i,e.current)?z=e:Fr(i)||(z=null)};return s.addEventListener("focusin",o,!1),n?.forEach(a=>a.addEventListener("focusin",o,!1)),()=>{s.removeEventListener("focusin",o,!1),n?.forEach(a=>a.removeEventListener("focusin",o,!1))}},[e,t,r])}function sr(e){let t=B.getTreeNode(z);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Vo(e,t,r){const n=f.useRef(typeof document<"u"?ne(K(e.current?e.current[0]:void 0)):null);ce(()=>{let s=e.current;const o=K(s?s[0]:void 0);if(!t||r)return;let a=()=>{(!z||ot(z,e))&&te(ne(o),e.current)&&(z=e)};return o.addEventListener("focusin",a,!1),s?.forEach(i=>i.addEventListener("focusin",a,!1)),()=>{o.removeEventListener("focusin",a,!1),s?.forEach(i=>i.removeEventListener("focusin",a,!1))}},[e,r]),ce(()=>{const s=K(e.current?e.current[0]:void 0);if(!t)return;let o=a=>{if(a.key!=="Tab"||a.altKey||a.ctrlKey||a.metaKey||!Re(e)||a.isComposing)return;let i=s.activeElement;if(!ke(i,e)||!sr(e))return;let u=B.getTreeNode(e);if(!u)return;let c=u.nodeToRestore,d=ge(s.body,{tabbable:!0});d.currentNode=i;let m=a.shiftKey?d.previousNode():d.nextNode();if((!c||!c.isConnected||c===s.body)&&(c=void 0,u.nodeToRestore=void 0),(!m||!ke(m,e))&&c){d.currentNode=c;do m=a.shiftKey?d.previousNode():d.nextNode();while(ke(m,e));a.preventDefault(),a.stopPropagation(),m?de(m,!0):Fr(c)?de(c,!0):i.blur()}};return r||s.addEventListener("keydown",o,!0),()=>{r||s.removeEventListener("keydown",o,!0)}},[e,t,r]),ce(()=>{const s=K(e.current?e.current[0]:void 0);if(!t)return;let o=B.getTreeNode(e);if(o){var a;return o.nodeToRestore=(a=n.current)!==null&&a!==void 0?a:void 0,()=>{let i=B.getTreeNode(e);if(!i)return;let u=i.nodeToRestore,c=ne(s);if(t&&u&&(c&&ke(c,e)||c===s.body&&sr(e))){let d=B.clone();requestAnimationFrame(()=>{if(s.activeElement===s.body){let m=d.getTreeNode(e);for(;m;){if(m.nodeToRestore&&m.nodeToRestore.isConnected){or(m.nodeToRestore);return}m=m.parent}for(m=d.getTreeNode(e);m;){if(m.scopeRef&&m.scopeRef.current&&B.getTreeNode(m.scopeRef)){let h=Lr(m.scopeRef.current,!0);or(h);return}m=m.parent}}})}}}},[e,t])}function or(e){e.dispatchEvent(new CustomEvent($t,{bubbles:!0,cancelable:!0}))&&de(e)}function ge(e,t,r){let n=t?.tabbable?Lo:Fo,s=e?.nodeType===Node.ELEMENT_NODE?e:null,o=K(s),a=xo(o,e||o,NodeFilter.SHOW_ELEMENT,{acceptNode(i){var u;return!(t==null||(u=t.from)===null||u===void 0)&&u.contains(i)||t?.tabbable&&i.tagName==="INPUT"&&i.getAttribute("type")==="radio"&&(!Ho(i)||a.currentNode.tagName==="INPUT"&&a.currentNode.type==="radio"&&a.currentNode.name===i.name)?NodeFilter.FILTER_REJECT:n(i)&&(!r||te(i,r))&&(!t?.accept||t.accept(i))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(a.currentNode=t.from),a}class At{get size(){return this.fastMap.size}getTreeNode(t){return this.fastMap.get(t)}addTreeNode(t,r,n){let s=this.fastMap.get(r??null);if(!s)return;let o=new Ct({scopeRef:t});s.addChild(o),o.parent=s,this.fastMap.set(t,o),n&&(o.nodeToRestore=n)}addNode(t){this.fastMap.set(t.scopeRef,t)}removeTreeNode(t){if(t===null)return;let r=this.fastMap.get(t);if(!r)return;let n=r.parent;for(let o of this.traverse())o!==r&&r.nodeToRestore&&o.nodeToRestore&&r.scopeRef&&r.scopeRef.current&&te(o.nodeToRestore,r.scopeRef.current)&&(o.nodeToRestore=r.nodeToRestore);let s=r.children;n&&(n.removeChild(r),s.size>0&&s.forEach(o=>n&&n.addChild(o))),this.fastMap.delete(r.scopeRef)}*traverse(t=this.root){if(t.scopeRef!=null&&(yield t),t.children.size>0)for(let r of t.children)yield*this.traverse(r)}clone(){var t;let r=new At;var n;for(let s of this.traverse())r.addTreeNode(s.scopeRef,(n=(t=s.parent)===null||t===void 0?void 0:t.scopeRef)!==null&&n!==void 0?n:null,s.nodeToRestore);return r}constructor(){this.fastMap=new Map,this.root=new Ct({scopeRef:null}),this.fastMap.set(null,this.root)}}class Ct{addChild(t){this.children.add(t),t.parent=this}removeChild(t){this.children.delete(t),t.parent=void 0}constructor(t){this.children=new Set,this.contain=!1,this.scopeRef=t.scopeRef}}let B=new At;const Fe=({children:e,node:t})=>dr.createPortal(e,t??document.body),Rr=({children:e,customTrigger:t,triggerContent:r,align:n="start",side:s="bottom",offset:o=8,className:a,triggerClassName:i,closeOnEscape:u=!0,closeOnClickAway:c=!0,scrollerId:d,onOpen:m,onClose:h,maxHeight:p="400px",minWidth:b="200px",maxWidth:v="500px"})=>{const{triggerRef:x,triggerProps:$,popoverRef:j,getPopoverPosition:R,open:T,toggle:M,close:y}=ct({align:n,side:s,offset:o,scrollerId:d,onOpen:()=>{m?.()},onClose:()=>{h?.()}});xr({Escape:P=>{u&&(P.preventDefault(),y(),x.current?.focus())}},{enabled:T}),ut(j,P=>{!c||!x.current||!T||!P.target||x.current.contains(P.target)||y()});const N=R();return l.jsxs(l.Fragment,{children:[t?t({triggerRef:x,triggerProps:$,toggle:M,open:T,close:y}):l.jsx("button",{ref:x,...$,onClick:M,className:k("outline-none p-2 rounded-md transition-colors","hover:bg-base-3 focus-visible:bg-base-3 focus-visible:ring-2 focus-visible:ring-brand",i),children:r}),l.jsx(L.AnimatePresence,{children:T&&l.jsx(Fe,{children:l.jsx(Io,{contain:!0,restoreFocus:!0,autoFocus:!0,children:l.jsx(L.motion.div,{initial:{opacity:0,scale:.95,y:s==="bottom"?-10:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:s==="bottom"?-10:10},transition:{type:"spring",duration:.2,bounce:.1},ref:j,style:{position:"fixed",left:N.x,top:N.top,bottom:N.bottom,maxHeight:typeof p=="number"?`${p}px`:p,minWidth:typeof b=="number"?`${b}px`:b,maxWidth:typeof v=="number"?`${v}px`:v,zIndex:1e3},className:k("bg-base-1 dark-theme:bg-base-2","border border-base-4 rounded-6","customscrollbar overflow-auto",a),children:typeof e=="function"?e(M):e})})})})]})},Ko=({title:e,subtitle:t,onClose:r,className:n})=>l.jsx("div",{className:k("p-4 border-b border-base-4",n),children:l.jsxs("div",{className:"flex items-start justify-between",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"font-semibold text-base-12",children:e}),t&&l.jsx("p",{className:"text-sm text-base-11 mt-1",children:t})]}),r&&l.jsx("button",{onClick:r,className:"ml-4 text-base-11 hover:text-base-12 transition-colors",children:"×"})]})}),Uo=({children:e,className:t})=>l.jsx("div",{className:k("p-4",t),children:e}),Go=({children:e,className:t})=>l.jsx("div",{className:k("p-4 border-t border-base-4",t),children:e}),Qo=(e,t)=>{const r=new Date(2023,0,1),n=[];for(let s=0;s<7;s++){const o=new Date(r);o.setDate(r.getDate()+s),n.push(Ne(o,"EEE",{locale:e??Nr}))}return t?[...n.slice(1),n[0]]:n},Wt=({selectedDate:e,onDateSelect:t,disabledDates:r,disabledDaysOfWeek:n,minDate:s,maxDate:o,locale:a,weekStartsOnMonday:i=!0,className:u=""})=>{const[c,d]=f.useState(e||new Date),[m,h]=f.useState(e||new Date),p=f.useRef(null),b=f.useMemo(()=>r?new Set(r.map(y=>new Date(y).toDateString())):new Set,[r]),v=f.useMemo(()=>new Set(n||[]),[n]),x=f.useMemo(()=>{const y=Yn(c),N=An(c),P=new Date(y),A=new Date(N);if(i){const E=y.getDay(),g=E===0?6:E-1;P.setDate(y.getDate()-g);const S=N.getDay(),C=S===0?0:7-S;A.setDate(N.getDate()+C)}else P.setDate(y.getDate()-y.getDay()),A.setDate(N.getDate()+(6-N.getDay()));return _n({start:P,end:A})},[c,i]),$=f.useMemo(()=>Qo(a??Ie,i),[a,i]),j=y=>{const N=y.toDateString(),P=y.getDay();return!(b.has(N)||v.has(P)||s&&y<s||o&&y>o)},R=y=>{j(y)&&t&&t(y),h(y)},T=y=>{if(!m)return;let N=new Date(m),P=!0,A,E;switch(y.key){case"ArrowUp":N.setDate(N.getDate()-7);break;case"ArrowDown":N.setDate(N.getDate()+7);break;case"ArrowLeft":N.setDate(N.getDate()-1);break;case"ArrowRight":N.setDate(N.getDate()+1);break;case"Home":A=N.getDay(),N.setDate(N.getDate()-A);break;case"End":E=N.getDay(),N.setDate(N.getDate()+(6-E));break;case"PageUp":N=y.shiftKey?wt(N,12):wt(N,1);break;case"PageDown":N=y.shiftKey?Ze(N,12):Ze(N,1);break;case"Enter":case" ":j(m)&&t&&t(m);break;default:P=!1}P&&(y.preventDefault(),N.getTime()!==m.getTime()&&(h(N),Jt(N,c)||d(N)))},M=y=>{d(N=>y==="prev"?wt(N,1):Ze(N,1))};return l.jsxs("div",{ref:p,className:k("dark-theme:bg-base-3 border border-base-5 dark-theme:border-base-4 rounded-6 px-4 pt-3 pb-4 w-full lg:w-80",u),onKeyDown:T,tabIndex:0,role:"grid","aria-label":"Calendar",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(q,{onClick:()=>M("prev"),size:"iconSm","aria-label":"Previous month",children:l.jsx(I.ChevronLeft,{size:16})}),l.jsx("h2",{className:"text-sm font-medium",children:Ne(c,"MMMM yyyy")}),l.jsx(q,{onClick:()=>M("next"),size:"iconSm","aria-label":"Next month",children:l.jsx(I.ChevronRight,{size:16})})]}),l.jsx("div",{className:"grid grid-cols-7 gap-1 mt-4",role:"row",children:$.map(y=>l.jsx("div",{className:"text-xs flex items-center w-8 justify-center text-base-11",role:"columnheader",children:y},y))}),l.jsx("div",{className:"grid grid-cols-7 gap-1 mt-4",role:"grid",children:x.map((y,N)=>{const P=Jt(y,c),A=e?xt(y,e):!1,E=m&&xt(y,m),g=j(y),S=xt(y,new Date);return l.jsx("button",{onClick:()=>R(y),disabled:!g,tabIndex:E?0:-1,role:"gridcell","aria-label":`${y.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}${A?", selected":""}${g?"":", disabled"}`,"aria-selected":A,"aria-disabled":!g,className:k("h-8 w-8 flex items-center outline-none justify-center rounded-6 hover:bg-base-4 text-sm relative",P?A?"bg-brand text-brand-text hover:bg-brand":S?"text-base-12 ring-1 ring-base-8":"text-base-12":"text-base-9",E&&"ring-1 ring-base-6",(!g||!P)&&"pointer-events-none text-base-9"),children:Ne(y,"d")},N)})})]})},Jo=()=>{const[e,t]=f.useState(new Date(2025,8,21)),r=["2025-09-13T00:00:00Z","2025-09-15T00:00:00Z"],n=[0,6];return l.jsx("div",{className:"p-8 bg-gray-100 min-h-screen",children:l.jsxs("div",{className:"max-w-md mx-auto",children:[l.jsx("h1",{className:"text-2xl font-bold mb-6 text-gray-800",children:"Calendar Date Picker Demo"}),l.jsx("div",{className:"mb-6",children:l.jsx(Wt,{selectedDate:e,onDateSelect:t,disabledDates:r,disabledDaysOfWeek:n,minDate:new Date(2025,8,1),maxDate:new Date(2025,11,31)})}),e&&l.jsxs("div",{className:"bg-white p-4 rounded-lg shadow",children:[l.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Selected Date:"}),l.jsx("p",{className:"text-gray-600",children:e.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),l.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["ISO: ",e.toISOString()]})]}),l.jsxs("div",{className:"mt-6 bg-white p-4 rounded-lg shadow",children:[l.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Keyboard Navigation:"}),l.jsxs("div",{className:"text-sm text-gray-600 space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Arrow Keys:"})," Navigate between dates"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Enter/Space:"})," Select focused date"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Home/End:"})," Go to start/end of week"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Page Up/Down:"})," Previous/next month"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Shift + Page Up/Down:"})," Previous/next year"]})]})]}),l.jsxs("div",{className:"mt-4 bg-white p-4 rounded-lg shadow",children:[l.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Features:"}),l.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[l.jsx("li",{children:"✅ All dates enabled by default"}),l.jsx("li",{children:"✅ Disable specific dates (PostgreSQL ISO strings)"}),l.jsx("li",{children:"✅ Disable entire days of week (e.g., weekends)"}),l.jsx("li",{children:"✅ Min/max date constraints"}),l.jsx("li",{children:"✅ Full keyboard navigation with arrow keys"}),l.jsx("li",{children:"✅ Focus management and accessibility"})]})]})]})})};function Zo({customTrigger:e,scrollerId:t}){const[r,n]=f.useState(new Date);return l.jsx(Rr,{className:"p-0",scrollerId:t,customTrigger:({toggle:s,triggerRef:o})=>e?e(s,o):l.jsxs(q,{ref:o,onClick:s,color:"solid",className:"px-3 mt-1 w-full justify-start",children:[Ne(new Date,"PP",{locale:Ie}),l.jsx("span",{className:"grow"}),l.jsx(I.CalendarDays,{size:18,className:"text-base-11"})]}),children:s=>l.jsx(Wt,{selectedDate:r,onDateSelect:o=>{n(o),s()},className:"border-none",disabledDaysOfWeek:[0,6]})})}const ea=()=>l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Time"}),l.jsxs(q,{color:"solid",className:"px-3 mt-1",children:[Ne(new Date,"p",{locale:Ie}),l.jsx("span",{className:"grow"}),l.jsx(I.Clock,{size:18,className:"text-base-11"})]})]}),ta=()=>l.jsxs("div",{className:"flex items-center gap-x-4",children:[l.jsxs("div",{className:"grow",children:[l.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Date"}),l.jsxs(q,{color:"solid",className:"px-3 mt-1 w-full justify-start",children:[Ne(new Date,"PP",{locale:Ie}),l.jsx("span",{className:"grow"}),l.jsx(I.CalendarDays,{size:18,className:"text-base-11"})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Time"}),l.jsxs(q,{color:"solid",className:"px-3 mt-1",children:[Ne(new Date,"p",{locale:Ie}),l.jsx("span",{className:"grow"}),l.jsx(I.Clock,{size:18,className:"text-base-11"})]})]})]}),Qe={unchecked:"bg-base-3 lg:hover:bg-base-4",checked:"bg-brand lg:hover:bg-brand-hover text-brand-text",uncheckedDisabled:"bg-base-3 border-base-4",checkedDisabled:"bg-base-3 border-base-4 text-base-10"},Ar=f.forwardRef(({checked:e=!1,onCheckedChange:t,disabled:r=!1,required:n=!1,name:s,value:o,id:a,className:i="",size:u="sm",...c},d)=>{const m=()=>{r||t?.(e==="indeterminate"?!0:!e)},h=v=>{(v.key===" "||v.key==="Enter")&&(v.preventDefault(),m())},p={xs:"h-3.5 w-3.5",sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},b={xs:24,sm:12,md:14,lg:16};return l.jsxs(l.Fragment,{children:[l.jsxs("button",{ref:d,type:"button",role:"checkbox","aria-checked":e==="indeterminate"?"mixed":e,"aria-required":n,disabled:r,onClick:m,onKeyDown:h,className:k("inline-flex items-center justify-center rounded-2 border border-base-4 transition-all duration-200 ease-in-out","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-base-5",p[u],r&&"cursor-not-allowed opacity-75",!r&&"cursor-pointer",e?r?Qe.checkedDisabled:Qe.checked:r?Qe.uncheckedDisabled:Qe.unchecked,typeof i=="function"?i(e):i),...c,children:[e===!0&&l.jsx(I.Check,{size:b[u],className:"stroke-current"}),e==="indeterminate"&&l.jsx(I.Minus,{size:b[u],className:"stroke-current"})]}),l.jsx("input",{type:"checkbox",name:s,value:o,checked:e===!0,onChange:()=>{},disabled:r,required:n,id:a,className:"sr-only",tabIndex:-1})]})});Ar.displayName="Checkbox";const ra=({title:e,message:t,searchParam:r,condition:n=!0,cancelLabel:s,confirmLabel:o,confirmColor:a="contrast",confirmAction:i,trigger:u})=>{const{searchParams:c}=ue.useSearchParams(),d=f.useMemo(()=>!!c[r],[c]),m=f.useCallback(()=>{ue.navigate.to(`${window.location.pathname}?${r}=open`)},[r]);return l.jsxs(l.Fragment,{children:[l.jsx(L.AnimatePresence,{initial:!1,children:d&&n?l.jsxs(Fe,{node:document&&document.getElementById("modals"),children:[l.jsx(L.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed top-0 left-0 z-[999] h-full w-full bg-black/50"}),l.jsxs(L.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed top-1/2 left-1/2 z-[999] w-[75%] -translate-y-1/2 -translate-x-1/2 rounded-lg bg-base-2 p-4 lg:w-[35%] xl:w-[30%]",children:[e?l.jsx("p",{className:"font-medium",children:e}):null,t?l.jsx("p",{className:k("text-sm text-base-11",{"mt-2":e}),children:t}):null,l.jsxs("div",{className:"flex justify-end gap-x-4 pt-4",children:[l.jsx(q,{onClick:()=>ue.navigate.back(),color:"transparentinactive",size:"sm",children:s??"Cancelar"}),l.jsx(q,{size:"sm",onClick:()=>{i&&i(),ue.navigate.back()},color:a,children:o??"Continuar"})]})]})]}):null}),u?u(m):null]})},na=({scrollY:e,height:t=300,className:r,children:n})=>{const s=L.useTransform(e,a=>a<0?1+Math.abs(a)/t:1),o=L.useTransform(e,a=>a<0?-Math.abs(a)/2:0);return l.jsx(L.motion.div,{style:{scale:s,y:o,height:t},className:r,children:n})};function Wr(e,t,r){function n(i,u){var c;Object.defineProperty(i,"_zod",{value:i._zod??{},enumerable:!1}),(c=i._zod).traits??(c.traits=new Set),i._zod.traits.add(e),t(i,u);for(const d in a.prototype)d in i||Object.defineProperty(i,d,{value:a.prototype[d].bind(i)});i._zod.constr=a,i._zod.def=u}const s=r?.Parent??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function a(i){var u;const c=r?.Parent?new o:this;n(c,i),(u=c._zod).deferred??(u.deferred=[]);for(const d of c._zod.deferred)d();return c}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:i=>r?.Parent&&i instanceof r.Parent?!0:i?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class sa extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const oa={};function _r(e){return oa}function aa(e,t){return typeof t=="bigint"?t.toString():t}const Yr=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Je(e){return typeof e=="string"?e:e?.message}function Ir(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const s=Je(e.inst?._zod.def?.error?.(e))??Je(t?.error?.(e))??Je(r.customError?.(e))??Je(r.localeError?.(e))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}const zr=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,aa,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ia=Wr("$ZodError",zr),Hr=Wr("$ZodError",zr,{Parent:Error}),la=e=>(t,r,n,s)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new sa;if(a.issues.length){const i=new(s?.Err??e)(a.issues.map(u=>Ir(u,o,_r())));throw Yr(i,s?.callee),i}return a.value},ca=la(Hr),ua=e=>async(t,r,n,s)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const i=new(s?.Err??e)(a.issues.map(u=>Ir(u,o,_r())));throw Yr(i,s?.callee),i}return a.value},da=ua(Hr);function ar(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function fa(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,a=n.path.join(".");if(!r[a])if("unionErrors"in n){var i=n.unionErrors[0].errors[0];r[a]={message:i.message,type:i.code}}else r[a]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(m){return e.push(m)})}),t){var u=r[a].types,c=u&&u[n.code];r[a]=J.appendErrors(a,t,r,s,c?[].concat(c,n.message):n.message)}e.shift()}return r}function ma(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,a=n.path.join(".");if(!r[a])if(n.code==="invalid_union"&&n.errors.length>0){var i=n.errors[0][0];r[a]={message:i.message,type:i.code}}else r[a]={message:o,type:s};if(n.code==="invalid_union"&&n.errors.forEach(function(d){return d.forEach(function(m){return e.push(m)})}),t){var u=r[a].types,c=u&&u[n.code];r[a]=J.appendErrors(a,t,r,s,c?[].concat(c,n.message):n.message)}e.shift()}return r}function ha(e,t,r){if(r===void 0&&(r={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,s,o){try{return Promise.resolve(ar(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(a){return o.shouldUseNativeValidation&&Ue.validateFieldsNatively({},o),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(i){return Array.isArray(i?.issues)})(a))return{values:{},errors:Ue.toNestErrors(fa(a.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw a}))}catch(a){return Promise.reject(a)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,s,o){try{return Promise.resolve(ar(function(){return Promise.resolve((r.mode==="sync"?ca:da)(e,n,t)).then(function(a){return o.shouldUseNativeValidation&&Ue.validateFieldsNatively({},o),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(i){return i instanceof ia})(a))return{values:{},errors:Ue.toNestErrors(ma(a.issues,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw a}))}catch(a){return Promise.reject(a)}};throw new Error("Invalid input: not a Zod schema")}function ba({methods:e,onSubmit:t,onError:r,children:n,logErrors:s,className:o}){return l.jsx(J.FormProvider,{...e,children:l.jsx("form",{className:k("mt-4 lg:mt-8 grid grid-cols-1 lg:grid-cols-2 gap-4 lg:gap-8 relative",o),onSubmit:e.handleSubmit((a,i)=>t(a,i),a=>{s&&console.log(a),r?.(a)}),children:n})})}function pa(e,t){return J.useForm({resolver:ha(e),defaultValues:t})}const Br=({children:e,size:t=24,strokeWidth:r=2,viewBox:n="0 0 24 24",className:s,...o})=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:n,className:s,...o,children:e}),ga={solid:"bg-base-3 border border-base-4 drop-shadow-sm dark-theme:drop-shadow-none",outline:"border border-base-6"},va={brand:"ring-1 ring-brand",solid:"ring-1 ring-base-6"},_t=f.forwardRef(({label:e,description:t,labelPosition:r="default",color:n="solid",focusColor:s="brand",placeholder:o,valid:a,error:i,errorMessage:u,isPrice:c,prefix:d,wrapperClassName:m,containerClassName:h,className:p,type:b="text",value:v,...x},$)=>{const j=f.useRef(null),R=f.useRef(!1),[T,M]=f.useState(!1),[y,N]=f.useState(!1),P=b==="password",A=P&&T?"text":c?"number":b,E=v!==""&&v!==null&&v!==void 0;return f.useEffect(()=>{if(!R.current){R.current=!0;return}j.current&&hr(j.current)},[T,j]),l.jsxs("div",{className:k("relative",m),children:[e&&r==="default"&&l.jsx("label",{className:k("font-medium ml-0.5 text-xs",i&&"text-red-9"),children:e}),l.jsxs("div",{className:k("rounded-6 transition cursor-text relative",ga[n],{"pt-[22px] pb-1.5":r==="floating",[va[s]]:!i&&y,"bg-red-4 text-red-9":!!i,"ring-1 ring-red-9":!!i&&y},h),children:[e&&r==="floating"&&l.jsx("label",{className:k("absolute transition-all duration-200 pointer-events-none","text-sm top-[18px] font-semibold left-3",{"text-xs top-2.5":y||E||o,"text-red-9":!!i}),children:e}),c&&l.jsx(I.DollarSign,{size:16,className:k("absolute top-1/2 -translate-y-1/2 left-3",i?"text-red-9":"text-base-11")}),d&&l.jsx("p",{className:"text-sm text-base-11 absolute top-1/2 -translate-y-1/2 left-3",children:d}),l.jsx("input",{ref:g=>{$&&(typeof $=="function"?$(g):$.current=g),j.current=g},type:A,className:k("w-full bg-transparent focus-visible:outline-none","placeholder:text-sm text-sm placeholder:text-base-11",c||d?"pl-9":"pl-3",{"py-2.5":r==="default","mt-1.5":r==="floating","pr-10":a,"text-red-9 placeholder:text-red-9":!!i},p),value:v,placeholder:o,onFocus:()=>N(!0),onBlur:()=>N(!1),...x})]}),a?l.jsx(I.CheckIcon,{size:20,className:`absolute top-1/2 -translate-y-1/2 text-green-500 ${P?"right-10":"right-3"}`}):null,P&&l.jsx("button",{type:"button",className:k(r==="floating"?"absolute right-3 top-1/2 -translate-y-1/2":"absolute right-3 top-10"),onClick:()=>{M(!T)},children:T?l.jsx(I.EyeOffIcon,{size:20,className:k(i?"text-red-9":"text-base-11")}):l.jsx(I.Eye,{size:20,className:k(i?"text-red-9":"text-base-11")})}),u?l.jsx("span",{role:"alert",className:"text-red-9 text-sm mt-1 ml-0.5",children:u}):t?l.jsx("p",{className:"text-xs text-base-11 mt-1 ml-0.5",children:t}):null]})});_t.displayName="Input";const xa=({name:e,customRead:t,customSet:r,withNullSet:n=!0,...s})=>{const{control:o}=J.useFormContext(),a=f.useCallback(u=>t?t(u):u===null?Mt(u):u,[t]),i=f.useCallback(u=>r?n&&u===null?et(u):r(u):u===null?et(u):u,[r]);return o?l.jsx(J.Controller,{name:e,control:o,render:({field:u,fieldState:c})=>l.jsx(_t,{value:a(u.value),onChange:d=>u.onChange(i(d.target.value)),error:!!c.error,errorMessage:c.error?.message,ref:u.ref,...s})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},qr=f.createContext(null),wa=({children:e,value:t})=>l.jsx(qr.Provider,{value:t,children:e}),ya=()=>{const e=f.useContext(qr);if(!e)throw new Error("useAliveScope must be wrapped within AliveScopeProvider");return e},ka=({children:e})=>{const[t,r]=f.useState({}),n=f.useRef({}),s=f.useRef({}),o=(i,u,c)=>{if(!t[i]){const d=document.createElement("div");return i&&(d.id=i),c&&(d.className=c),r(m=>({...m,[i]:{children:u,element:d}})),n.current[i]=[],s.current[i]=[],n.current&&n.current[i]&&n.current[i].forEach(m=>m(i)),d}return n.current&&n.current[i]&&n.current[i].forEach(d=>d(i)),t[i].element},a=i=>{r(u=>{const c={...u};return delete c[i],c}),s.current&&s.current[i]&&s.current[i].forEach(u=>u(i))};return l.jsxs(wa,{value:{getPortalElement:o,dropPortalElement:a},children:[e,Object.entries(t).map(([i,{children:u,element:c}])=>l.jsx(Ea,{id:i,onMountCallbacks:n,onDropCallbacks:s,children:u,element:c},i))]})},Xr=f.createContext(null),Na=({children:e,value:t})=>l.jsx(Xr.Provider,{value:t,children:e}),Ea=f.memo(({id:e,onMountCallbacks:t,onDropCallbacks:r,children:n,element:s})=>{const o=(i,u={runOnFirstMount:!1})=>{f.useEffect(()=>{const c=()=>{if(document.getElementById(e))i(e);else{const m=new MutationObserver((h,p)=>{document.getElementById(e)&&(i(e),p.disconnect())});return m.observe(document.body,{childList:!0,subtree:!0}),()=>m.disconnect()}};return u?.runOnFirstMount&&c(),t.current[e].push(c),()=>{t.current[e]=t.current[e].filter(d=>d!==c)}},[])},a=i=>{f.useEffect(()=>(r.current[e].push(i),()=>{r.current[e]=r.current[e].filter(u=>u!==i)}),[])};return l.jsx(Na,{value:{keepAliveId:e,onKeepAliveMount:o,onKeepAliveDrop:a},children:dr.createPortal(n,s,e)})}),$a=()=>{const e=f.useContext(Xr);if(!e)throw new Error("useKeepAlive must be used within KeepAliveProvider");return e},ja=({aliveKey:e,children:t,enabled:r=!0,...n})=>{const s=f.useRef(null),{getPortalElement:o}=ya();return f.useEffect(()=>{const a=o(e,t,n.className);return r&&s.current&&s.current.replaceWith(a),()=>{}},[e,t,r,n]),l.jsx("div",{...n,ref:s,children:t})},Ca=({lightSolid:e=!0,className:t,children:r,...n})=>l.jsx("div",{className:k("rounded-7 dark-theme:bg-base-3",e?"border-none bg-base-3":"border border-base-6 dark-theme:border-base-4",t),...n,children:r}),Sa=({onClick:e,lightSolid:t=!0,className:r,children:n})=>l.jsx("button",{onClick:e,className:k("w-full text-start first:rounded-t-7 last:rounded-b-7 border-b dark-theme:border-base-4","last:border-none px-3 pr-2.5 py-3 dark-theme:bg-base-3 lg:hover:bg-base-4 max-lg:active:bg-base-4","transition-colors hover:cursor-pointer flex items-center justify-between outline-none lg:focus-visible:ring-2 focus-visible:ring-base-6",t?"bg-base-3 border-base-4":"border-base-6",r),children:n}),Vr=({label:e,labelPosition:t="default",options:r,selectedValues:n,onChange:s,idExtractor:o,labelExtractor:a,customSetter:i,valid:u,error:c,placeholder:d="Select options...",maxSelections:m,searchable:h=!1,disabled:p=!1,className:b})=>{const[v,x]=f.useState(""),[$,j]=f.useState(!1),[R,T]=f.useState(-1),M=f.useRef(null),y=f.useRef(null),N=f.useRef([]),{triggerRef:P,triggerProps:A,popoverRef:E,getPopoverPosition:g,open:S,toggle:C,close:O}=ct({align:"start",side:"top",avoidCollisions:!1,onOpen:()=>{j(!0),h&&M.current&&setTimeout(()=>M.current?.focus(),10)},onClose:()=>{j(!1),x(""),T(-1)}}),_=f.useRef(`multiselect-${Math.random().toString(36).substr(2,9)}`).current,X=f.useRef(`label-${Math.random().toString(36).substr(2,9)}`).current,F=f.useRef(`error-${Math.random().toString(36).substr(2,9)}`).current,w=f.useRef(`listbox-${Math.random().toString(36).substr(2,9)}`).current,V=i?n.map(D=>r.find(G=>o(G)===D||o(G)===o(D))).filter(Boolean):n,oe=V.length>0,U=h?r.filter(D=>a(D).toLowerCase().includes(v.toLowerCase())):r;f.useEffect(()=>{N.current=N.current.slice(0,U.length)},[U.length]);const re=D=>i?n.some(W=>W===o(D)||o(W)===o(D)):n.some(W=>o(W)===o(D)),Le=D=>{if(!p)if(re(D)){let W;if(i){const G=o(D);W=n.filter(xe=>xe!==G&&o(xe)!==G)}else W=n.filter(G=>o(G)!==o(D));s(W),Ke(`Removed ${a(D)}`)}else{if(m&&V.length>=m){Ke(`Maximum of ${m} selections allowed`);return}let W;i?W=[...n,i(D)]:W=[...n,D],s(W),Ke(`Added ${a(D)}`)}},Xe=D=>{if(p)return;let W;if(i){const G=o(D);W=n.filter(xe=>xe!==G&&o(xe)!==G)}else W=n.filter(G=>o(G)!==o(D));s(W),Ke(`Removed ${a(D)}`)},Ve=D=>{if(!p)switch(D.key){case"Enter":D.preventDefault(),S?R>=0&&Le(U[R]):C();break;case"Escape":D.preventDefault(),O();break;case"ArrowDown":if(D.preventDefault(),!S)C();else{const W=R>=U.length-1?0:R+1;T(W),N.current[W]?.scrollIntoView({block:"nearest"})}break;case"ArrowUp":if(D.preventDefault(),S){const W=R<=0?U.length-1:R-1;T(W),N.current[W]?.scrollIntoView({block:"nearest"})}break;case"Backspace":if(h&&v===""&&V.length>0){const W=V[V.length-1];Xe(W)}break}},ln=D=>{x(D.target.value),T(-1)},cn=()=>{p||(h&&M.current&&M.current.focus(),C())},Ke=D=>{console.log(`Accessibility announcement: ${D}`)};ut(E,D=>{!P.current||!S||!D.target||P.current.contains(D.target)||O()});const pt=g();return l.jsxs("div",{className:k("relative",b),children:[l.jsxs("div",{className:"relative",ref:y,children:[t==="default"&&l.jsx("label",{className:k("top-[18px] font-medium ml-0.5 text-xs",c&&"text-red-9"),children:e}),l.jsxs("div",{ref:P,...A,className:k("relative rounded-6 px-2 transition cursor-pointer pr-10 min-h-[48px]","border border-base-4 light-theme:drop-shadow-sm dark-theme:bg-base-3",{"py-3":t==="default","pt-5 pb-2":t==="floating","ring-1 ring-brand":S||$,"text-red-9":c,"ring-2 ring-red-6":c&&(S||$),"opacity-60 cursor-not-allowed":p}),onClick:cn,role:"combobox","aria-expanded":S,"aria-haspopup":"listbox","aria-owns":w,"aria-labelledby":X,"aria-describedby":c?F:void 0,onKeyDown:Ve,tabIndex:p?-1:0,children:[t==="floating"&&l.jsxs("label",{id:X,htmlFor:_,className:k("absolute transition-all duration-200 pointer-events-none","text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":$||oe,"text-red-9":!!c}),children:[e," ",m&&`(${n.length}/${m})`]}),l.jsxs("div",{className:k("flex flex-wrap gap-2 items-center",{"mt-2.5":t==="floating"}),children:[V.map(D=>l.jsxs("div",{className:k("border border-base-4 dark-theme:border-base-5 dark-theme:bg-base-4 rounded-full px-2 py-1 text-sm flex items-center gap-1",{"bg-red-4 text-red-9":c}),children:[l.jsx("span",{className:"line-clamp-1",children:a(D)}),!p&&l.jsx("button",{type:"button",className:"hover:bg-brand/20 rounded-full p-0.5 transition-colors",onClick:W=>{W.stopPropagation(),Xe(D)},"aria-label":`Remove ${a(D)}`,children:l.jsx(I.XIcon,{size:12})})]},o(D))),h&&l.jsx("input",{ref:M,id:_,type:"text",className:"flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm",value:v,onChange:ln,onKeyDown:Ve,placeholder:oe?"":d,disabled:p,"aria-autocomplete":"list","aria-controls":w,autoComplete:"off"}),!h&&!oe&&l.jsx("span",{className:"text-secondarytext text-sm flex-grow",children:d})]}),l.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:[u&&l.jsx(I.CheckIcon,{size:16,className:"text-green-600"}),l.jsx(I.ChevronDownIcon,{size:16,className:k("transition-transform text-base-11",{"rotate-180":S})})]})]})]}),l.jsx(L.AnimatePresence,{children:S&&l.jsx(Fe,{children:l.jsx(L.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},ref:E,style:{position:"fixed",left:pt.x,top:pt.top,bottom:pt.bottom,width:y.current?.offsetWidth??200},className:k("bg-base-1 dark-theme:bg-base-3 border border-base-4","rounded-6 shadow-lg max-h-[300px] overflow-y-auto z-50","customscrollbarnohide"),role:"listbox",id:w,"aria-labelledby":X,children:U.length===0?l.jsx("div",{className:"px-3 py-2 text-sm text-secondarytext",children:v?"No results found":"No options available"}):U.map((D,W)=>{const G=re(D),xe=W===R;return l.jsxs("div",{ref:un=>{N.current[W]=un},className:k("px-3 py-2 text-sm cursor-pointer flex items-center justify-between","first:rounded-t-6 last:rounded-b-6",{"bg-base-3 dark-theme:bg-base-4":xe,"bg-brandfadedbg text-brand":G}),onClick:()=>Le(D),role:"option","aria-selected":G,onMouseEnter:()=>T(W),children:[l.jsx("span",{children:a(D)}),G&&l.jsx(I.CheckIcon,{size:16})]},o(D))})})})}),c&&l.jsx("p",{id:F,className:"text-red-9 text-xs mt-1","aria-live":"assertive",children:c}),l.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:V.length>0?`Selected: ${V.map(a).join(", ")}`:"No selections"})]})},Ta=({name:e,...t})=>{const{control:r}=J.useFormContext();return r?l.jsx(J.Controller,{name:e,control:r,render:({field:n,fieldState:s})=>l.jsx(Vr,{selectedValues:n.value||[],onChange:o=>n.onChange(o),error:s.error?.message,...t})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},Ma=({id:e,tabPage:t,absolute:r=!0,navBar:n,children:s,onRefresh:o,style:a,className:i,contentClassName:u,bounceBackDuration:c=300,showScrollbar:d=!0,onScroll:m})=>{const h=f.useRef(null),p=f.useRef(null),b=f.useRef(null),v=f.useRef(null),x=f.useRef(null),[$,j]=f.useState(!1),R=f.useRef(null),T=f.useRef({startY:0,currentY:0,maxScroll:0,lastTimestamp:0,frameCallback:null,isScrolling:!1,pullDistance:0,refreshThreshold:50,isPullingToRefresh:!1}),M=Be(),y=f.useCallback(Oe(()=>{h.current&&p.current&&(T.current.maxScroll=Math.max(0,p.current.offsetHeight-h.current.offsetHeight))}),[]),N=f.useCallback(F=>{const{maxScroll:w}=T.current;return F>0?Math.pow(F,.8):F<-w?-w-Math.pow(-(F+w),.8):F},[]),P=f.useCallback(()=>{if(!d||!h.current||!v.current)return;const{currentY:F,maxScroll:w}=T.current,H=h.current.offsetHeight,V=Math.max(30,H/(H+w)*H),oe=H-V;let U=-F/w*oe,re=1;F>0?(U=0,re=1-F/H,v.current.style.transformOrigin="top"):F<-w?(U=oe,re=1-Math.abs(F+w)/H,v.current.style.transformOrigin="bottom"):v.current.style.transformOrigin="top",v.current.style.transform=`translate3d(0, ${U}px, 0) scaleY(${re})`,v.current.style.height=`${V}px`},[d]),A=f.useCallback(F=>{if(T.current.currentY=F,p.current&&(p.current.style.transform=`translate3d(0, ${F}px, 0)`),b.current){const w=Math.max(F-T.current.refreshThreshold,-T.current.refreshThreshold);b.current.style.transform=`translate3d(0, ${w}px, 0)`}m&&m(F),P()},[P]),E=f.useCallback(F=>{const w=T.current;w.frameCallback&&(L.cancelFrame(w.frameCallback),w.frameCallback=null);const H=performance.now(),V=w.currentY,oe=F-V,U=()=>{const re=performance.now()-H,Le=Math.min(re/c,1),Xe=1-Math.pow(1-Le,3),Ve=V+oe*Xe;A(Ve),Le>=1&&(w.frameCallback&&(L.cancelFrame(w.frameCallback),w.frameCallback=null),A(F),F===0&&b.current&&(b.current.textContent="Pull to refresh"))};w.frameCallback=L.frame.render(U,!0)},[A,c]),g=f.useCallback(F=>{const w=T.current;w.frameCallback&&(L.cancelFrame(w.frameCallback),w.frameCallback=null);let H=F,V=Date.now();const oe=()=>{const U=Date.now(),re=U-V;if(V=U,H*=Math.pow(.95,re/16),w.currentY+=H*re,w.currentY>0||w.currentY<-w.maxScroll){w.frameCallback&&(L.cancelFrame(w.frameCallback),w.frameCallback=null),E(w.currentY>0?0:-w.maxScroll);return}A(w.currentY),Math.abs(H)<.01&&w.frameCallback&&(L.cancelFrame(w.frameCallback),w.frameCallback=null)};w.frameCallback=L.frame.render(oe,!0)},[A,E]),S=f.useCallback(()=>{if(!d||!v.current)return;x.current!==null&&clearTimeout(x.current),requestAnimationFrame(()=>{v.current&&(v.current.style.opacity="1")});const F=window.requestIdleCallback||(w=>setTimeout(w,1e3));x.current=window.setTimeout(()=>{F(()=>{v.current&&(v.current.style.opacity="0"),x.current=null})},1e3)},[d]),C=f.useCallback(F=>{if(R.current!==null&&Date.now()-R.current<50)return;R.current=Date.now();const w=T.current;w.isScrolling=!0,w.startY=w.currentY,w.lastTimestamp=Date.now(),w.isPullingToRefresh=w.currentY===0,w.pullDistance=0,w.frameCallback&&(L.cancelFrame(w.frameCallback),w.frameCallback=null),S()},[S]),O=f.useCallback(F=>{const w=T.current;if(!w.isScrolling)return;const H=N(w.startY+F.deltaY);w.isPullingToRefresh&&H<w.startY&&(w.isPullingToRefresh=!1),A(H),o&&w.isPullingToRefresh&&!$&&H>0&&(w.pullDistance=H,b.current&&(b.current.textContent=w.pullDistance>w.refreshThreshold?"Release to refresh":"Pull to refresh")),S()},[o,A,$,S,N]),_=f.useCallback(F=>{const w=T.current;w.isScrolling&&(w.isScrolling=!1,o&&w.isPullingToRefresh&&!$&&w.pullDistance>w.refreshThreshold?X():w.currentY>0||w.currentY<-w.maxScroll?E(w.currentY>0?0:-w.maxScroll):g(F.velocityY),w.isPullingToRefresh=!1)},[o,g,E,$]),X=f.useCallback(()=>{j(!0),E(T.current.refreshThreshold),b.current&&(b.current.textContent="Refreshing..."),o&&o().then(()=>{j(!1),E(0)})},[o,E]);return f.useEffect(()=>{if(!h.current)return;const F=fr.createGesture(h.current,{name:"page-scroller-gesture",priority:10,passive:!0,direction:"y",onStart:C,onMove:O,onEnd:_});return F.init(),()=>F.destroy()},[C,O,_]),f.useEffect(()=>{if(h.current)return y(),P(),window.addEventListener("resize",y),()=>{window.removeEventListener("resize",y),x.current!==null&&clearTimeout(x.current)}},[y,P]),l.jsxs(L.motion.div,{id:e,ref:h,initial:{x:t||M?0:window.innerWidth,y:M?20:void 0,opacity:M&&!t?0:1},animate:{x:M||t?void 0:0,y:M?0:void 0,opacity:1,transition:{ease:[.32,.72,0,1],duration:M?.34:.44,delay:.2}},exit:{x:M||t?void 0:window.innerWidth+80,y:M?20:0,opacity:M?0:1,transition:{duration:M?.34:.6,ease:[.32,.72,0,1]}},style:{overflow:"hidden",position:r?"absolute":"relative",...a},className:k("top-0 right-0 h-full w-full bg-base-1 isolate will-change-transform",i),children:[o&&l.jsx("div",{ref:b,style:{position:"absolute",top:n?48:0,left:0,width:"100%",textAlign:"center",height:"50px",lineHeight:"50px",transform:"translateY(-50px)"},children:"Pull to refresh"}),l.jsx("div",{ref:p,style:{position:"absolute",top:0,left:0,width:"100%",willChange:"transform"},className:u,children:s}),n,d&&l.jsx("div",{ref:v,style:{position:"absolute",top:2,right:2,width:6,borderRadius:3,opacity:0,transition:"opacity 0.2s",willChange:"transform"},className:"bg-base-3"})]},`scroller${e}`)};function Da({id:e,showScrollbar:t=!0,onRefresh:r,bounceBackDuration:n=300,isolate:s=!1,onScroll:o}){const a=f.useRef(null),i=f.useRef(null),u=f.useRef(null),c=f.useRef(null),d=f.useRef(null),[m,h]=f.useState(!1),p=f.useRef(null),b=f.useRef({startY:0,currentY:0,maxScroll:0,lastTimestamp:0,frameCallback:null,isScrolling:!1,pullDistance:0,refreshThreshold:50,isPullingToRefresh:!1}),v=f.useCallback(Oe(()=>{a.current&&i.current&&(b.current.maxScroll=Math.max(0,i.current.offsetHeight-a.current.offsetHeight))}),[]),x=f.useCallback(E=>{const{maxScroll:g}=b.current;return E>0?Math.pow(E,.8):E<-g?-g-Math.pow(-(E+g),.8):E},[]),$=f.useCallback(()=>{if(!t||!a.current||!c.current)return;const{currentY:E,maxScroll:g}=b.current,S=a.current.offsetHeight,C=Math.max(30,S/(S+g)*S),O=S-C;let _=-E/g*O,X=1;E>0?(_=0,X=1-E/S,c.current.style.transformOrigin="top"):E<-g?(_=O,X=1-Math.abs(E+g)/S,c.current.style.transformOrigin="bottom"):c.current.style.transformOrigin="top",c.current.style.transform=`translate3d(0, ${_}px, 0) scaleY(${X})`,c.current.style.height=`${C}px`},[t]),j=f.useCallback(E=>{if(b.current.currentY=E,i.current&&(i.current.style.transform=`translate3d(0, ${E}px, 0)`),u.current){const g=Math.max(E-b.current.refreshThreshold,-b.current.refreshThreshold);u.current.style.transform=`translate3d(0, ${g}px, 0)`}o&&o(E),$()},[$]),R=f.useCallback(E=>{const g=b.current;g.frameCallback&&(L.cancelFrame(g.frameCallback),g.frameCallback=null);const S=performance.now(),C=g.currentY,O=E-C,_=()=>{const X=performance.now()-S,F=Math.min(X/n,1),w=1-Math.pow(1-F,3),H=C+O*w;j(H),F>=1&&(g.frameCallback&&(L.cancelFrame(g.frameCallback),g.frameCallback=null),j(E))};g.frameCallback=L.frame.render(_,!0)},[j,n]),T=f.useCallback(E=>{const g=b.current;g.frameCallback&&(L.cancelFrame(g.frameCallback),g.frameCallback=null);let S=E,C=Date.now();const O=()=>{const _=Date.now(),X=_-C;if(C=_,S*=Math.pow(.95,X/16),g.currentY+=S*X,g.currentY>0||g.currentY<-g.maxScroll){g.frameCallback&&(L.cancelFrame(g.frameCallback),g.frameCallback=null),R(g.currentY>0?0:-g.maxScroll);return}j(g.currentY),Math.abs(S)<.01&&g.frameCallback&&(L.cancelFrame(g.frameCallback),g.frameCallback=null)};g.frameCallback=L.frame.render(O,!0)},[j,R]),M=f.useCallback(()=>{if(!t||!c.current)return;d.current!==null&&clearTimeout(d.current),requestAnimationFrame(()=>{c.current&&(c.current.style.opacity="1")});const E=window.requestIdleCallback||(g=>setTimeout(g,1e3));d.current=window.setTimeout(()=>{E(()=>{c.current&&(c.current.style.opacity="0"),d.current=null})},1e3)},[t]),y=f.useCallback(E=>{if(p.current!==null&&Date.now()-p.current<50)return;p.current=Date.now();const g=b.current;g.isScrolling=!0,g.startY=g.currentY,g.lastTimestamp=Date.now(),g.isPullingToRefresh=g.currentY===0,g.pullDistance=0,g.frameCallback&&(L.cancelFrame(g.frameCallback),g.frameCallback=null),M()},[M]),N=f.useCallback(E=>{const g=b.current;if(!g.isScrolling)return;const S=x(g.startY+E.deltaY);g.isPullingToRefresh&&S<g.startY&&(g.isPullingToRefresh=!1),j(S),r&&g.isPullingToRefresh&&!m&&S>0&&(g.pullDistance=S),M()},[r,j,m,M,x]),P=f.useCallback(()=>{h(!0),R(b.current.refreshThreshold),r&&r().then(()=>{h(!1),R(0)})},[r,R]),A=f.useCallback(E=>{const g=b.current;g.isScrolling&&(g.isScrolling=!1,r&&g.isPullingToRefresh&&!m&&g.pullDistance>g.refreshThreshold?P():g.currentY>0||g.currentY<-g.maxScroll?R(g.currentY>0?0:-g.maxScroll):T(E.velocityY),g.isPullingToRefresh=!1)},[r,T,R,m,P]);return f.useEffect(()=>{if(!a.current)return;const E=fr.createGesture(a.current,{name:"page-scroller-gesture",priority:10,passive:!0,direction:"y",onStart:y,onMove:N,onEnd:A});return E.init(),()=>E.destroy()},[y,N,A]),f.useEffect(()=>{if(a.current)return v(),$(),window.addEventListener("resize",v),()=>{window.removeEventListener("resize",v),d.current!==null&&clearTimeout(d.current)}},[v,$]),{container:{props:{id:e,ref:a,key:`scroller${e||"default"}`},classNames:`will-change-transform overflow-hidden ${s?"isolate":""}`},content:{props:{ref:i},styles:{position:"absolute",top:0,left:0,width:"100%",willChange:"transform"}},pullToRefresh:{props:{ref:u},styles:{position:"absolute",top:0,left:0,width:"100%",textAlign:"center",height:"50px",lineHeight:"50px",transform:"translateY(-50px)"}},scrollbar:{props:{ref:c}},refreshing:m,updateMaxScroll:v,rubberBandEffect:x,updateScrollbarPosition:$,setPosition:j}}const Pa={2:"text-2xl",4:"text-4xl",5:"text-5xl",6:"text-6xl"},Oa=({title:e,description:t,size:r="6",descriptionClassName:n,className:s})=>l.jsxs("div",{className:k("text-center",s),children:[l.jsx("p",{className:`${Pa[r]} font-medium`,children:e}),t?l.jsx("p",{className:k("mt-6 text-base-11",n),children:t}):null]}),Fa=f.forwardRef(({placeholder:e="Buscar",value:t,exposedRef:r,autoFocus:n,onClear:s,onChange:o,className:a,onMount:i,error:u},c)=>{const d=f.useRef(null),m=Be(),h=Dt(d,c),p=f.useCallback(()=>r&&r(d),[]);return f.useEffect(()=>{const b=async()=>{i&&await i(d,m)};p(),b()},[]),l.jsxs("div",{className:k("rounded-6 relative flex items-center bg-base-3 border-base-5",{"dark-theme:bg-red-4 light-theme:border-red-9":u,"dark-theme:bg-base-3":!u},a),children:[l.jsx("input",{ref:h,placeholder:e,value:t,onChange:o,autoComplete:"off",autoCorrect:"off",type:"search",autoFocus:n?n(m):void 0,className:k("w-full py-1.5 pl-10 pr-3 bg-transparent outline-none text-base-12 placeholder:text-base-11 [&::-webkit-search-cancel-button]:appearance-none",u&&"text-red-9 placeholder:text-red-9")}),l.jsx(I.Search,{size:20,className:k("absolute left-3 text-base-11 pointer-events-none",{"text-red-9":u})}),s&&t&&t.length>0?l.jsx("button",{onClick:()=>{s(),d.current?.focus()},className:k("absolute right-2.5 rounded-full",u?"text-red-9":"text-base-11"),children:l.jsx(I.X,{size:20})}):null]})}),ir=({el:e,direction:t,amount:r=200,multiplier:n=.4,speed:s="normal"})=>{if(!e)return;const o=t==="up"||t==="down",a=o?e.scrollTop:e.scrollLeft,i=o?e.scrollHeight-e.clientHeight:e.scrollWidth-e.clientWidth;let u;r==="max"?u=i:u=r??(o?e.clientHeight:e.clientWidth)*n;let c;if(t==="right"||t==="down"?c=Math.min(a+u,i):c=Math.max(a-u,0),c===a)return;const d={fast:.15,normal:.4,slow:.8};L.animate(0,1,{duration:d[s],ease:"easeOut",onUpdate:m=>{if(!e)return;const h=a+(c-a)*m;o?e.scrollTop=h:e.scrollLeft=h}})},La={default:[.32,.72,0,1]},lr={initial:{opacity:0},animate:{opacity:1,transition:{ease:La.default,duration:.3}},exit:{opacity:0,transition:{ease:[.32,.72,0,1],duration:.3}}},Kr=new Set,Q=new WeakMap,Me=new WeakMap,$e=new WeakMap,St=new WeakMap,Ra=new WeakMap,De=new WeakMap,at=new WeakMap,Ae=new WeakSet;let ve,Yt=0,It=0;const fe="__aa_tgt",ze="__aa_del",it="__aa_new",Aa=e=>{const t=Ha(e);t&&t.forEach(r=>Ba(r))},Wa=e=>{e.forEach(t=>{t.target===ve&&Ya(),Q.has(t.target)&&je(t.target)})};function _a(e){St.get(e)?.disconnect();let r=Q.get(e),n=0;const s=5;r||(r=Pe(e),Q.set(e,r));const{offsetWidth:o,offsetHeight:a}=ve,u=[r.top-s,o-(r.left+s+r.width),a-(r.top+s+r.height),r.left-s].map(d=>`${-1*Math.floor(d)}px`).join(" "),c=new IntersectionObserver(()=>{++n>1&&je(e)},{root:ve,threshold:1,rootMargin:u});c.observe(e),St.set(e,c)}function je(e){clearTimeout(at.get(e));const t=bt(e),r=He(t)?500:t.duration;at.set(e,setTimeout(async()=>{const n=$e.get(e);try{await n?.finished,Q.set(e,Pe(e)),_a(e)}catch{}},r))}function Ya(){clearTimeout(at.get(ve)),at.set(ve,setTimeout(()=>{Kr.forEach(e=>Jr(e,t=>Ur(()=>je(t))))},100))}function Ia(e){setTimeout(()=>{Ra.set(e,setInterval(()=>Ur(je.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function Ur(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let Tt,lt;const za=typeof window<"u"&&"ResizeObserver"in window;za&&(ve=document.documentElement,Tt=new MutationObserver(Aa),lt=new ResizeObserver(Wa),window.addEventListener("scroll",()=>{It=window.scrollY,Yt=window.scrollX}),lt.observe(ve));function Ha(e){return e.reduce((n,s)=>[...n,...Array.from(s.addedNodes),...Array.from(s.removedNodes)],[]).every(n=>n.nodeName==="#comment")?!1:e.reduce((n,s)=>{if(n===!1)return!1;if(s.target instanceof Element){if(yt(s.target),!n.has(s.target)){n.add(s.target);for(let o=0;o<s.target.children.length;o++){const a=s.target.children.item(o);if(a){if(ze in a)return!1;yt(s.target,a),n.add(a)}}}if(s.removedNodes.length)for(let o=0;o<s.removedNodes.length;o++){const a=s.removedNodes[o];if(ze in a)return!1;a instanceof Element&&(n.add(a),yt(s.target,a),Me.set(a,[s.previousSibling,s.nextSibling]))}}return n},new Set)}function yt(e,t){!t&&!(fe in e)?Object.defineProperty(e,fe,{value:e}):t&&!(fe in t)&&Object.defineProperty(t,fe,{value:e})}function Ba(e){const t=e.isConnected,r=Q.has(e);t&&Me.has(e)&&Me.delete(e),$e.has(e)&&$e.get(e)?.cancel(),it in e?cr(e):r&&t?Xa(e):r&&!t?Va(e):cr(e)}function ae(e){return Number(e.replace(/[^0-9.\-]/g,""))}function qa(e){let t=e.parentElement;for(;t;){if(t.scrollLeft||t.scrollTop)return{x:t.scrollLeft,y:t.scrollTop};t=t.parentElement}return{x:0,y:0}}function Pe(e){const t=e.getBoundingClientRect(),{x:r,y:n}=qa(e);return{top:t.top+n,left:t.left+r,width:t.width,height:t.height}}function Gr(e,t,r){let n=t.width,s=t.height,o=r.width,a=r.height;const i=getComputedStyle(e);if(i.getPropertyValue("box-sizing")==="content-box"){const c=ae(i.paddingTop)+ae(i.paddingBottom)+ae(i.borderTopWidth)+ae(i.borderBottomWidth),d=ae(i.paddingLeft)+ae(i.paddingRight)+ae(i.borderRightWidth)+ae(i.borderLeftWidth);n-=d,o-=d,s-=c,a-=c}return[n,o,s,a].map(Math.round)}function bt(e){return fe in e&&De.has(e[fe])?De.get(e[fe]):{duration:250,easing:"ease-in-out"}}function Qr(e){if(fe in e)return e[fe]}function zt(e){const t=Qr(e);return t?Ae.has(t):!1}function Jr(e,...t){t.forEach(r=>r(e,De.has(e)));for(let r=0;r<e.children.length;r++){const n=e.children.item(r);n&&t.forEach(s=>s(n,De.has(n)))}}function Ht(e){return Array.isArray(e)?e:[e]}function He(e){return typeof e=="function"}function Xa(e){const t=Q.get(e),r=Pe(e);if(!zt(e))return Q.set(e,r);let n;if(!t)return;const s=bt(e);if(typeof s!="function"){const o=t.left-r.left,a=t.top-r.top,[i,u,c,d]=Gr(e,t,r),m={transform:`translate(${o}px, ${a}px)`},h={transform:"translate(0, 0)"};s.fromBorderRadius!==void 0&&s.toBorderRadius!==void 0&&(m.borderRadius=`${s.fromBorderRadius}px`,h.borderRadius=`${s.toBorderRadius}px`),i!==u&&(m.width=`${i}px`,h.width=`${u}px`),c!==d&&(m.height=`${c}px`,h.height=`${d}px`),n=e.animate([m,h],{duration:s.duration,easing:s.easing})}else{const[o]=Ht(s(e,"remain",t,r));n=new Animation(o),n.play()}$e.set(e,n),Q.set(e,r),n.addEventListener("finish",je.bind(null,e))}function cr(e){it in e&&delete e[it];const t=Pe(e);Q.set(e,t);const r=bt(e);if(!zt(e))return;let n;if(typeof r!="function")n=e.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:r.duration*1.5,easing:"ease-in"});else{const[s]=Ht(r(e,"add",t));n=new Animation(s),n.play()}$e.set(e,n),n.addEventListener("finish",je.bind(null,e))}function ur(e,t){e.remove(),Q.delete(e),Me.delete(e),$e.delete(e),St.get(e)?.disconnect(),setTimeout(()=>{if(ze in e&&delete e[ze],Object.defineProperty(e,it,{value:!0,configurable:!0}),t&&e instanceof HTMLElement)for(const r in t)e.style[r]=""},0)}function Va(e){if(!Me.has(e)||!Q.has(e))return;const[t,r]=Me.get(e);Object.defineProperty(e,ze,{value:!0,configurable:!0});const n=window.scrollX,s=window.scrollY;if(r&&r.parentNode&&r.parentNode instanceof Element?r.parentNode.insertBefore(e,r):t&&t.parentNode?t.parentNode.appendChild(e):Qr(e)?.appendChild(e),!zt(e))return ur(e);const[o,a,i,u]=Ua(e),c=bt(e),d=Q.get(e);(n!==Yt||s!==It)&&Ka(e,n,s,c);let m,h={position:"absolute",top:`${o}px`,left:`${a}px`,width:`${i}px`,height:`${u}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!He(c))Object.assign(e.style,h),m=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:c.duration,easing:"ease-out"});else{const[p,b]=Ht(c(e,"remove",d));b?.styleReset!==!1&&(h=b?.styleReset||h,Object.assign(e.style,h)),m=new Animation(p),m.play()}$e.set(e,m),m.addEventListener("finish",ur.bind(null,e,h))}function Ka(e,t,r,n){const s=Yt-t,o=It-r,a=document.documentElement.style.scrollBehavior;if(getComputedStyle(ve).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+s,window.scrollY+o),!e.parentElement)return;const u=e.parentElement;let c=u.clientHeight,d=u.clientWidth;const m=performance.now();function h(){requestAnimationFrame(()=>{if(!He(n)){const p=c-u.clientHeight,b=d-u.clientWidth;m+n.duration>performance.now()?(window.scrollTo({left:window.scrollX-b,top:window.scrollY-p}),c=u.clientHeight,d=u.clientWidth,h()):document.documentElement.style.scrollBehavior=a}})}h()}function Ua(e){const t=Q.get(e),[r,,n]=Gr(e,t,Pe(e));let s=e.parentElement;for(;s&&(getComputedStyle(s).position==="static"||s instanceof HTMLBodyElement);)s=s.parentElement;s||(s=document.body);const o=getComputedStyle(s),a=Q.get(s)||Pe(s),i=Math.round(t.top-a.top)-ae(o.borderTopWidth),u=Math.round(t.left-a.left)-ae(o.borderLeftWidth);return[i,u,r,n]}function Zr(e,t={}){return Tt&&lt&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!He(t)&&!t.disrespectUserMotionPreference||(Ae.add(e),getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),Jr(e,je,Ia,s=>lt?.observe(s)),He(t)?De.set(e,t):De.set(e,{duration:250,easing:"ease-in-out",...t}),Tt.observe(e,{childList:!0}),Kr.add(e))),Object.freeze({parent:e,enable:()=>{Ae.add(e)},disable:()=>{Ae.delete(e)},isEnabled:()=>Ae.has(e)})}const be={rounded:{3:"rounded-3",6:"rounded-6",full:"rounded-full"},colors:{solid:"bg-base-3",brand:"bg-brand text-brand-text",contrast:"bg-base-12 text-base-1"},unselectedColors:{none:"",solid:"bg-bg-uiel"},border:{solid:"border-base-6 dark-theme:border-base-5",subtle:"border-base-5 dark-theme:border-base-4",brand:"border-brand-border"},widths:{fit:{container:"max-w-fit",item:"w-fit"},full:{container:"w-full",item:"grow"}}},Ga=({options:e,selected:t,onChange:r,keyExtractor:n,labelExtractor:s,itemColor:o,itemClassName:a,color:i="contrast",unselectedColor:u="none",width:c="fit",border:d="solid",rounded:m=6,trackScroll:h=!0,className:p})=>{const[b,v]=f.useState({left:!1,right:!1}),{ref:x}=pr({onOverflow:$=>{v({left:$.canScrollLeft,right:$.canScrollRight})},trackScroll:h});return l.jsxs("div",{className:k("relative overflow-hidden",be.widths[c].container,be.rounded[m],p),children:[l.jsx("div",{ref:x,className:k("flex items-center border overflow-x-scroll scrollbar-hide",be.rounded[m],be.border[d]),children:e.map($=>{const j=n(t)===n($);return l.jsx("button",{onClick:()=>r?.($),className:k("border-r px-3 py-1 last:border-none text-nowrap shrink-0",be.widths[c].item,!j&&"lg:hover:bg-overlay-3",o?o(j):j?be.colors[i]:be.unselectedColors[u],be.border[d],a),children:s($)},n($))})}),l.jsxs(L.AnimatePresence,{children:[b.left?l.jsx(L.motion.button,{variants:lr,initial:"initial",animate:"animate",exit:"exit",onClick:()=>{x.current&&ir({el:x.current,direction:"left"})},className:"absolute shrink-0 left-0 px-1 h-full bg-gradient-to-r from-base-2 top-0",children:l.jsx(I.ChevronLeft,{className:"text-base-13"})},"leftarrow"):null,b.right?l.jsx(L.motion.button,{variants:lr,initial:"initial",animate:"animate",exit:"exit",onClick:()=>{x.current&&ir({el:x.current,direction:"right"})},className:"absolute shrink-0 right-0 px-1 h-full bg-gradient-to-l from-base-2 top-0",children:l.jsx(I.ChevronRight,{className:"text-base-13"})},"rightarrow"):null]})]})};function en({label:e,labelPosition:t="default",options:r,selected:n,onChange:s,idExtractor:o,labelExtractor:a,descriptionExtractor:i,classNameExtractor:u,customGetter:c,customSetter:d,error:m,placeholder:h="Selecciona una opción",searchable:p,className:b}){const[v,x]=f.useState(-1),$=f.useRef(null),{triggerRef:j,triggerProps:R,popoverRef:T,getPopoverPosition:M,open:y,toggle:N,close:P}=ct({align:"start",side:"bottom",avoidCollisions:!0,onOpen:()=>{p&&$.current&&setTimeout(()=>$.current?.focus(),10)},onClose:()=>{x(-1)}});ut(T,g=>{!j.current||!y||!g.target||j.current.contains(g.target)||P()});const A=M(),E=c&&n?c(n,r):n;return l.jsxs("div",{className:k("relative",b),children:[t==="default"&&l.jsx("label",{className:k("top-[18px] font-medium ml-0.5 text-xs",m&&"text-red-9"),children:e}),l.jsxs(q,{ref:j,color:"solidhybrid",className:"w-full justify-between",onClick:N,...R,children:[E?a(E):h,l.jsx(I.ChevronDown,{size:18,className:k("transition",y&&"rotate-180")})]}),l.jsx(L.AnimatePresence,{children:y&&l.jsx(Fe,{children:l.jsx(L.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},ref:T,style:{position:"fixed",left:A.x,top:A.top,bottom:A.bottom,width:j.current?.offsetWidth??200},className:k("bg-base-1 dark-theme:bg-base-3 border border-base-4","rounded-6 shadow-lg max-h-[300px] overflow-y-auto z-50","customscrollbarnohide"),role:"listbox",children:r.map((g,S)=>{const C=!!(E&&o(g)===o(E)),O=S===v,_=i?.(g);return l.jsxs("div",{className:k("px-3 py-2 text-sm cursor-pointer flex items-center justify-between gap-x-4","first:rounded-t-6 last:rounded-b-6 relative",O&&"bg-base-3 dark-theme:bg-base-4",C&&"bg-brandfadedbg text-brand",u&&u(C)),onClick:()=>{s(d?d(g):g),P()},role:"option",onMouseEnter:()=>x(S),children:[l.jsxs("div",{children:[l.jsxs("p",{children:[a(g)," "]}),_&&l.jsx("p",{className:"text-xs text-base-11 mt-0.5 line-clamp-2",children:_})]}),C&&l.jsx(I.CheckIcon,{size:16,className:"shrink-0"})]},o(g))})})})})]})}const Qa=({name:e,...t})=>{const{control:r}=J.useFormContext();return r?l.jsx(J.Controller,{name:e,control:r,render:({field:n,fieldState:s})=>l.jsx(en,{selected:n.value??null,onChange:o=>n.onChange(o),error:s.error?.message,...t})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},Ja=({className:e})=>l.jsx("div",{className:k("w-full h-px bg-base-4",e)}),Za=({text:e,length:t=120,size:r="sm",className:n,buttonClassName:s})=>{const[o,a]=f.useState(!1),i=f.useMemo(()=>e.length>t,[e]),u=f.useMemo(()=>i?o?e:e.slice(0,t).trim()+"...":e,[e,o,i]);return l.jsxs("div",{children:[l.jsx("p",{className:k("text-base-12",r==="sm"&&"text-sm",n),children:u}),i?l.jsx("button",{onClick:()=>a(c=>!c),className:k("text-xs text-base-11",s),children:o?"Ver menos":"Ver más"}):null]})},tn=({loading:e=!0,wrapperClassName:t,spinnerClassName:r})=>l.jsx("div",{className:k("flex justify-center",t),children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",className:k({"animate-spin":e},r),children:l.jsx("path",{fill:"currentColor",d:"M10 3a7 7 0 0 0-7 7a.5.5 0 0 1-1 0a8 8 0 1 1 8 8a.5.5 0 0 1 0-1a7 7 0 1 0 0-14Z"})})}),ei=({isEditable:e,isDeletable:t=!0,createUpdateLoading:r,deleteLoading:n,onDelete:s,onDeleteConfirm:o,addText:a="Añadir",updateText:i="Actualizar",deleteText:u="Eliminar",className:c})=>{const[d,m]=f.useState(!1);return l.jsxs("div",{className:`w-full grid grid-cols-2 gap-4 col-span-full ${c}`,children:[e&&t?l.jsxs(q,{color:"dangersolid",state:n?"loading":r?"disabled":"enabled",onClick:()=>{o?d?s?.():m(!0):s?.()},children:[l.jsx(I.X,{size:18}),o&&d?"Confirmar":u]}):null,l.jsxs(q,{color:"brand",className:k(e&&t?"":"col-span-2"),state:r?"loading":n?"disabled":"enabled",type:"submit",children:[r?l.jsx(tn,{}):e?l.jsx(I.Check,{size:18}):l.jsx(I.Plus,{size:18}),e?i:a]})]})},rn=f.createContext(void 0),ti=({children:e,debug:t=!1})=>{const r=f.useRef([]),n=f.useCallback(d=>{r.current.push(d),t&&console.log("Modal",d,"added",r.current)},[t]),s=f.useCallback(d=>{r.current=r.current.filter(m=>m!==d),t&&console.log("Modal",d,"removed",r.current)},[t]),o=f.useCallback(()=>{const d=r.current[r.current.length-2];return t&&console.log("prev modal id",d),d},[t]),a=f.useCallback((d,m="modal",h)=>{L.animate(d,{y:m==="modal"?-30:-50,scale:.9},{ease:[.32,.72,0,1],duration:.3,delay:h?.2:void 0})},[]),i=f.useCallback(d=>{L.animate(d,{y:0,scale:1},{ease:[.32,.72,0,1],duration:.2})},[]),u=f.useCallback(()=>r.current,[]),c={add:n,remove:s,getPrevId:o,animateParentModal:a,restoreParentModal:i,getModals:u};return l.jsx(rn.Provider,{value:c,children:e})},nn=()=>{const e=f.useContext(rn);if(e===void 0)throw new Error("useModals must be used within a ModalsProvider");return e},ri=({withPortal:e,children:t})=>e?l.jsx(Fe,{children:t}):l.jsx(l.Fragment,{children:t}),ni=({id:e,prevPath:t,withDelay:r,withPortal:n=!0,title:s,description:o,showHeader:a=!0,mode:i,onReplace:u,className:c,contentClassName:d,children:m})=>{const h=ue.useInitialChangeEvent(),p=Be(),b=f.useRef(null),v=nn(),x=f.useMemo(()=>i==="modal"||p,[i,p]);return f.useEffect(()=>{v.add(e);const $=v.getPrevId();if(!$||(b.current=document.getElementById($),!b.current))return;$&&v.animateParentModal(b.current,x?"modal":"sheet");//! cleanups not running on new router system
11
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),f=require("react"),hr=require("react-dom"),mn=require("clsx"),hn=require("tailwind-merge"),bn=require("@mateosuarezdev/atoms"),A=require("lucide-react"),P=require("framer-motion"),de=require("@mateosuarezdev/react-router"),J=require("react-hook-form"),Ge=require("@hookform/resolvers"),br=require("@mateosuarezdev/gestures"),k=(...e)=>hn.twMerge(mn.clsx(e));function Le(e,t=100){let r=null,n=null;return function(...s){const o=Date.now();r===null||o-r>=t?(e.apply(this,s),r=o):(n&&clearTimeout(n),n=setTimeout(()=>{e.apply(this,s),r=Date.now()},t-(o-r)))}}function pn(e,t=500){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{e.apply(this,n),r=null},t)}}function pr(e){if(!e)return"";const r=e.trim().replace(/\s+/g," ").split(" ");return r.length===0||r[0]===""?"":r.length===1?r[0].charAt(0).toUpperCase():(r[0].charAt(0)+r[1].charAt(0)).toUpperCase()}function gr(e){e.focus();const t=e.value.length;e.setSelectionRange(t,t)}function xr(e){return e.replace(/\s/g,"")}function gn(e){return e.toLowerCase().split(" ").map(s=>{if(s.length===0)return s;const o=[...s][0],a=s.slice(o.length);return o.toUpperCase()+a}).join(" ")}function Pt(e){return e===null?"":e}function rt(e){return xr(e)===""?null:e}function xn(e,t,r={}){const n={...r};return Object.keys(t).forEach(s=>{if(t[s]===!0&&s in e){const o=s;n[o]=e[o]}}),n}class vn{constructor(){this.container=null,this.previouslyFocusedElement=null}enable(){this.container&&(this.previouslyFocusedElement=document.activeElement,this.container.addEventListener("keydown",this.trapFocus.bind(this)),document.addEventListener("click",this.handleClickOutside.bind(this)))}disable(){this.container&&(this.container.removeEventListener("keydown",this.trapFocus.bind(this)),document.removeEventListener("click",this.handleClickOutside.bind(this)),this.previouslyFocusedElement&&this.previouslyFocusedElement.focus&&this.previouslyFocusedElement.focus())}setContainer(t){this.disable(),this.container=t,this.enable()}trapFocus(t){const r=this.container?.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!r)return;const n=r[0],s=r[r.length-1];t.key==="Tab"&&(t.shiftKey&&document.activeElement===n?(t.preventDefault(),s.focus()):!t.shiftKey&&document.activeElement===s&&(t.preventDefault(),n.focus()))}handleClickOutside(t){this.container&&!this.container.contains(t.target)&&(t.preventDefault(),this.previouslyFocusedElement&&this.previouslyFocusedElement.focus&&this.previouslyFocusedElement.focus())}}const Ye=e=>{const t=e.scrollWidth>e.clientWidth,r=e.scrollHeight>e.clientHeight,n=Math.max(0,e.scrollWidth-e.clientWidth),s=Math.max(0,e.scrollHeight-e.clientHeight);return{horizontal:t,vertical:r,scrollWidth:e.scrollWidth,clientWidth:e.clientWidth,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,canScrollLeft:e.scrollLeft>10,canScrollRight:e.scrollLeft<n-10,canScrollUp:e.scrollTop>0,canScrollDown:e.scrollTop<s,scrollPercentageX:t&&n>0?e.scrollLeft/n*100:0,scrollPercentageY:r&&s>0?e.scrollTop/s*100:0}},vr=({onOverflow:e,trackScroll:t=!1,withObserver:r=!1,enabled:n=!0,deps:s=[]}={})=>{const o=f.useRef(null);return f.useEffect(()=>{if(!o.current||!n)return;let a=!1;const u=Le(()=>{if(o.current){const h=Ye(o.current);e?.(h)}}),c=Ye(o.current);a=c.horizontal||c.vertical,e?.(c),window.addEventListener("resize",u);let d=null;r&&(d=new ResizeObserver(u),o.current&&d.observe(o.current));let m=null;return t&&a&&(m=o.current,m.addEventListener("scroll",u)),()=>{window.removeEventListener("resize",u),d&&d.disconnect(),m&&a&&m.removeEventListener("scroll",u)}},[n,...s]),{ref:o}},wn=({trackScroll:e=!1,withObserver:t=!1,enabled:r=!0,deps:n=[]}={})=>{const s=f.useRef(null),[o,a]=f.useState(null);return f.useEffect(()=>{if(!s.current||!r)return;let i=!1;const c=Le(()=>{if(s.current){const p=Ye(s.current);a(p)}}),d=Ye(s.current);i=d.horizontal||d.vertical,a(d),window.addEventListener("resize",c);let m=null;t&&(m=new ResizeObserver(c),s.current&&m.observe(s.current));let h=null;return e&&i&&(h=s.current,h.addEventListener("scroll",c)),()=>{window.removeEventListener("resize",c),m&&m.disconnect(),h&&i&&h.removeEventListener("scroll",c)}},[r,...n]),{ref:s,overflowInfo:o}},vt={xs:"w-8 h-8",sm:"w-10 h-10 text-lg",md:"w-14 h-14 text-xl",lg:"h-20 w-20 text-2xl",xl:"h-24 w-24 text-2xl"},yn=({src:e,name:t,size:r="md",className:n})=>e?l.jsx("img",{alt:"avatar",src:e,className:k("rounded-full bg-base-3",vt[r])}):t?l.jsx("p",{className:k("rounded-full font-medium dark-theme:bg-base-3 border border-base-6 dark-theme:border-base-4 flex items-center justify-center",vt[r],n),children:pr(t)}):l.jsx("div",{className:k("rounded-full text-2xl font-medium flex items-center justify-center","bg-base-2 dark-theme:bg-base-3 border border-base-4","lg:hover:bg-base-3 max-lg:active:bg-base-4 transition-colors",vt[r],n),children:l.jsxs(Vr,{size:r==="xs"?16:r==="sm"?20:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),l.jsx("circle",{cx:"12",cy:"7",r:"4"})]})});function kn({className:e,children:t,animate:r=!1,...n}){return l.jsx("div",{className:k("flex -space-x-3 rtl:space-x-reverse",e),...n,children:t})}function Nn(e){return f.useSyncExternalStore(t=>e.subscribe(t),()=>e.get(),()=>e.get())}const Et=bn.atom(typeof window<"u"?window.innerWidth>1024:!0);let wt=!1;const Kt=Le(()=>{Et.set(window.innerWidth>1024)});typeof window<"u"&&(wt&&(window.removeEventListener("resize",Kt),wt=!1),window.addEventListener("resize",Kt),wt=!0);const qe=()=>(f.useLayoutEffect(()=>{Et.set(window.innerWidth>1024)},[]),Nn(Et));function Ot(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}const wr=(e=!0,t)=>{const r=qe(),n=f.useRef(null),s=f.useCallback(o=>{if(!e||r)return;const a=n.current;if(!a)return;const i=a.getBoundingClientRect(),u=Math.max(i.width,i.height),c=o.clientX-i.left-u/2,d=o.clientY-i.top-u/2,m=document.createElement("span");m.classList.add("ripple-wrapper");const h=document.createElement("span");h.classList.add("ripple"),h.style.backgroundColor=t?"var(--ripple-contrast)":"var(--ripple-main)",h.style.width=`${u}px`,h.style.height=`${u}px`,h.style.left=`${c}px`,h.style.top=`${d}px`,m.appendChild(h);const p=a.getElementsByClassName("ripple-wrapper");if(p?.length)for(const b of p)b.remove();a.appendChild(m),setTimeout(()=>{m.remove()},700)},[e,r,t]);return{ref:n,ripple:s,styles:{position:"relative"}}},dt=({scrollerId:e,align:t="start",side:r="bottom",offset:n=8,collisionPadding:s=8,avoidCollisions:o=!0,closeOnScroll:a=!0,onOpen:i,onClose:u}={})=>{const[c,d]=f.useState(!1),[m,h]=f.useState({width:192,height:300}),p=f.useRef(null),b=f.useRef(null),x=f.useRef({left:0,right:0,top:0,bottom:0,x:0,y:0,width:0,height:0}),v=f.useRef(null),C=f.useId(),j=f.useCallback(y=>{const N=y??x.current;if(!N)return{x:0,top:0,bottom:void 0};const O=m.width,W=m.height;return yr({triggerRect:N,popoverWidth:O,popoverHeight:W,align:t,side:r,offset:n,collisionPadding:s,avoidCollisions:o})},[x.current,m,t,r]);f.useEffect(()=>{if(!c||!e||(v.current=document.getElementById(e),!v.current))return;c&&R();const y=()=>{v.current&&(d(!1),i?.(),v.current.removeEventListener("scroll",y))};return a&&v.current.addEventListener("scroll",y,{passive:!0}),()=>{v.current&&v.current.removeEventListener("scroll",y)}},[c,e]);const R=()=>{b.current&&h({width:b.current.offsetWidth,height:b.current.offsetHeight})},T=f.useCallback(()=>{if(!p.current)return;const y=p.current.getBoundingClientRect();x.current={left:y.left,right:y.right,top:y.top,bottom:y.bottom,x:y.x,y:y.y,width:y.width,height:y.height},d(N=>(N?u?.():i?.(),!N))},[]),M=f.useCallback(()=>{d(!1),u?.()},[]);return{triggerRef:p,triggerProps:{id:C,"aria-expanded":c,"aria-haspopup":!0},popoverRef:b,getPopoverPosition:j,open:c,toggle:T,close:M}},yr=({triggerRect:e,popoverWidth:t,popoverHeight:r,align:n="start",side:s="bottom",offset:o=4,collisionPadding:a=8,avoidCollisions:i=!0})=>{const u={width:window.innerWidth,height:window.innerHeight};let c=0,d=0;if(i){if(s==="right"){const p=e.right+o,b=e.left-t-o,x=Math.max(0,p+t-(u.width-a)),v=Math.max(0,a-b);x<=v?(c=p,x>0&&(c=u.width-t-a)):(c=b,v>0&&(c=a)),d=e.top,d+r>u.height-a&&(d=u.height-r-a),d<a&&(d=a)}else if(s==="left"){const p=e.left-t-o,b=e.right+o,x=Math.max(0,a-p),v=Math.max(0,b+t-(u.width-a));x<=v?(c=p,x>0&&(c=a)):(c=b,v>0&&(c=u.width-t-a)),d=e.top,d+r>u.height-a&&(d=u.height-r-a),d<a&&(d=a)}else if(s==="bottom"){const p=u.height-e.bottom,b=e.top;p>=r+o?d=e.bottom+o:b>=r+o?d=e.top-r-o:(d=e.bottom+o,d=Math.min(d,u.height-r-a));const x=u.width-e.left,v=e.right;if(n==="start")c=e.left,c+t>u.width-a&&(v>=t?c=e.right-t:c=u.width-t-a);else if(n==="end")c=e.right-t,c<a&&(x>=t?c=e.left:c=a);else{const C=e.left+e.width/2-t/2;C>=a&&C+t<=u.width-a?c=C:C<a?c=a:c=u.width-t-a}}else{const p=e.top,b=u.height-e.bottom;p>=r+o?d=e.top-r-o:b>=r+o?d=e.bottom+o:(d=e.top-r-o,d=Math.max(a,d));const x=u.width-e.left,v=e.right;if(n==="start")c=e.left,c+t>u.width-a&&(v>=t?c=e.right-t:c=u.width-t-a);else if(n==="end")c=e.right-t,c<a&&(x>=t?c=e.left:c=a);else{const C=e.left+e.width/2-t/2;C>=a&&C+t<=u.width-a?c=C:C<a?c=a:c=u.width-t-a}}c=Math.max(a,Math.min(c,u.width-t-a)),d=Math.max(a,Math.min(d,u.height-r-a))}else s==="right"?(c=e.right+o,d=e.top):s==="left"?(c=e.left-t-o,d=e.top):s==="bottom"?d=e.bottom+o:d=e.top-r-o,(s==="top"||s==="bottom")&&(n==="start"?c=e.left:n==="end"?c=e.right-t:c=e.left+e.width/2-t/2);let m,h;return d+r<=e.top?h=window.innerHeight-(d+r):m=d,{x:c,top:m,bottom:h}};function En(e){const t=f.useRef(null);return f.useEffect(()=>{const r=n=>{t.current&&!t.current.contains(n.target)&&e()};return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r)}},[e]),t}function Cn(e,t={}){const{enabled:r=!0,events:n=["mousedown","touchstart"],excludeRefs:s=[]}=t,o=f.useRef(null);return f.useEffect(()=>{if(!r)return;const a=i=>{const u=i.target;o.current?.contains(u)||s.some(d=>d.current?.contains(u))||e()};return n.forEach(i=>{document.addEventListener(i,a)}),()=>{n.forEach(i=>{document.removeEventListener(i,a)})}},[e,r,n,s]),o}function ft(e,t,r=!0){f.useEffect(()=>{if(!r)return;const n=s=>{e.current&&!e.current.contains(s.target)&&t(s)};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[e,t,r])}function kr(e,{target:t=window,event:r="keydown",enabled:n}={}){const s=f.useRef(e);f.useEffect(()=>{s.current=e},[e]),f.useEffect(()=>{if(!n)return;const o=a=>{const i=a.key,u=s.current[i];u&&u(a)};return t.addEventListener(r,o),()=>{t.removeEventListener(r,o)}},[t,r,n])}const jn="relative shrink-0 select-none transition outline-none duration-200 ease-out focus-visible:ring-border-brand-light flex items-center justify-center cursor-pointer",$n={xs:"text-xs px-1 gap-x-1 py-1",sm:"text-sm px-2.5 gap-x-1 py-1.5",mdsm:"text-sm px-3 gap-x-1.5 py-2.5",md:"text-base px-4 gap-x-1.5 py-2.5",lg:"text-base px-4 gap-x-1.5 py-3.5",picker:"text-base px-2 py-2 gap-x-1.5",iconXs:"text-xs p-1",iconSm:"text-sm p-2",iconMd:"text-base p-3",iconLg:"text-base p-4"},Sn={all:"focus-visible:ring-1",desktop:"lg:focus-visible:ring-1",mobile:"focus-visible:ring-1 lg:focus-ring-0",none:""},Tn={light:"font-light",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},Mn={none:"rounded-none",1:"rounded-1",2:"rounded-2",3:"rounded-3",4:"rounded-4",5:"rounded-5",6:"rounded-6",7:"rounded-7",8:"rounded-8",9:"rounded-9",10:"rounded-10",11:"rounded-11",12:"rounded-12",full:"rounded-full"},Dn={transparent:"text-base-12 lg:hover:bg-base-4 focus-visible:ring-base-6",transparentinactive:"text-base-11 lg:hover:bg-base-4",brand:"bg-brand text-brand-text lg:hover:bg-brand-hover focus-visible:ring-base-6 border border-transparent",accent:"bg-accent text-accent-text lg:hover:bg-accent-hover",contrast:"bg-base-12 text-base-1 lg:hover:bg-base-11 focus-visible:ring-base-6",solid:"bg-base-3 dark-theme:bg-base-3 lg:hover:bg-base-4 border border-base-4 focus-visible:ring-base-5",solidhybrid:"border border-base-5 dark-theme:border-base-4 dark-theme:bg-base-3 lg:hover:bg-base-4 focus-visible:ring-base-6",outline:"border border-base-6 lg:hover:bg-base-3 focus-visible:ring-base-6",info:"bg-blue-3 text-blue-9 lg:hover:bg-blue-4 lg:active:bg-blue-5 focus-visible:ring-blue-9 border border-transparent",success:"bg-green-4 text-green-9 lg:hover:bg-green-5 lg:active:bg-green-6 focus-visible:ring-green-9 border border-transparent",warning:"bg-yellow-4 text-yellow-9 lg:hover:bg-yellow-5 lg:active:bg-yellow-6 focus-visible:ring-yellow-9 border border-transparent",danger:"bg-red-4 text-red-9 lg:hover:bg-red-5 focus-visible:ring-red-9 border border-transparent",dangersolid:"bg-red-9 text-base-1 dark-theme:text-base-12 lg:hover:bg-red-8 focus-visible:ring-base-6 border border-transparent",disabled:"bg-base-3 text-base-11 border border-transparent"},Pn={enabled:"",disabled:"opacity-75",loading:""},q=f.forwardRef(({color:e="transparent",size:t="mdsm",fontWeight:r="normal",rounded:n="6",state:s="enabled",onClick:o,className:a,children:i,withRipple:u=!0,contrastRipple:c,showFocus:d="desktop",withDisabledDelay:m=!1,type:h="button",...p},b)=>{const[x,v]=f.useState(!1),C=M=>{s==="enabled"&&(m?(v(!0),o&&o(M),setTimeout(()=>v(!1),1e3)):o&&o(M))},{ref:j,ripple:R}=wr(u,e==="contrast"||c),T=Ot(j,b);return l.jsx("button",{ref:T,type:h,disabled:p.disabled?p.disabled:s==="disabled"||s==="loading",onMouseDown:R,onClick:M=>x?null:C(M),className:k(jn,$n[t],Tn[r],Mn[n],Sn[d],Dn[e],Pn[s],p.disabled&&"opacity-50",a),...p,children:i})});q.displayName="Button";const Nr=6048e5,On=864e5,Ut=Symbol.for("constructDateFrom");function se(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Ut in e?e[Ut](t):e instanceof Date?new e.constructor(t):new Date(t)}function Z(e,t){return se(t||e,e)}function et(e,t,r){const n=Z(e,r?.in);if(isNaN(t))return se(e,NaN);if(!t)return n;const s=n.getDate(),o=se(e,n.getTime());o.setMonth(n.getMonth()+t+1,0);const a=o.getDate();return s>=a?o:(n.setFullYear(o.getFullYear(),o.getMonth(),s),n)}let Fn={};function mt(){return Fn}function Ie(e,t){const r=mt(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=Z(e,t?.in),o=s.getDay(),a=(o<n?7:0)+o-n;return s.setDate(s.getDate()-a),s.setHours(0,0,0,0),s}function nt(e,t){return Ie(e,{...t,weekStartsOn:1})}function Er(e,t){const r=Z(e,t?.in),n=r.getFullYear(),s=se(r,0);s.setFullYear(n+1,0,4),s.setHours(0,0,0,0);const o=nt(s),a=se(r,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const i=nt(a);return r.getTime()>=o.getTime()?n+1:r.getTime()>=i.getTime()?n:n-1}function Gt(e){const t=Z(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function ht(e,...t){const r=se.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}function st(e,t){const r=Z(e,t?.in);return r.setHours(0,0,0,0),r}function Ln(e,t,r){const[n,s]=ht(r?.in,e,t),o=st(n),a=st(s),i=+o-Gt(o),u=+a-Gt(a);return Math.round((i-u)/On)}function Rn(e,t){const r=Er(e,t),n=se(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),nt(n)}function yt(e,t,r){const[n,s]=ht(r?.in,e,t);return+st(n)==+st(s)}function An(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Wn(e){return!(!An(e)&&typeof e!="number"||isNaN(+Z(e)))}function _n(e,t){const r=Z(e,t?.in),n=r.getMonth();return r.setFullYear(r.getFullYear(),n+1,0),r.setHours(23,59,59,999),r}function Yn(e,t){const[r,n]=ht(e,t.start,t.end);return{start:r,end:n}}function In(e,t){const{start:r,end:n}=Yn(t?.in,e);let s=+r>+n;const o=s?+r:+n,a=s?n:r;a.setHours(0,0,0,0);let i=1;const u=[];for(;+a<=o;)u.push(se(r,a)),a.setDate(a.getDate()+i),a.setHours(0,0,0,0);return s?u.reverse():u}function zn(e,t){const r=Z(e,t?.in);return r.setDate(1),r.setHours(0,0,0,0),r}function Hn(e,t){const r=Z(e,t?.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}const Bn={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},qn=(e,t,r)=>{let n;const s=Bn[e];return typeof s=="string"?n=s:t===1?n=s.one:n=s.other.replace("{{count}}",t.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function De(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const Xn={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Vn={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Kn={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Un={date:De({formats:Xn,defaultWidth:"full"}),time:De({formats:Vn,defaultWidth:"full"}),dateTime:De({formats:Kn,defaultWidth:"full"})},Gn={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Qn=(e,t,r,n)=>Gn[e];function le(e){return(t,r)=>{const n=r?.context?String(r.context):"standalone";let s;if(n==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,i=r?.width?String(r.width):a;s=e.formattingValues[i]||e.formattingValues[a]}else{const a=e.defaultWidth,i=r?.width?String(r.width):e.defaultWidth;s=e.values[i]||e.values[a]}const o=e.argumentCallback?e.argumentCallback(t):t;return s[o]}}const Jn={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Zn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},es={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ts={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},rs={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},ns={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ss=(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},os={ordinalNumber:ss,era:le({values:Jn,defaultWidth:"wide"}),quarter:le({values:Zn,defaultWidth:"wide",argumentCallback:e=>e-1}),month:le({values:es,defaultWidth:"wide"}),day:le({values:ts,defaultWidth:"wide"}),dayPeriod:le({values:rs,defaultWidth:"wide",formattingValues:ns,defaultFormattingWidth:"wide"})};function ce(e){return(t,r={})=>{const n=r.width,s=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],o=t.match(s);if(!o)return null;const a=o[0],i=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(i)?is(i,m=>m.test(a)):as(i,m=>m.test(a));let c;c=e.valueCallback?e.valueCallback(u):u,c=r.valueCallback?r.valueCallback(c):c;const d=t.slice(a.length);return{value:c,rest:d}}}function as(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function is(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function Cr(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const s=n[0],o=t.match(e.parsePattern);if(!o)return null;let a=e.valueCallback?e.valueCallback(o[0]):o[0];a=r.valueCallback?r.valueCallback(a):a;const i=t.slice(s.length);return{value:a,rest:i}}}const ls=/^(\d+)(th|st|nd|rd)?/i,cs=/\d+/i,us={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},ds={any:[/^b/i,/^(a|c)/i]},fs={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ms={any:[/1/i,/2/i,/3/i,/4/i]},hs={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},bs={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ps={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},gs={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},xs={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},vs={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ws={ordinalNumber:Cr({matchPattern:ls,parsePattern:cs,valueCallback:e=>parseInt(e,10)}),era:ce({matchPatterns:us,defaultMatchWidth:"wide",parsePatterns:ds,defaultParseWidth:"any"}),quarter:ce({matchPatterns:fs,defaultMatchWidth:"wide",parsePatterns:ms,defaultParseWidth:"any",valueCallback:e=>e+1}),month:ce({matchPatterns:hs,defaultMatchWidth:"wide",parsePatterns:bs,defaultParseWidth:"any"}),day:ce({matchPatterns:ps,defaultMatchWidth:"wide",parsePatterns:gs,defaultParseWidth:"any"}),dayPeriod:ce({matchPatterns:xs,defaultMatchWidth:"any",parsePatterns:vs,defaultParseWidth:"any"})},jr={code:"en-US",formatDistance:qn,formatLong:Un,formatRelative:Qn,localize:os,match:ws,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ys(e,t){const r=Z(e,t?.in);return Ln(r,Hn(r))+1}function ks(e,t){const r=Z(e,t?.in),n=+nt(r)-+Rn(r);return Math.round(n/Nr)+1}function $r(e,t){const r=Z(e,t?.in),n=r.getFullYear(),s=mt(),o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=se(t?.in||e,0);a.setFullYear(n+1,0,o),a.setHours(0,0,0,0);const i=Ie(a,t),u=se(t?.in||e,0);u.setFullYear(n,0,o),u.setHours(0,0,0,0);const c=Ie(u,t);return+r>=+i?n+1:+r>=+c?n:n-1}function Ns(e,t){const r=mt(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=$r(e,t),o=se(t?.in||e,0);return o.setFullYear(s,0,n),o.setHours(0,0,0,0),Ie(o,t)}function Es(e,t){const r=Z(e,t?.in),n=+Ie(r,t)-+Ns(r,t);return Math.round(n/Nr)+1}function I(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const be={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return I(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):I(r+1,2)},d(e,t){return I(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return I(e.getHours()%12||12,t.length)},H(e,t){return I(e.getHours(),t.length)},m(e,t){return I(e.getMinutes(),t.length)},s(e,t){return I(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),s=Math.trunc(n*Math.pow(10,r-3));return I(s,t.length)}},Te={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Qt={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),s=n>0?n:1-n;return r.ordinalNumber(s,{unit:"year"})}return be.y(e,t)},Y:function(e,t,r,n){const s=$r(e,n),o=s>0?s:1-s;if(t==="YY"){const a=o%100;return I(a,2)}return t==="Yo"?r.ordinalNumber(o,{unit:"year"}):I(o,t.length)},R:function(e,t){const r=Er(e);return I(r,t.length)},u:function(e,t){const r=e.getFullYear();return I(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return I(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return I(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return be.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return I(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const s=Es(e,n);return t==="wo"?r.ordinalNumber(s,{unit:"week"}):I(s,t.length)},I:function(e,t,r){const n=ks(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):I(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):be.d(e,t)},D:function(e,t,r){const n=ys(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):I(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const s=e.getDay(),o=(s-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return I(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const s=e.getDay(),o=(s-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return I(o,t.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),s=n===0?7:n;switch(t){case"i":return String(s);case"ii":return I(s,t.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let s;switch(n===12?s=Te.noon:n===0?s=Te.midnight:s=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let s;switch(n>=17?s=Te.evening:n>=12?s=Te.afternoon:n>=4?s=Te.morning:s=Te.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return be.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):be.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):I(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):I(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):be.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):be.s(e,t)},S:function(e,t){return be.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return Zt(n);case"XXXX":case"XX":return ye(n);case"XXXXX":case"XXX":default:return ye(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return Zt(n);case"xxxx":case"xx":return ye(n);case"xxxxx":case"xxx":default:return ye(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Jt(n,":");case"OOOO":default:return"GMT"+ye(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Jt(n,":");case"zzzz":default:return"GMT"+ye(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return I(n,t.length)},T:function(e,t,r){return I(+e,t.length)}};function Jt(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),s=Math.trunc(n/60),o=n%60;return o===0?r+String(s):r+String(s)+t+I(o,2)}function Zt(e,t){return e%60===0?(e>0?"-":"+")+I(Math.abs(e)/60,2):ye(e,t)}function ye(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),s=I(Math.trunc(n/60),2),o=I(n%60,2);return r+s+t+o}const er=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Sr=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Cs=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],s=r[2];if(!s)return er(e,t);let o;switch(n){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",er(n,t)).replace("{{time}}",Sr(s,t))},js={p:Sr,P:Cs},$s=/^D+$/,Ss=/^Y+$/,Ts=["D","DD","YY","YYYY"];function Ms(e){return $s.test(e)}function Ds(e){return Ss.test(e)}function Ps(e,t,r){const n=Os(e,t,r);if(console.warn(n),Ts.includes(e))throw new RangeError(n)}function Os(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Fs=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ls=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Rs=/^'([^]*?)'?$/,As=/''/g,Ws=/[a-zA-Z]/;function Ee(e,t,r){const n=mt(),s=r?.locale??n.locale??jr,o=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Z(e,r?.in);if(!Wn(i))throw new RangeError("Invalid time value");let u=t.match(Ls).map(d=>{const m=d[0];if(m==="p"||m==="P"){const h=js[m];return h(d,s.formatLong)}return d}).join("").match(Fs).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const m=d[0];if(m==="'")return{isToken:!1,value:_s(d)};if(Qt[m])return{isToken:!0,value:d};if(m.match(Ws))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:d}});s.localize.preprocessor&&(u=s.localize.preprocessor(i,u));const c={firstWeekContainsDate:o,weekStartsOn:a,locale:s};return u.map(d=>{if(!d.isToken)return d.value;const m=d.value;(!r?.useAdditionalWeekYearTokens&&Ds(m)||!r?.useAdditionalDayOfYearTokens&&Ms(m))&&Ps(m,t,String(e));const h=Qt[m[0]];return h(i,m,s.localize,c)}).join("")}function _s(e){const t=e.match(Rs);return t?t[1].replace(As,"'"):e}function tr(e,t,r){const[n,s]=ht(r?.in,e,t);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()}function kt(e,t,r){return et(e,-t,r)}const Ys={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},Is=(e,t,r)=>{let n;const s=Ys[e];return typeof s=="string"?n=s:t===1?n=s.one:n=s.other.replace("{{count}}",t.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"en "+n:"hace "+n:n},zs={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},Hs={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Bs={full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},qs={date:De({formats:zs,defaultWidth:"full"}),time:De({formats:Hs,defaultWidth:"full"}),dateTime:De({formats:Bs,defaultWidth:"full"})},Xs={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},Vs={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},Ks=(e,t,r,n)=>t.getHours()!==1?Vs[e]:Xs[e],Us={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},Gs={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},Qs={narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},Js={narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},Zs={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},eo={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},to=(e,t)=>Number(e)+"º",ro={ordinalNumber:to,era:le({values:Us,defaultWidth:"wide"}),quarter:le({values:Gs,defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:le({values:Qs,defaultWidth:"wide"}),day:le({values:Js,defaultWidth:"wide"}),dayPeriod:le({values:Zs,defaultWidth:"wide",formattingValues:eo,defaultFormattingWidth:"wide"})},no=/^(\d+)(º)?/i,so=/\d+/i,oo={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},ao={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},io={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},lo={any:[/1/i,/2/i,/3/i,/4/i]},co={narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},uo={narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},fo={narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},mo={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},ho={narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},bo={any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},po={ordinalNumber:Cr({matchPattern:no,parsePattern:so,valueCallback:function(e){return parseInt(e,10)}}),era:ce({matchPatterns:oo,defaultMatchWidth:"wide",parsePatterns:ao,defaultParseWidth:"any"}),quarter:ce({matchPatterns:io,defaultMatchWidth:"wide",parsePatterns:lo,defaultParseWidth:"any",valueCallback:e=>e+1}),month:ce({matchPatterns:co,defaultMatchWidth:"wide",parsePatterns:uo,defaultParseWidth:"any"}),day:ce({matchPatterns:fo,defaultMatchWidth:"wide",parsePatterns:mo,defaultParseWidth:"any"}),dayPeriod:ce({matchPatterns:ho,defaultMatchWidth:"any",parsePatterns:bo,defaultParseWidth:"any"})},ze={code:"es",formatDistance:Is,formatLong:qs,formatRelative:Ks,localize:ro,match:po,options:{weekStartsOn:1,firstWeekContainsDate:1}},ue=typeof document<"u"?f.useLayoutEffect:()=>{},K=e=>{var t;return(t=e?.ownerDocument)!==null&&t!==void 0?t:document},ot=e=>e&&"window"in e&&e.window===e?e:K(e).defaultView||window;function go(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function xo(e){return go(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let vo=!1;function bt(){return vo}function rr(e,t){if(!bt())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let r=t;for(;r!==null;){if(r===e)return!0;r.tagName==="SLOT"&&r.assignedSlot?r=r.assignedSlot.parentNode:xo(r)?r=r.host:r=r.parentNode}return!1}const ne=(e=document)=>{var t;if(!bt())return e.activeElement;let r=e.activeElement;for(;r&&"shadowRoot"in r&&(!((t=r.shadowRoot)===null||t===void 0)&&t.activeElement);)r=r.shadowRoot.activeElement;return r};function Me(e){return bt()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}class wo{get currentNode(){return this._currentNode}set currentNode(t){if(!rr(this.root,t))throw new Error("Cannot set currentNode to a node that is not contained by the root node.");const r=[];let n=t,s=t;for(this._currentNode=t;n&&n!==this.root;)if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const a=n,i=this._doc.createTreeWalker(a,this.whatToShow,{acceptNode:this._acceptNode});r.push(i),i.currentNode=s,this._currentSetFor.add(i),n=s=a.host}else n=n.parentNode;const o=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});r.push(o),o.currentNode=s,this._currentSetFor.add(o),this._walkerStack=r}get doc(){return this._doc}firstChild(){let t=this.currentNode,r=this.nextNode();return rr(t,r)?(r&&(this.currentNode=r),r):(this.currentNode=t,null)}lastChild(){let r=this._walkerStack[0].lastChild();return r&&(this.currentNode=r),r}nextNode(){const t=this._walkerStack[0].nextNode();if(t){if(t.shadowRoot){var r;let s;if(typeof this.filter=="function"?s=this.filter(t):!((r=this.filter)===null||r===void 0)&&r.acceptNode&&(s=this.filter.acceptNode(t)),s===NodeFilter.FILTER_ACCEPT)return this.currentNode=t,t;let o=this.nextNode();return o&&(this.currentNode=o),o}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let n=this.nextNode();return n&&(this.currentNode=n),n}else return null}previousNode(){const t=this._walkerStack[0];if(t.currentNode===t.root){if(this._currentSetFor.has(t))if(this._currentSetFor.delete(t),this._walkerStack.length>1){this._walkerStack.shift();let s=this.previousNode();return s&&(this.currentNode=s),s}else return null;return null}const r=t.previousNode();if(r){if(r.shadowRoot){var n;let o;if(typeof this.filter=="function"?o=this.filter(r):!((n=this.filter)===null||n===void 0)&&n.acceptNode&&(o=this.filter.acceptNode(r)),o===NodeFilter.FILTER_ACCEPT)return r&&(this.currentNode=r),r;let a=this.lastChild();return a&&(this.currentNode=a),a}return r&&(this.currentNode=r),r}else if(this._walkerStack.length>1){this._walkerStack.shift();let s=this.previousNode();return s&&(this.currentNode=s),s}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}constructor(t,r,n,s){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=a=>{if(a.nodeType===Node.ELEMENT_NODE){const u=a.shadowRoot;if(u){const c=this._doc.createTreeWalker(u,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(c),NodeFilter.FILTER_ACCEPT}else{var i;if(typeof this.filter=="function")return this.filter(a);if(!((i=this.filter)===null||i===void 0)&&i.acceptNode)return this.filter.acceptNode(a);if(this.filter===null)return NodeFilter.FILTER_ACCEPT}}return NodeFilter.FILTER_SKIP},this._doc=t,this.root=r,this.filter=s??null,this.whatToShow=n??NodeFilter.SHOW_ALL,this._currentNode=r,this._walkerStack.unshift(t.createTreeWalker(r,n,this._acceptNode));const o=r.shadowRoot;if(o){const a=this._doc.createTreeWalker(o,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(a)}}}function yo(e,t,r,n){return bt()?new wo(e,t,r,n):e.createTreeWalker(t,r,n)}function nr(e){if(ko())e.focus({preventScroll:!0});else{let t=No(e);e.focus(),Eo(t)}}let Qe=null;function ko(){if(Qe==null){Qe=!1;try{document.createElement("div").focus({get preventScroll(){return Qe=!0,!0}})}catch{}}return Qe}function No(e){let t=e.parentNode,r=[],n=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==n;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&r.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return n instanceof HTMLElement&&r.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),r}function Eo(e){for(let{element:t,scrollTop:r,scrollLeft:n}of e)t.scrollTop=r,t.scrollLeft=n}function pt(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let r=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(r)&&r.some(n=>e.test(n.brand))||e.test(window.navigator.userAgent)}function Ft(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function he(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Lt=he(function(){return Ft(/^Mac/i)}),Co=he(function(){return Ft(/^iPhone/i)}),jo=he(function(){return Ft(/^iPad/i)||Lt()&&navigator.maxTouchPoints>1}),$o=he(function(){return Co()||jo()});he(function(){return Lt()||$o()});he(function(){return pt(/AppleWebKit/i)&&!Tr()});const Tr=he(function(){return pt(/Chrome/i)}),Mr=he(function(){return pt(/Android/i)});he(function(){return pt(/Firefox/i)});let ge=new Map,Ct=new Set;function sr(){if(typeof window>"u")return;function e(n){return"propertyName"in n}let t=n=>{if(!e(n)||!n.target)return;let s=ge.get(n.target);s||(s=new Set,ge.set(n.target,s),n.target.addEventListener("transitioncancel",r,{once:!0})),s.add(n.propertyName)},r=n=>{if(!e(n)||!n.target)return;let s=ge.get(n.target);if(s&&(s.delete(n.propertyName),s.size===0&&(n.target.removeEventListener("transitioncancel",r),ge.delete(n.target)),ge.size===0)){for(let o of Ct)o();Ct.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",r)}typeof document<"u"&&(document.readyState!=="loading"?sr():document.addEventListener("DOMContentLoaded",sr));function So(){for(const[e]of ge)"isConnected"in e&&!e.isConnected&&ge.delete(e)}function To(e){requestAnimationFrame(()=>{So(),ge.size===0?e():Ct.add(e)})}function Mo(e){return e.pointerType===""&&e.isTrusted?!0:Mr()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}const Do=typeof Element<"u"&&"checkVisibility"in Element.prototype;function Po(e){const t=ot(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:r,visibility:n}=e.style,s=r!=="none"&&n!=="hidden"&&n!=="collapse";if(s){const{getComputedStyle:o}=e.ownerDocument.defaultView;let{display:a,visibility:i}=o(e);s=a!=="none"&&i!=="hidden"&&i!=="collapse"}return s}function Oo(e,t){return!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&(e.nodeName==="DETAILS"&&t&&t.nodeName!=="SUMMARY"?e.hasAttribute("open"):!0)}function Rt(e,t){return Do?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&Po(e)&&Oo(e,t)&&(!e.parentElement||Rt(e.parentElement,e))}const At=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable^="false"])',"permission"],Fo=At.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";At.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const Lo=At.join(':not([hidden]):not([tabindex="-1"]),');function Ro(e){return e.matches(Fo)&&Rt(e)&&!Dr(e)}function Ao(e){return e.matches(Lo)&&Rt(e)&&!Dr(e)}function Dr(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}let Wo=!1,Xe=null,_o=new Set,_e=new Map,Ce=!1,jt=!1;function Wt(e,t){for(let r of _o)r(e,t)}function Yo(e){return!(e.metaKey||!Lt()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function at(e){Ce=!0,Yo(e)&&(Xe="keyboard",Wt("keyboard",e))}function ee(e){Xe="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Ce=!0,Wt("pointer",e))}function Pr(e){Mo(e)&&(Ce=!0,Xe="virtual")}function Or(e){e.target===window||e.target===document||Wo||!e.isTrusted||(!Ce&&!jt&&(Xe="virtual",Wt("virtual",e)),Ce=!1,jt=!1)}function Fr(){Ce=!1,jt=!0}function or(e){if(typeof window>"u"||typeof document>"u"||_e.get(ot(e)))return;const t=ot(e),r=K(e);let n=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Ce=!0,n.apply(this,arguments)},r.addEventListener("keydown",at,!0),r.addEventListener("keyup",at,!0),r.addEventListener("click",Pr,!0),t.addEventListener("focus",Or,!0),t.addEventListener("blur",Fr,!1),typeof PointerEvent<"u"?(r.addEventListener("pointerdown",ee,!0),r.addEventListener("pointermove",ee,!0),r.addEventListener("pointerup",ee,!0)):process.env.NODE_ENV==="test"&&(r.addEventListener("mousedown",ee,!0),r.addEventListener("mousemove",ee,!0),r.addEventListener("mouseup",ee,!0)),t.addEventListener("beforeunload",()=>{Lr(e)},{once:!0}),_e.set(t,{focus:n})}const Lr=(e,t)=>{const r=ot(e),n=K(e);t&&n.removeEventListener("DOMContentLoaded",t),_e.has(r)&&(r.HTMLElement.prototype.focus=_e.get(r).focus,n.removeEventListener("keydown",at,!0),n.removeEventListener("keyup",at,!0),n.removeEventListener("click",Pr,!0),r.removeEventListener("focus",Or,!0),r.removeEventListener("blur",Fr,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",ee,!0),n.removeEventListener("pointermove",ee,!0),n.removeEventListener("pointerup",ee,!0)):process.env.NODE_ENV==="test"&&(n.removeEventListener("mousedown",ee,!0),n.removeEventListener("mousemove",ee,!0),n.removeEventListener("mouseup",ee,!0)),_e.delete(r))};function Io(e){const t=K(e);let r;return t.readyState!=="loading"?or(e):(r=()=>{or(e)},t.addEventListener("DOMContentLoaded",r)),()=>Lr(e,r)}typeof document<"u"&&Io();function Rr(){return Xe}function zo(e){const t=K(e),r=ne(t);if(Rr()==="virtual"){let n=r;To(()=>{ne(t)===n&&e.isConnected&&nr(e)})}else nr(e)}const ar=f.createContext(null),$t="react-aria-focus-scope-restore";let z=null;function Ho(e){let{children:t,contain:r,restoreFocus:n,autoFocus:s}=e,o=f.useRef(null),a=f.useRef(null),i=f.useRef([]),{parentNode:u}=f.useContext(ar)||{},c=f.useMemo(()=>new Tt({scopeRef:i}),[i]);ue(()=>{let h=u||B.root;if(B.getTreeNode(h.scopeRef)&&z&&!it(z,h.scopeRef)){let p=B.getTreeNode(z);p&&(h=p)}h.addChild(c),B.addNode(c)},[c,u]),ue(()=>{let h=B.getTreeNode(i);h&&(h.contain=!!r)},[r]),ue(()=>{var h;let p=(h=o.current)===null||h===void 0?void 0:h.nextSibling,b=[],x=v=>v.stopPropagation();for(;p&&p!==a.current;)b.push(p),p.addEventListener($t,x),p=p.nextSibling;return i.current=b,()=>{for(let v of b)v.removeEventListener($t,x)}},[t]),Ko(i,n,r),Xo(i,r),Uo(i,n,r),Vo(i,s),f.useEffect(()=>{const h=ne(K(i.current?i.current[0]:void 0));let p=null;if(te(h,i.current)){for(let b of B.traverse())b.scopeRef&&te(h,b.scopeRef.current)&&(p=b);p===B.getTreeNode(i)&&(z=p.scopeRef)}},[i]),ue(()=>()=>{var h,p,b;let x=(b=(p=B.getTreeNode(i))===null||p===void 0||(h=p.parent)===null||h===void 0?void 0:h.scopeRef)!==null&&b!==void 0?b:null;(i===z||it(i,z))&&(!x||B.getTreeNode(x))&&(z=x),B.removeTreeNode(i)},[i]);let d=f.useMemo(()=>Bo(i),[]),m=f.useMemo(()=>({focusManager:d,parentNode:c}),[c,d]);return f.createElement(ar.Provider,{value:m},f.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,f.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:a}))}function Bo(e){return{focusNext(t={}){let r=e.current,{from:n,tabbable:s,wrap:o,accept:a}=t;var i;let u=n||ne(K((i=r[0])!==null&&i!==void 0?i:void 0)),c=r[0].previousElementSibling,d=ke(r),m=xe(d,{tabbable:s,accept:a},r);m.currentNode=te(u,r)?u:c;let h=m.nextNode();return!h&&o&&(m.currentNode=c,h=m.nextNode()),h&&fe(h,!0),h},focusPrevious(t={}){let r=e.current,{from:n,tabbable:s,wrap:o,accept:a}=t;var i;let u=n||ne(K((i=r[0])!==null&&i!==void 0?i:void 0)),c=r[r.length-1].nextElementSibling,d=ke(r),m=xe(d,{tabbable:s,accept:a},r);m.currentNode=te(u,r)?u:c;let h=m.previousNode();return!h&&o&&(m.currentNode=c,h=m.previousNode()),h&&fe(h,!0),h},focusFirst(t={}){let r=e.current,{tabbable:n,accept:s}=t,o=ke(r),a=xe(o,{tabbable:n,accept:s},r);a.currentNode=r[0].previousElementSibling;let i=a.nextNode();return i&&fe(i,!0),i},focusLast(t={}){let r=e.current,{tabbable:n,accept:s}=t,o=ke(r),a=xe(o,{tabbable:n,accept:s},r);a.currentNode=r[r.length-1].nextElementSibling;let i=a.previousNode();return i&&fe(i,!0),i}}}function ke(e){return e[0].parentElement}function Ae(e){let t=B.getTreeNode(z);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function qo(e){if(e.checked)return!0;let t=[];if(!e.form)t=[...K(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)].filter(o=>!o.form);else{var r,n;let o=(n=e.form)===null||n===void 0||(r=n.elements)===null||r===void 0?void 0:r.namedItem(e.name);t=[...o??[]]}return t?!t.some(o=>o.checked):!1}function Xo(e,t){let r=f.useRef(void 0),n=f.useRef(void 0);ue(()=>{let s=e.current;if(!t){n.current&&(cancelAnimationFrame(n.current),n.current=void 0);return}const o=K(s?s[0]:void 0);let a=c=>{if(c.key!=="Tab"||c.altKey||c.ctrlKey||c.metaKey||!Ae(e)||c.isComposing)return;let d=ne(o),m=e.current;if(!m||!te(d,m))return;let h=ke(m),p=xe(h,{tabbable:!0},m);if(!d)return;p.currentNode=d;let b=c.shiftKey?p.previousNode():p.nextNode();b||(p.currentNode=c.shiftKey?m[m.length-1].nextElementSibling:m[0].previousElementSibling,b=c.shiftKey?p.previousNode():p.nextNode()),c.preventDefault(),b&&fe(b,!0)},i=c=>{(!z||it(z,e))&&te(Me(c),e.current)?(z=e,r.current=Me(c)):Ae(e)&&!Ne(Me(c),e)?r.current?r.current.focus():z&&z.current&&St(z.current):Ae(e)&&(r.current=Me(c))},u=c=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{let d=Rr(),m=(d==="virtual"||d===null)&&Mr()&&Tr(),h=ne(o);if(!m&&h&&Ae(e)&&!Ne(h,e)){z=e;let b=Me(c);if(b&&b.isConnected){var p;r.current=b,(p=r.current)===null||p===void 0||p.focus()}else z.current&&St(z.current)}})};return o.addEventListener("keydown",a,!1),o.addEventListener("focusin",i,!1),s?.forEach(c=>c.addEventListener("focusin",i,!1)),s?.forEach(c=>c.addEventListener("focusout",u,!1)),()=>{o.removeEventListener("keydown",a,!1),o.removeEventListener("focusin",i,!1),s?.forEach(c=>c.removeEventListener("focusin",i,!1)),s?.forEach(c=>c.removeEventListener("focusout",u,!1))}},[e,t]),ue(()=>()=>{n.current&&cancelAnimationFrame(n.current)},[n])}function Ar(e){return Ne(e)}function te(e,t){return!e||!t?!1:t.some(r=>r.contains(e))}function Ne(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:r}of B.traverse(B.getTreeNode(t)))if(r&&te(e,r.current))return!0;return!1}function it(e,t){var r;let n=(r=B.getTreeNode(t))===null||r===void 0?void 0:r.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function fe(e,t=!1){if(e!=null&&!t)try{zo(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function Wr(e,t=!0){let r=e[0].previousElementSibling,n=ke(e),s=xe(n,{tabbable:t},e);s.currentNode=r;let o=s.nextNode();return t&&!o&&(n=ke(e),s=xe(n,{tabbable:!1},e),s.currentNode=r,o=s.nextNode()),o}function St(e,t=!0){fe(Wr(e,t))}function Vo(e,t){const r=f.useRef(t);f.useEffect(()=>{if(r.current){z=e;const n=K(e.current?e.current[0]:void 0);!te(ne(n),z.current)&&e.current&&St(e.current)}r.current=!1},[e])}function Ko(e,t,r){ue(()=>{if(t||r)return;let n=e.current;const s=K(n?n[0]:void 0);let o=a=>{let i=Me(a);te(i,e.current)?z=e:Ar(i)||(z=null)};return s.addEventListener("focusin",o,!1),n?.forEach(a=>a.addEventListener("focusin",o,!1)),()=>{s.removeEventListener("focusin",o,!1),n?.forEach(a=>a.removeEventListener("focusin",o,!1))}},[e,t,r])}function ir(e){let t=B.getTreeNode(z);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Uo(e,t,r){const n=f.useRef(typeof document<"u"?ne(K(e.current?e.current[0]:void 0)):null);ue(()=>{let s=e.current;const o=K(s?s[0]:void 0);if(!t||r)return;let a=()=>{(!z||it(z,e))&&te(ne(o),e.current)&&(z=e)};return o.addEventListener("focusin",a,!1),s?.forEach(i=>i.addEventListener("focusin",a,!1)),()=>{o.removeEventListener("focusin",a,!1),s?.forEach(i=>i.removeEventListener("focusin",a,!1))}},[e,r]),ue(()=>{const s=K(e.current?e.current[0]:void 0);if(!t)return;let o=a=>{if(a.key!=="Tab"||a.altKey||a.ctrlKey||a.metaKey||!Ae(e)||a.isComposing)return;let i=s.activeElement;if(!Ne(i,e)||!ir(e))return;let u=B.getTreeNode(e);if(!u)return;let c=u.nodeToRestore,d=xe(s.body,{tabbable:!0});d.currentNode=i;let m=a.shiftKey?d.previousNode():d.nextNode();if((!c||!c.isConnected||c===s.body)&&(c=void 0,u.nodeToRestore=void 0),(!m||!Ne(m,e))&&c){d.currentNode=c;do m=a.shiftKey?d.previousNode():d.nextNode();while(Ne(m,e));a.preventDefault(),a.stopPropagation(),m?fe(m,!0):Ar(c)?fe(c,!0):i.blur()}};return r||s.addEventListener("keydown",o,!0),()=>{r||s.removeEventListener("keydown",o,!0)}},[e,t,r]),ue(()=>{const s=K(e.current?e.current[0]:void 0);if(!t)return;let o=B.getTreeNode(e);if(o){var a;return o.nodeToRestore=(a=n.current)!==null&&a!==void 0?a:void 0,()=>{let i=B.getTreeNode(e);if(!i)return;let u=i.nodeToRestore,c=ne(s);if(t&&u&&(c&&Ne(c,e)||c===s.body&&ir(e))){let d=B.clone();requestAnimationFrame(()=>{if(s.activeElement===s.body){let m=d.getTreeNode(e);for(;m;){if(m.nodeToRestore&&m.nodeToRestore.isConnected){lr(m.nodeToRestore);return}m=m.parent}for(m=d.getTreeNode(e);m;){if(m.scopeRef&&m.scopeRef.current&&B.getTreeNode(m.scopeRef)){let h=Wr(m.scopeRef.current,!0);lr(h);return}m=m.parent}}})}}}},[e,t])}function lr(e){e.dispatchEvent(new CustomEvent($t,{bubbles:!0,cancelable:!0}))&&fe(e)}function xe(e,t,r){let n=t?.tabbable?Ao:Ro,s=e?.nodeType===Node.ELEMENT_NODE?e:null,o=K(s),a=yo(o,e||o,NodeFilter.SHOW_ELEMENT,{acceptNode(i){var u;return!(t==null||(u=t.from)===null||u===void 0)&&u.contains(i)||t?.tabbable&&i.tagName==="INPUT"&&i.getAttribute("type")==="radio"&&(!qo(i)||a.currentNode.tagName==="INPUT"&&a.currentNode.type==="radio"&&a.currentNode.name===i.name)?NodeFilter.FILTER_REJECT:n(i)&&(!r||te(i,r))&&(!t?.accept||t.accept(i))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(a.currentNode=t.from),a}class _t{get size(){return this.fastMap.size}getTreeNode(t){return this.fastMap.get(t)}addTreeNode(t,r,n){let s=this.fastMap.get(r??null);if(!s)return;let o=new Tt({scopeRef:t});s.addChild(o),o.parent=s,this.fastMap.set(t,o),n&&(o.nodeToRestore=n)}addNode(t){this.fastMap.set(t.scopeRef,t)}removeTreeNode(t){if(t===null)return;let r=this.fastMap.get(t);if(!r)return;let n=r.parent;for(let o of this.traverse())o!==r&&r.nodeToRestore&&o.nodeToRestore&&r.scopeRef&&r.scopeRef.current&&te(o.nodeToRestore,r.scopeRef.current)&&(o.nodeToRestore=r.nodeToRestore);let s=r.children;n&&(n.removeChild(r),s.size>0&&s.forEach(o=>n&&n.addChild(o))),this.fastMap.delete(r.scopeRef)}*traverse(t=this.root){if(t.scopeRef!=null&&(yield t),t.children.size>0)for(let r of t.children)yield*this.traverse(r)}clone(){var t;let r=new _t;var n;for(let s of this.traverse())r.addTreeNode(s.scopeRef,(n=(t=s.parent)===null||t===void 0?void 0:t.scopeRef)!==null&&n!==void 0?n:null,s.nodeToRestore);return r}constructor(){this.fastMap=new Map,this.root=new Tt({scopeRef:null}),this.fastMap.set(null,this.root)}}class Tt{addChild(t){this.children.add(t),t.parent=this}removeChild(t){this.children.delete(t),t.parent=void 0}constructor(t){this.children=new Set,this.contain=!1,this.scopeRef=t.scopeRef}}let B=new _t;const $e=({children:e,node:t})=>hr.createPortal(e,t??document.body),_r=({children:e,customTrigger:t,triggerContent:r,align:n="start",side:s="bottom",offset:o=8,className:a,triggerClassName:i,closeOnEscape:u=!0,closeOnClickAway:c=!0,scrollerId:d,onOpen:m,onClose:h,maxHeight:p="400px",minWidth:b="200px",maxWidth:x="500px"})=>{const{triggerRef:v,triggerProps:C,popoverRef:j,getPopoverPosition:R,open:T,toggle:M,close:y}=dt({align:n,side:s,offset:o,scrollerId:d,onOpen:()=>{m?.()},onClose:()=>{h?.()}});kr({Escape:O=>{u&&(O.preventDefault(),y(),v.current?.focus())}},{enabled:T}),ft(j,O=>{!c||!v.current||!T||!O.target||v.current.contains(O.target)||y()});const N=R();return l.jsxs(l.Fragment,{children:[t?t({triggerRef:v,triggerProps:C,toggle:M,open:T,close:y}):l.jsx("button",{ref:v,...C,onClick:M,className:k("outline-none p-2 rounded-md transition-colors","hover:bg-base-3 focus-visible:bg-base-3 focus-visible:ring-2 focus-visible:ring-brand",i),children:r}),l.jsx(P.AnimatePresence,{children:T&&l.jsx($e,{children:l.jsx(Ho,{contain:!0,restoreFocus:!0,autoFocus:!0,children:l.jsx(P.motion.div,{initial:{opacity:0,scale:.95,y:s==="bottom"?-10:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:s==="bottom"?-10:10},transition:{type:"spring",duration:.2,bounce:.1},ref:j,style:{position:"fixed",left:N.x,top:N.top,bottom:N.bottom,maxHeight:typeof p=="number"?`${p}px`:p,minWidth:typeof b=="number"?`${b}px`:b,maxWidth:typeof x=="number"?`${x}px`:x,zIndex:1e3},className:k("bg-base-1 dark-theme:bg-base-2","border border-base-4 rounded-6","customscrollbar overflow-auto",a),children:typeof e=="function"?e(M):e})})})})]})},Go=({title:e,subtitle:t,onClose:r,className:n})=>l.jsx("div",{className:k("p-4 border-b border-base-4",n),children:l.jsxs("div",{className:"flex items-start justify-between",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"font-semibold text-base-12",children:e}),t&&l.jsx("p",{className:"text-sm text-base-11 mt-1",children:t})]}),r&&l.jsx("button",{onClick:r,className:"ml-4 text-base-11 hover:text-base-12 transition-colors",children:"×"})]})}),Qo=({children:e,className:t})=>l.jsx("div",{className:k("p-4",t),children:e}),Jo=({children:e,className:t})=>l.jsx("div",{className:k("p-4 border-t border-base-4",t),children:e}),Zo=(e,t)=>{const r=new Date(2023,0,1),n=[];for(let s=0;s<7;s++){const o=new Date(r);o.setDate(r.getDate()+s),n.push(Ee(o,"EEE",{locale:e??jr}))}return t?[...n.slice(1),n[0]]:n},Yt=({selectedDate:e,onDateSelect:t,disabledDates:r,disabledDaysOfWeek:n,minDate:s,maxDate:o,locale:a,weekStartsOnMonday:i=!0,className:u=""})=>{const[c,d]=f.useState(e||new Date),[m,h]=f.useState(e||new Date),p=f.useRef(null),b=f.useMemo(()=>r?new Set(r.map(y=>new Date(y).toDateString())):new Set,[r]),x=f.useMemo(()=>new Set(n||[]),[n]),v=f.useMemo(()=>{const y=zn(c),N=_n(c),O=new Date(y),W=new Date(N);if(i){const E=y.getDay(),g=E===0?6:E-1;O.setDate(y.getDate()-g);const S=N.getDay(),$=S===0?0:7-S;W.setDate(N.getDate()+$)}else O.setDate(y.getDate()-y.getDay()),W.setDate(N.getDate()+(6-N.getDay()));return In({start:O,end:W})},[c,i]),C=f.useMemo(()=>Zo(a??ze,i),[a,i]),j=y=>{const N=y.toDateString(),O=y.getDay();return!(b.has(N)||x.has(O)||s&&y<s||o&&y>o)},R=y=>{j(y)&&t&&t(y),h(y)},T=y=>{if(!m)return;let N=new Date(m),O=!0,W,E;switch(y.key){case"ArrowUp":N.setDate(N.getDate()-7);break;case"ArrowDown":N.setDate(N.getDate()+7);break;case"ArrowLeft":N.setDate(N.getDate()-1);break;case"ArrowRight":N.setDate(N.getDate()+1);break;case"Home":W=N.getDay(),N.setDate(N.getDate()-W);break;case"End":E=N.getDay(),N.setDate(N.getDate()+(6-E));break;case"PageUp":N=y.shiftKey?kt(N,12):kt(N,1);break;case"PageDown":N=y.shiftKey?et(N,12):et(N,1);break;case"Enter":case" ":j(m)&&t&&t(m);break;default:O=!1}O&&(y.preventDefault(),N.getTime()!==m.getTime()&&(h(N),tr(N,c)||d(N)))},M=y=>{d(N=>y==="prev"?kt(N,1):et(N,1))};return l.jsxs("div",{ref:p,className:k("dark-theme:bg-base-3 border border-base-5 dark-theme:border-base-4 rounded-6 px-4 pt-3 pb-4 w-full lg:w-80",u),onKeyDown:T,tabIndex:0,role:"grid","aria-label":"Calendar",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(q,{onClick:()=>M("prev"),size:"iconSm","aria-label":"Previous month",children:l.jsx(A.ChevronLeft,{size:16})}),l.jsx("h2",{className:"text-sm font-medium",children:Ee(c,"MMMM yyyy")}),l.jsx(q,{onClick:()=>M("next"),size:"iconSm","aria-label":"Next month",children:l.jsx(A.ChevronRight,{size:16})})]}),l.jsx("div",{className:"grid grid-cols-7 gap-1 mt-4",role:"row",children:C.map(y=>l.jsx("div",{className:"text-xs flex items-center w-8 justify-center text-base-11",role:"columnheader",children:y},y))}),l.jsx("div",{className:"grid grid-cols-7 gap-1 mt-4",role:"grid",children:v.map((y,N)=>{const O=tr(y,c),W=e?yt(y,e):!1,E=m&&yt(y,m),g=j(y),S=yt(y,new Date);return l.jsx("button",{onClick:()=>R(y),disabled:!g,tabIndex:E?0:-1,role:"gridcell","aria-label":`${y.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}${W?", selected":""}${g?"":", disabled"}`,"aria-selected":W,"aria-disabled":!g,className:k("h-8 w-8 flex items-center outline-none justify-center rounded-6 hover:bg-base-4 text-sm relative",O?W?"bg-brand text-brand-text hover:bg-brand":S?"text-base-12 ring-1 ring-base-8":"text-base-12":"text-base-9",E&&"ring-1 ring-base-6",(!g||!O)&&"pointer-events-none text-base-9"),children:Ee(y,"d")},N)})})]})},ea=()=>{const[e,t]=f.useState(new Date(2025,8,21)),r=["2025-09-13T00:00:00Z","2025-09-15T00:00:00Z"],n=[0,6];return l.jsx("div",{className:"p-8 bg-gray-100 min-h-screen",children:l.jsxs("div",{className:"max-w-md mx-auto",children:[l.jsx("h1",{className:"text-2xl font-bold mb-6 text-gray-800",children:"Calendar Date Picker Demo"}),l.jsx("div",{className:"mb-6",children:l.jsx(Yt,{selectedDate:e,onDateSelect:t,disabledDates:r,disabledDaysOfWeek:n,minDate:new Date(2025,8,1),maxDate:new Date(2025,11,31)})}),e&&l.jsxs("div",{className:"bg-white p-4 rounded-lg shadow",children:[l.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Selected Date:"}),l.jsx("p",{className:"text-gray-600",children:e.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),l.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["ISO: ",e.toISOString()]})]}),l.jsxs("div",{className:"mt-6 bg-white p-4 rounded-lg shadow",children:[l.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Keyboard Navigation:"}),l.jsxs("div",{className:"text-sm text-gray-600 space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Arrow Keys:"})," Navigate between dates"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Enter/Space:"})," Select focused date"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Home/End:"})," Go to start/end of week"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Page Up/Down:"})," Previous/next month"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Shift + Page Up/Down:"})," Previous/next year"]})]})]}),l.jsxs("div",{className:"mt-4 bg-white p-4 rounded-lg shadow",children:[l.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Features:"}),l.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[l.jsx("li",{children:"✅ All dates enabled by default"}),l.jsx("li",{children:"✅ Disable specific dates (PostgreSQL ISO strings)"}),l.jsx("li",{children:"✅ Disable entire days of week (e.g., weekends)"}),l.jsx("li",{children:"✅ Min/max date constraints"}),l.jsx("li",{children:"✅ Full keyboard navigation with arrow keys"}),l.jsx("li",{children:"✅ Focus management and accessibility"})]})]})]})})};function ta({customTrigger:e,scrollerId:t}){const[r,n]=f.useState(new Date);return l.jsx(_r,{className:"p-0",scrollerId:t,customTrigger:({toggle:s,triggerRef:o})=>e?e(s,o):l.jsxs(q,{ref:o,onClick:s,color:"solid",className:"px-3 mt-1 w-full justify-start",children:[Ee(new Date,"PP",{locale:ze}),l.jsx("span",{className:"grow"}),l.jsx(A.CalendarDays,{size:18,className:"text-base-11"})]}),children:s=>l.jsx(Yt,{selectedDate:r,onDateSelect:o=>{n(o),s()},className:"border-none",disabledDaysOfWeek:[0,6]})})}const ra=()=>l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Time"}),l.jsxs(q,{color:"solid",className:"px-3 mt-1",children:[Ee(new Date,"p",{locale:ze}),l.jsx("span",{className:"grow"}),l.jsx(A.Clock,{size:18,className:"text-base-11"})]})]}),na=()=>l.jsxs("div",{className:"flex items-center gap-x-4",children:[l.jsxs("div",{className:"grow",children:[l.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Date"}),l.jsxs(q,{color:"solid",className:"px-3 mt-1 w-full justify-start",children:[Ee(new Date,"PP",{locale:ze}),l.jsx("span",{className:"grow"}),l.jsx(A.CalendarDays,{size:18,className:"text-base-11"})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Time"}),l.jsxs(q,{color:"solid",className:"px-3 mt-1",children:[Ee(new Date,"p",{locale:ze}),l.jsx("span",{className:"grow"}),l.jsx(A.Clock,{size:18,className:"text-base-11"})]})]})]}),Je={unchecked:"bg-base-3 lg:hover:bg-base-4",checked:"bg-brand lg:hover:bg-brand-hover text-brand-text",uncheckedDisabled:"bg-base-3 border-base-4",checkedDisabled:"bg-base-3 border-base-4 text-base-10"},Yr=f.forwardRef(({checked:e=!1,onCheckedChange:t,disabled:r=!1,required:n=!1,name:s,value:o,id:a,className:i="",size:u="sm",...c},d)=>{const m=()=>{r||t?.(e==="indeterminate"?!0:!e)},h=x=>{(x.key===" "||x.key==="Enter")&&(x.preventDefault(),m())},p={xs:"h-3.5 w-3.5",sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},b={xs:24,sm:12,md:14,lg:16};return l.jsxs(l.Fragment,{children:[l.jsxs("button",{ref:d,type:"button",role:"checkbox","aria-checked":e==="indeterminate"?"mixed":e,"aria-required":n,disabled:r,onClick:m,onKeyDown:h,className:k("inline-flex items-center justify-center rounded-2 border border-base-4 transition-all duration-200 ease-in-out","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-base-5",p[u],r&&"cursor-not-allowed opacity-75",!r&&"cursor-pointer",e?r?Je.checkedDisabled:Je.checked:r?Je.uncheckedDisabled:Je.unchecked,typeof i=="function"?i(e):i),...c,children:[e===!0&&l.jsx(A.Check,{size:b[u],className:"stroke-current"}),e==="indeterminate"&&l.jsx(A.Minus,{size:b[u],className:"stroke-current"})]}),l.jsx("input",{type:"checkbox",name:s,value:o,checked:e===!0,onChange:()=>{},disabled:r,required:n,id:a,className:"sr-only",tabIndex:-1})]})});Yr.displayName="Checkbox";const sa=({title:e,message:t,searchParam:r,condition:n=!0,cancelLabel:s,confirmLabel:o,confirmColor:a="contrast",confirmAction:i,trigger:u})=>{const{searchParams:c}=de.useSearchParams(),d=f.useMemo(()=>!!c[r],[c]),m=f.useCallback(()=>{de.navigate.to(`${window.location.pathname}?${r}=open`)},[r]);return l.jsxs(l.Fragment,{children:[l.jsx(P.AnimatePresence,{initial:!1,children:d&&n?l.jsxs($e,{node:document&&document.getElementById("modals"),children:[l.jsx(P.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed top-0 left-0 z-[999] h-full w-full bg-black/50"}),l.jsxs(P.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed top-1/2 left-1/2 z-[999] w-[75%] -translate-y-1/2 -translate-x-1/2 rounded-lg bg-base-2 p-4 lg:w-[35%] xl:w-[30%]",children:[e?l.jsx("p",{className:"font-medium",children:e}):null,t?l.jsx("p",{className:k("text-sm text-base-11",{"mt-2":e}),children:t}):null,l.jsxs("div",{className:"flex justify-end gap-x-4 pt-4",children:[l.jsx(q,{onClick:()=>de.navigate.back(),color:"transparentinactive",size:"sm",children:s??"Cancelar"}),l.jsx(q,{size:"sm",onClick:()=>{i&&i(),de.navigate.back()},color:a,children:o??"Continuar"})]})]})]}):null}),u?u(m):null]})},oa=({scrollY:e,height:t=300,className:r,children:n})=>{const s=P.useTransform(e,a=>a<0?1+Math.abs(a)/t:1),o=P.useTransform(e,a=>a<0?-Math.abs(a)/2:0);return l.jsx(P.motion.div,{style:{scale:s,y:o,height:t},className:r,children:n})};function Ir(e,t,r){function n(i,u){var c;Object.defineProperty(i,"_zod",{value:i._zod??{},enumerable:!1}),(c=i._zod).traits??(c.traits=new Set),i._zod.traits.add(e),t(i,u);for(const d in a.prototype)d in i||Object.defineProperty(i,d,{value:a.prototype[d].bind(i)});i._zod.constr=a,i._zod.def=u}const s=r?.Parent??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function a(i){var u;const c=r?.Parent?new o:this;n(c,i),(u=c._zod).deferred??(u.deferred=[]);for(const d of c._zod.deferred)d();return c}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:i=>r?.Parent&&i instanceof r.Parent?!0:i?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class aa extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const ia={};function zr(e){return ia}function la(e,t){return typeof t=="bigint"?t.toString():t}const Hr=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Ze(e){return typeof e=="string"?e:e?.message}function Br(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const s=Ze(e.inst?._zod.def?.error?.(e))??Ze(t?.error?.(e))??Ze(r.customError?.(e))??Ze(r.localeError?.(e))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}const qr=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,la,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ca=Ir("$ZodError",qr),Xr=Ir("$ZodError",qr,{Parent:Error}),ua=e=>(t,r,n,s)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new aa;if(a.issues.length){const i=new(s?.Err??e)(a.issues.map(u=>Br(u,o,zr())));throw Hr(i,s?.callee),i}return a.value},da=ua(Xr),fa=e=>async(t,r,n,s)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const i=new(s?.Err??e)(a.issues.map(u=>Br(u,o,zr())));throw Hr(i,s?.callee),i}return a.value},ma=fa(Xr);function cr(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function ha(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,a=n.path.join(".");if(!r[a])if("unionErrors"in n){var i=n.unionErrors[0].errors[0];r[a]={message:i.message,type:i.code}}else r[a]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(m){return e.push(m)})}),t){var u=r[a].types,c=u&&u[n.code];r[a]=J.appendErrors(a,t,r,s,c?[].concat(c,n.message):n.message)}e.shift()}return r}function ba(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,a=n.path.join(".");if(!r[a])if(n.code==="invalid_union"&&n.errors.length>0){var i=n.errors[0][0];r[a]={message:i.message,type:i.code}}else r[a]={message:o,type:s};if(n.code==="invalid_union"&&n.errors.forEach(function(d){return d.forEach(function(m){return e.push(m)})}),t){var u=r[a].types,c=u&&u[n.code];r[a]=J.appendErrors(a,t,r,s,c?[].concat(c,n.message):n.message)}e.shift()}return r}function pa(e,t,r){if(r===void 0&&(r={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,s,o){try{return Promise.resolve(cr(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(a){return o.shouldUseNativeValidation&&Ge.validateFieldsNatively({},o),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(i){return Array.isArray(i?.issues)})(a))return{values:{},errors:Ge.toNestErrors(ha(a.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw a}))}catch(a){return Promise.reject(a)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,s,o){try{return Promise.resolve(cr(function(){return Promise.resolve((r.mode==="sync"?da:ma)(e,n,t)).then(function(a){return o.shouldUseNativeValidation&&Ge.validateFieldsNatively({},o),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(i){return i instanceof ca})(a))return{values:{},errors:Ge.toNestErrors(ba(a.issues,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw a}))}catch(a){return Promise.reject(a)}};throw new Error("Invalid input: not a Zod schema")}function ga({methods:e,onSubmit:t,onError:r,children:n,logErrors:s,className:o}){return l.jsx(J.FormProvider,{...e,children:l.jsx("form",{className:k("mt-4 lg:mt-8 grid grid-cols-1 lg:grid-cols-2 gap-4 lg:gap-8 relative",o),onSubmit:e.handleSubmit((a,i)=>t(a,i),a=>{s&&console.log(a),r?.(a)}),children:n})})}function xa(e,t){return J.useForm({resolver:pa(e),defaultValues:t})}const Vr=({children:e,size:t=24,strokeWidth:r=2,viewBox:n="0 0 24 24",className:s,...o})=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:n,className:s,...o,children:e}),va={solid:"bg-base-3 border border-base-4 drop-shadow-sm dark-theme:drop-shadow-none",outline:"border border-base-6"},wa={brand:"ring-1 ring-brand",solid:"ring-1 ring-base-6"},It=f.forwardRef(({label:e,description:t,labelPosition:r="default",color:n="solid",focusColor:s="brand",placeholder:o,valid:a,error:i,errorMessage:u,isPrice:c,prefix:d,wrapperClassName:m,containerClassName:h,className:p,type:b="text",value:x,...v},C)=>{const j=f.useRef(null),R=f.useRef(!1),[T,M]=f.useState(!1),[y,N]=f.useState(!1),O=b==="password",W=O&&T?"text":c?"number":b,E=x!==""&&x!==null&&x!==void 0;return f.useEffect(()=>{if(!R.current){R.current=!0;return}j.current&&gr(j.current)},[T,j]),l.jsxs("div",{className:k("relative",m),children:[e&&r==="default"&&l.jsx("label",{className:k("font-medium ml-0.5 text-xs",i&&"text-red-9"),children:e}),l.jsxs("div",{className:k("rounded-6 transition cursor-text relative",va[n],{"pt-[22px] pb-1.5":r==="floating",[wa[s]]:!i&&y,"bg-red-4 text-red-9":!!i,"ring-1 ring-red-9":!!i&&y},h),children:[e&&r==="floating"&&l.jsx("label",{className:k("absolute transition-all duration-200 pointer-events-none","text-sm top-[18px] font-semibold left-3",{"text-xs top-2.5":y||E||o,"text-red-9":!!i}),children:e}),c&&l.jsx(A.DollarSign,{size:16,className:k("absolute top-1/2 -translate-y-1/2 left-3",i?"text-red-9":"text-base-11")}),d&&l.jsx("p",{className:"text-sm text-base-11 absolute top-1/2 -translate-y-1/2 left-3",children:d}),l.jsx("input",{ref:g=>{C&&(typeof C=="function"?C(g):C.current=g),j.current=g},type:W,className:k("w-full bg-transparent focus-visible:outline-none","placeholder:text-sm text-sm placeholder:text-base-11",c||d?"pl-9":"pl-3",{"py-2.5":r==="default","mt-1.5":r==="floating","pr-10":a,"text-red-9 placeholder:text-red-9":!!i},p),value:x,placeholder:o,onFocus:()=>N(!0),onBlur:()=>N(!1),...v})]}),a?l.jsx(A.CheckIcon,{size:20,className:`absolute top-1/2 -translate-y-1/2 text-green-500 ${O?"right-10":"right-3"}`}):null,O&&l.jsx("button",{type:"button",className:k(r==="floating"?"absolute right-3 top-1/2 -translate-y-1/2":"absolute right-3 top-10"),onClick:()=>{M(!T)},children:T?l.jsx(A.EyeOffIcon,{size:20,className:k(i?"text-red-9":"text-base-11")}):l.jsx(A.Eye,{size:20,className:k(i?"text-red-9":"text-base-11")})}),u?l.jsx("span",{role:"alert",className:"text-red-9 text-sm mt-1 ml-0.5",children:u}):t?l.jsx("p",{className:"text-xs text-base-11 mt-1 ml-0.5",children:t}):null]})});It.displayName="Input";const ya=({name:e,customRead:t,customSet:r,withNullSet:n=!0,...s})=>{const{control:o}=J.useFormContext(),a=f.useCallback(u=>t?t(u):u===null?Pt(u):u,[t]),i=f.useCallback(u=>r?n&&u===null?rt(u):r(u):u===null?rt(u):u,[r]);return o?l.jsx(J.Controller,{name:e,control:o,render:({field:u,fieldState:c})=>l.jsx(It,{value:a(u.value),onChange:d=>u.onChange(i(d.target.value)),error:!!c.error,errorMessage:c.error?.message,ref:u.ref,...s})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},Kr=f.createContext(null),ka=({children:e,value:t})=>l.jsx(Kr.Provider,{value:t,children:e}),Na=()=>{const e=f.useContext(Kr);if(!e)throw new Error("useAliveScope must be wrapped within AliveScopeProvider");return e},Ea=({children:e})=>{const[t,r]=f.useState({}),n=f.useRef({}),s=f.useRef({}),o=(i,u,c)=>{if(!t[i]){const d=document.createElement("div");return i&&(d.id=i),c&&(d.className=c),r(m=>({...m,[i]:{children:u,element:d}})),n.current[i]=[],s.current[i]=[],n.current&&n.current[i]&&n.current[i].forEach(m=>m(i)),d}return n.current&&n.current[i]&&n.current[i].forEach(d=>d(i)),t[i].element},a=i=>{r(u=>{const c={...u};return delete c[i],c}),s.current&&s.current[i]&&s.current[i].forEach(u=>u(i))};return l.jsxs(ka,{value:{getPortalElement:o,dropPortalElement:a},children:[e,Object.entries(t).map(([i,{children:u,element:c}])=>l.jsx(ja,{id:i,onMountCallbacks:n,onDropCallbacks:s,children:u,element:c},i))]})},Ur=f.createContext(null),Ca=({children:e,value:t})=>l.jsx(Ur.Provider,{value:t,children:e}),ja=f.memo(({id:e,onMountCallbacks:t,onDropCallbacks:r,children:n,element:s})=>{const o=(i,u={runOnFirstMount:!1})=>{f.useEffect(()=>{const c=()=>{if(document.getElementById(e))i(e);else{const m=new MutationObserver((h,p)=>{document.getElementById(e)&&(i(e),p.disconnect())});return m.observe(document.body,{childList:!0,subtree:!0}),()=>m.disconnect()}};return u?.runOnFirstMount&&c(),t.current[e].push(c),()=>{t.current[e]=t.current[e].filter(d=>d!==c)}},[])},a=i=>{f.useEffect(()=>(r.current[e].push(i),()=>{r.current[e]=r.current[e].filter(u=>u!==i)}),[])};return l.jsx(Ca,{value:{keepAliveId:e,onKeepAliveMount:o,onKeepAliveDrop:a},children:hr.createPortal(n,s,e)})}),$a=()=>{const e=f.useContext(Ur);if(!e)throw new Error("useKeepAlive must be used within KeepAliveProvider");return e},Sa=({aliveKey:e,children:t,enabled:r=!0,...n})=>{const s=f.useRef(null),{getPortalElement:o}=Na();return f.useEffect(()=>{const a=o(e,t,n.className);return r&&s.current&&s.current.replaceWith(a),()=>{}},[e,t,r,n]),l.jsx("div",{...n,ref:s,children:t})},Ta=({lightSolid:e=!0,className:t,children:r,...n})=>l.jsx("div",{className:k("rounded-7 dark-theme:bg-base-3",e?"border-none bg-base-3":"border border-base-6 dark-theme:border-base-4",t),...n,children:r}),Ma=({onClick:e,lightSolid:t=!0,className:r,children:n})=>l.jsx("button",{onClick:e,className:k("w-full text-start first:rounded-t-7 last:rounded-b-7 border-b dark-theme:border-base-4","last:border-none px-3 pr-2.5 py-3 dark-theme:bg-base-3 lg:hover:bg-base-4 max-lg:active:bg-base-4","transition-colors hover:cursor-pointer flex items-center justify-between outline-none lg:focus-visible:ring-2 focus-visible:ring-base-6",t?"bg-base-3 border-base-4":"border-base-6",r),children:n}),Gr=({label:e,labelPosition:t="default",options:r,selectedValues:n,onChange:s,idExtractor:o,labelExtractor:a,customSetter:i,valid:u,error:c,placeholder:d="Select options...",maxSelections:m,searchable:h=!1,disabled:p=!1,className:b})=>{const[x,v]=f.useState(""),[C,j]=f.useState(!1),[R,T]=f.useState(-1),M=f.useRef(null),y=f.useRef(null),N=f.useRef([]),{triggerRef:O,triggerProps:W,popoverRef:E,getPopoverPosition:g,open:S,toggle:$,close:F}=dt({align:"start",side:"top",avoidCollisions:!1,onOpen:()=>{j(!0),h&&M.current&&setTimeout(()=>M.current?.focus(),10)},onClose:()=>{j(!1),v(""),T(-1)}}),Y=f.useRef(`multiselect-${Math.random().toString(36).substr(2,9)}`).current,X=f.useRef(`label-${Math.random().toString(36).substr(2,9)}`).current,L=f.useRef(`error-${Math.random().toString(36).substr(2,9)}`).current,w=f.useRef(`listbox-${Math.random().toString(36).substr(2,9)}`).current,V=i?n.map(D=>r.find(G=>o(G)===D||o(G)===o(D))).filter(Boolean):n,oe=V.length>0,U=h?r.filter(D=>a(D).toLowerCase().includes(x.toLowerCase())):r;f.useEffect(()=>{N.current=N.current.slice(0,U.length)},[U.length]);const re=D=>i?n.some(_=>_===o(D)||o(_)===o(D)):n.some(_=>o(_)===o(D)),Re=D=>{if(!p)if(re(D)){let _;if(i){const G=o(D);_=n.filter(we=>we!==G&&o(we)!==G)}else _=n.filter(G=>o(G)!==o(D));s(_),Ue(`Removed ${a(D)}`)}else{if(m&&V.length>=m){Ue(`Maximum of ${m} selections allowed`);return}let _;i?_=[...n,i(D)]:_=[...n,D],s(_),Ue(`Added ${a(D)}`)}},Ve=D=>{if(p)return;let _;if(i){const G=o(D);_=n.filter(we=>we!==G&&o(we)!==G)}else _=n.filter(G=>o(G)!==o(D));s(_),Ue(`Removed ${a(D)}`)},Ke=D=>{if(!p)switch(D.key){case"Enter":D.preventDefault(),S?R>=0&&Re(U[R]):$();break;case"Escape":D.preventDefault(),F();break;case"ArrowDown":if(D.preventDefault(),!S)$();else{const _=R>=U.length-1?0:R+1;T(_),N.current[_]?.scrollIntoView({block:"nearest"})}break;case"ArrowUp":if(D.preventDefault(),S){const _=R<=0?U.length-1:R-1;T(_),N.current[_]?.scrollIntoView({block:"nearest"})}break;case"Backspace":if(h&&x===""&&V.length>0){const _=V[V.length-1];Ve(_)}break}},un=D=>{v(D.target.value),T(-1)},dn=()=>{p||(h&&M.current&&M.current.focus(),$())},Ue=D=>{console.log(`Accessibility announcement: ${D}`)};ft(E,D=>{!O.current||!S||!D.target||O.current.contains(D.target)||F()});const xt=g();return l.jsxs("div",{className:k("relative",b),children:[l.jsxs("div",{className:"relative",ref:y,children:[t==="default"&&l.jsx("label",{className:k("top-[18px] font-medium ml-0.5 text-xs",c&&"text-red-9"),children:e}),l.jsxs("div",{ref:O,...W,className:k("relative rounded-6 px-2 transition cursor-pointer pr-10 min-h-[48px]","border border-base-4 light-theme:drop-shadow-sm dark-theme:bg-base-3",{"py-3":t==="default","pt-5 pb-2":t==="floating","ring-1 ring-brand":S||C,"text-red-9":c,"ring-2 ring-red-6":c&&(S||C),"opacity-60 cursor-not-allowed":p}),onClick:dn,role:"combobox","aria-expanded":S,"aria-haspopup":"listbox","aria-owns":w,"aria-labelledby":X,"aria-describedby":c?L:void 0,onKeyDown:Ke,tabIndex:p?-1:0,children:[t==="floating"&&l.jsxs("label",{id:X,htmlFor:Y,className:k("absolute transition-all duration-200 pointer-events-none","text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":C||oe,"text-red-9":!!c}),children:[e," ",m&&`(${n.length}/${m})`]}),l.jsxs("div",{className:k("flex flex-wrap gap-2 items-center",{"mt-2.5":t==="floating"}),children:[V.map(D=>l.jsxs("div",{className:k("border border-base-4 dark-theme:border-base-5 dark-theme:bg-base-4 rounded-full px-2 py-1 text-sm flex items-center gap-1",{"bg-red-4 text-red-9":c}),children:[l.jsx("span",{className:"line-clamp-1",children:a(D)}),!p&&l.jsx("button",{type:"button",className:"hover:bg-brand/20 rounded-full p-0.5 transition-colors",onClick:_=>{_.stopPropagation(),Ve(D)},"aria-label":`Remove ${a(D)}`,children:l.jsx(A.XIcon,{size:12})})]},o(D))),h&&l.jsx("input",{ref:M,id:Y,type:"text",className:"flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm",value:x,onChange:un,onKeyDown:Ke,placeholder:oe?"":d,disabled:p,"aria-autocomplete":"list","aria-controls":w,autoComplete:"off"}),!h&&!oe&&l.jsx("span",{className:"text-secondarytext text-sm flex-grow",children:d})]}),l.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:[u&&l.jsx(A.CheckIcon,{size:16,className:"text-green-600"}),l.jsx(A.ChevronDownIcon,{size:16,className:k("transition-transform text-base-11",{"rotate-180":S})})]})]})]}),l.jsx(P.AnimatePresence,{children:S&&l.jsx($e,{children:l.jsx(P.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},ref:E,style:{position:"fixed",left:xt.x,top:xt.top,bottom:xt.bottom,width:y.current?.offsetWidth??200},className:k("bg-base-1 dark-theme:bg-base-3 border border-base-4","rounded-6 shadow-lg max-h-[300px] overflow-y-auto z-50","customscrollbarnohide"),role:"listbox",id:w,"aria-labelledby":X,children:U.length===0?l.jsx("div",{className:"px-3 py-2 text-sm text-secondarytext",children:x?"No results found":"No options available"}):U.map((D,_)=>{const G=re(D),we=_===R;return l.jsxs("div",{ref:fn=>{N.current[_]=fn},className:k("px-3 py-2 text-sm cursor-pointer flex items-center justify-between","first:rounded-t-6 last:rounded-b-6",{"bg-base-3 dark-theme:bg-base-4":we,"bg-brandfadedbg text-brand":G}),onClick:()=>Re(D),role:"option","aria-selected":G,onMouseEnter:()=>T(_),children:[l.jsx("span",{children:a(D)}),G&&l.jsx(A.CheckIcon,{size:16})]},o(D))})})})}),c&&l.jsx("p",{id:L,className:"text-red-9 text-xs mt-1","aria-live":"assertive",children:c}),l.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:V.length>0?`Selected: ${V.map(a).join(", ")}`:"No selections"})]})},Da=({name:e,...t})=>{const{control:r}=J.useFormContext();return r?l.jsx(J.Controller,{name:e,control:r,render:({field:n,fieldState:s})=>l.jsx(Gr,{selectedValues:n.value||[],onChange:o=>n.onChange(o),error:s.error?.message,...t})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},Pa=({id:e,tabPage:t,absolute:r=!0,navBar:n,children:s,onRefresh:o,style:a,className:i,contentClassName:u,bounceBackDuration:c=300,showScrollbar:d=!0,onScroll:m})=>{const h=f.useRef(null),p=f.useRef(null),b=f.useRef(null),x=f.useRef(null),v=f.useRef(null),[C,j]=f.useState(!1),R=f.useRef(null),T=f.useRef({startY:0,currentY:0,maxScroll:0,lastTimestamp:0,frameCallback:null,isScrolling:!1,pullDistance:0,refreshThreshold:50,isPullingToRefresh:!1}),M=qe(),y=f.useCallback(Le(()=>{h.current&&p.current&&(T.current.maxScroll=Math.max(0,p.current.offsetHeight-h.current.offsetHeight))}),[]),N=f.useCallback(L=>{const{maxScroll:w}=T.current;return L>0?Math.pow(L,.8):L<-w?-w-Math.pow(-(L+w),.8):L},[]),O=f.useCallback(()=>{if(!d||!h.current||!x.current)return;const{currentY:L,maxScroll:w}=T.current,H=h.current.offsetHeight,V=Math.max(30,H/(H+w)*H),oe=H-V;let U=-L/w*oe,re=1;L>0?(U=0,re=1-L/H,x.current.style.transformOrigin="top"):L<-w?(U=oe,re=1-Math.abs(L+w)/H,x.current.style.transformOrigin="bottom"):x.current.style.transformOrigin="top",x.current.style.transform=`translate3d(0, ${U}px, 0) scaleY(${re})`,x.current.style.height=`${V}px`},[d]),W=f.useCallback(L=>{if(T.current.currentY=L,p.current&&(p.current.style.transform=`translate3d(0, ${L}px, 0)`),b.current){const w=Math.max(L-T.current.refreshThreshold,-T.current.refreshThreshold);b.current.style.transform=`translate3d(0, ${w}px, 0)`}m&&m(L),O()},[O]),E=f.useCallback(L=>{const w=T.current;w.frameCallback&&(P.cancelFrame(w.frameCallback),w.frameCallback=null);const H=performance.now(),V=w.currentY,oe=L-V,U=()=>{const re=performance.now()-H,Re=Math.min(re/c,1),Ve=1-Math.pow(1-Re,3),Ke=V+oe*Ve;W(Ke),Re>=1&&(w.frameCallback&&(P.cancelFrame(w.frameCallback),w.frameCallback=null),W(L),L===0&&b.current&&(b.current.textContent="Pull to refresh"))};w.frameCallback=P.frame.render(U,!0)},[W,c]),g=f.useCallback(L=>{const w=T.current;w.frameCallback&&(P.cancelFrame(w.frameCallback),w.frameCallback=null);let H=L,V=Date.now();const oe=()=>{const U=Date.now(),re=U-V;if(V=U,H*=Math.pow(.95,re/16),w.currentY+=H*re,w.currentY>0||w.currentY<-w.maxScroll){w.frameCallback&&(P.cancelFrame(w.frameCallback),w.frameCallback=null),E(w.currentY>0?0:-w.maxScroll);return}W(w.currentY),Math.abs(H)<.01&&w.frameCallback&&(P.cancelFrame(w.frameCallback),w.frameCallback=null)};w.frameCallback=P.frame.render(oe,!0)},[W,E]),S=f.useCallback(()=>{if(!d||!x.current)return;v.current!==null&&clearTimeout(v.current),requestAnimationFrame(()=>{x.current&&(x.current.style.opacity="1")});const L=window.requestIdleCallback||(w=>setTimeout(w,1e3));v.current=window.setTimeout(()=>{L(()=>{x.current&&(x.current.style.opacity="0"),v.current=null})},1e3)},[d]),$=f.useCallback(L=>{if(R.current!==null&&Date.now()-R.current<50)return;R.current=Date.now();const w=T.current;w.isScrolling=!0,w.startY=w.currentY,w.lastTimestamp=Date.now(),w.isPullingToRefresh=w.currentY===0,w.pullDistance=0,w.frameCallback&&(P.cancelFrame(w.frameCallback),w.frameCallback=null),S()},[S]),F=f.useCallback(L=>{const w=T.current;if(!w.isScrolling)return;const H=N(w.startY+L.deltaY);w.isPullingToRefresh&&H<w.startY&&(w.isPullingToRefresh=!1),W(H),o&&w.isPullingToRefresh&&!C&&H>0&&(w.pullDistance=H,b.current&&(b.current.textContent=w.pullDistance>w.refreshThreshold?"Release to refresh":"Pull to refresh")),S()},[o,W,C,S,N]),Y=f.useCallback(L=>{const w=T.current;w.isScrolling&&(w.isScrolling=!1,o&&w.isPullingToRefresh&&!C&&w.pullDistance>w.refreshThreshold?X():w.currentY>0||w.currentY<-w.maxScroll?E(w.currentY>0?0:-w.maxScroll):g(L.velocityY),w.isPullingToRefresh=!1)},[o,g,E,C]),X=f.useCallback(()=>{j(!0),E(T.current.refreshThreshold),b.current&&(b.current.textContent="Refreshing..."),o&&o().then(()=>{j(!1),E(0)})},[o,E]);return f.useEffect(()=>{if(!h.current)return;const L=br.createGesture(h.current,{name:"page-scroller-gesture",priority:10,passive:!0,direction:"y",onStart:$,onMove:F,onEnd:Y});return L.init(),()=>L.destroy()},[$,F,Y]),f.useEffect(()=>{if(h.current)return y(),O(),window.addEventListener("resize",y),()=>{window.removeEventListener("resize",y),v.current!==null&&clearTimeout(v.current)}},[y,O]),l.jsxs(P.motion.div,{id:e,ref:h,initial:{x:t||M?0:window.innerWidth,y:M?20:void 0,opacity:M&&!t?0:1},animate:{x:M||t?void 0:0,y:M?0:void 0,opacity:1,transition:{ease:[.32,.72,0,1],duration:M?.34:.44,delay:.2}},exit:{x:M||t?void 0:window.innerWidth+80,y:M?20:0,opacity:M?0:1,transition:{duration:M?.34:.6,ease:[.32,.72,0,1]}},style:{overflow:"hidden",position:r?"absolute":"relative",...a},className:k("top-0 right-0 h-full w-full bg-base-1 isolate will-change-transform",i),children:[o&&l.jsx("div",{ref:b,style:{position:"absolute",top:n?48:0,left:0,width:"100%",textAlign:"center",height:"50px",lineHeight:"50px",transform:"translateY(-50px)"},children:"Pull to refresh"}),l.jsx("div",{ref:p,style:{position:"absolute",top:0,left:0,width:"100%",willChange:"transform"},className:u,children:s}),n,d&&l.jsx("div",{ref:x,style:{position:"absolute",top:2,right:2,width:6,borderRadius:3,opacity:0,transition:"opacity 0.2s",willChange:"transform"},className:"bg-base-3"})]},`scroller${e}`)};function Oa({id:e,showScrollbar:t=!0,onRefresh:r,bounceBackDuration:n=300,isolate:s=!1,onScroll:o}){const a=f.useRef(null),i=f.useRef(null),u=f.useRef(null),c=f.useRef(null),d=f.useRef(null),[m,h]=f.useState(!1),p=f.useRef(null),b=f.useRef({startY:0,currentY:0,maxScroll:0,lastTimestamp:0,frameCallback:null,isScrolling:!1,pullDistance:0,refreshThreshold:50,isPullingToRefresh:!1}),x=f.useCallback(Le(()=>{a.current&&i.current&&(b.current.maxScroll=Math.max(0,i.current.offsetHeight-a.current.offsetHeight))}),[]),v=f.useCallback(E=>{const{maxScroll:g}=b.current;return E>0?Math.pow(E,.8):E<-g?-g-Math.pow(-(E+g),.8):E},[]),C=f.useCallback(()=>{if(!t||!a.current||!c.current)return;const{currentY:E,maxScroll:g}=b.current,S=a.current.offsetHeight,$=Math.max(30,S/(S+g)*S),F=S-$;let Y=-E/g*F,X=1;E>0?(Y=0,X=1-E/S,c.current.style.transformOrigin="top"):E<-g?(Y=F,X=1-Math.abs(E+g)/S,c.current.style.transformOrigin="bottom"):c.current.style.transformOrigin="top",c.current.style.transform=`translate3d(0, ${Y}px, 0) scaleY(${X})`,c.current.style.height=`${$}px`},[t]),j=f.useCallback(E=>{if(b.current.currentY=E,i.current&&(i.current.style.transform=`translate3d(0, ${E}px, 0)`),u.current){const g=Math.max(E-b.current.refreshThreshold,-b.current.refreshThreshold);u.current.style.transform=`translate3d(0, ${g}px, 0)`}o&&o(E),C()},[C]),R=f.useCallback(E=>{const g=b.current;g.frameCallback&&(P.cancelFrame(g.frameCallback),g.frameCallback=null);const S=performance.now(),$=g.currentY,F=E-$,Y=()=>{const X=performance.now()-S,L=Math.min(X/n,1),w=1-Math.pow(1-L,3),H=$+F*w;j(H),L>=1&&(g.frameCallback&&(P.cancelFrame(g.frameCallback),g.frameCallback=null),j(E))};g.frameCallback=P.frame.render(Y,!0)},[j,n]),T=f.useCallback(E=>{const g=b.current;g.frameCallback&&(P.cancelFrame(g.frameCallback),g.frameCallback=null);let S=E,$=Date.now();const F=()=>{const Y=Date.now(),X=Y-$;if($=Y,S*=Math.pow(.95,X/16),g.currentY+=S*X,g.currentY>0||g.currentY<-g.maxScroll){g.frameCallback&&(P.cancelFrame(g.frameCallback),g.frameCallback=null),R(g.currentY>0?0:-g.maxScroll);return}j(g.currentY),Math.abs(S)<.01&&g.frameCallback&&(P.cancelFrame(g.frameCallback),g.frameCallback=null)};g.frameCallback=P.frame.render(F,!0)},[j,R]),M=f.useCallback(()=>{if(!t||!c.current)return;d.current!==null&&clearTimeout(d.current),requestAnimationFrame(()=>{c.current&&(c.current.style.opacity="1")});const E=window.requestIdleCallback||(g=>setTimeout(g,1e3));d.current=window.setTimeout(()=>{E(()=>{c.current&&(c.current.style.opacity="0"),d.current=null})},1e3)},[t]),y=f.useCallback(E=>{if(p.current!==null&&Date.now()-p.current<50)return;p.current=Date.now();const g=b.current;g.isScrolling=!0,g.startY=g.currentY,g.lastTimestamp=Date.now(),g.isPullingToRefresh=g.currentY===0,g.pullDistance=0,g.frameCallback&&(P.cancelFrame(g.frameCallback),g.frameCallback=null),M()},[M]),N=f.useCallback(E=>{const g=b.current;if(!g.isScrolling)return;const S=v(g.startY+E.deltaY);g.isPullingToRefresh&&S<g.startY&&(g.isPullingToRefresh=!1),j(S),r&&g.isPullingToRefresh&&!m&&S>0&&(g.pullDistance=S),M()},[r,j,m,M,v]),O=f.useCallback(()=>{h(!0),R(b.current.refreshThreshold),r&&r().then(()=>{h(!1),R(0)})},[r,R]),W=f.useCallback(E=>{const g=b.current;g.isScrolling&&(g.isScrolling=!1,r&&g.isPullingToRefresh&&!m&&g.pullDistance>g.refreshThreshold?O():g.currentY>0||g.currentY<-g.maxScroll?R(g.currentY>0?0:-g.maxScroll):T(E.velocityY),g.isPullingToRefresh=!1)},[r,T,R,m,O]);return f.useEffect(()=>{if(!a.current)return;const E=br.createGesture(a.current,{name:"page-scroller-gesture",priority:10,passive:!0,direction:"y",onStart:y,onMove:N,onEnd:W});return E.init(),()=>E.destroy()},[y,N,W]),f.useEffect(()=>{if(a.current)return x(),C(),window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x),d.current!==null&&clearTimeout(d.current)}},[x,C]),{container:{props:{id:e,ref:a,key:`scroller${e||"default"}`},classNames:`will-change-transform overflow-hidden ${s?"isolate":""}`},content:{props:{ref:i},styles:{position:"absolute",top:0,left:0,width:"100%",willChange:"transform"}},pullToRefresh:{props:{ref:u},styles:{position:"absolute",top:0,left:0,width:"100%",textAlign:"center",height:"50px",lineHeight:"50px",transform:"translateY(-50px)"}},scrollbar:{props:{ref:c}},refreshing:m,updateMaxScroll:x,rubberBandEffect:v,updateScrollbarPosition:C,setPosition:j}}const Fa={2:"text-2xl",4:"text-4xl",5:"text-5xl",6:"text-6xl"},La=({title:e,description:t,size:r="6",descriptionClassName:n,className:s})=>l.jsxs("div",{className:k("text-center",s),children:[l.jsx("p",{className:`${Fa[r]} font-medium`,children:e}),t?l.jsx("p",{className:k("mt-6 text-base-11",n),children:t}):null]}),Ra=f.forwardRef(({placeholder:e="Buscar",value:t,exposedRef:r,autoFocus:n,onClear:s,onChange:o,className:a,onMount:i,error:u},c)=>{const d=f.useRef(null),m=qe(),h=Ot(d,c),p=f.useCallback(()=>r&&r(d),[]);return f.useEffect(()=>{const b=async()=>{i&&await i(d,m)};p(),b()},[]),l.jsxs("div",{className:k("rounded-6 relative flex items-center bg-base-3 border-base-5",{"dark-theme:bg-red-4 light-theme:border-red-9":u,"dark-theme:bg-base-3":!u},a),children:[l.jsx("input",{ref:h,placeholder:e,value:t,onChange:o,autoComplete:"off",autoCorrect:"off",type:"search",autoFocus:n?n(m):void 0,className:k("w-full py-1.5 pl-10 pr-3 bg-transparent outline-none text-base-12 placeholder:text-base-11 [&::-webkit-search-cancel-button]:appearance-none",u&&"text-red-9 placeholder:text-red-9")}),l.jsx(A.Search,{size:20,className:k("absolute left-3 text-base-11 pointer-events-none",{"text-red-9":u})}),s&&t&&t.length>0?l.jsx("button",{onClick:()=>{s(),d.current?.focus()},className:k("absolute right-2.5 rounded-full",u?"text-red-9":"text-base-11"),children:l.jsx(A.X,{size:20})}):null]})}),ur=({el:e,direction:t,amount:r=200,multiplier:n=.4,speed:s="normal"})=>{if(!e)return;const o=t==="up"||t==="down",a=o?e.scrollTop:e.scrollLeft,i=o?e.scrollHeight-e.clientHeight:e.scrollWidth-e.clientWidth;let u;r==="max"?u=i:u=r??(o?e.clientHeight:e.clientWidth)*n;let c;if(t==="right"||t==="down"?c=Math.min(a+u,i):c=Math.max(a-u,0),c===a)return;const d={fast:.15,normal:.4,slow:.8};P.animate(0,1,{duration:d[s],ease:"easeOut",onUpdate:m=>{if(!e)return;const h=a+(c-a)*m;o?e.scrollTop=h:e.scrollLeft=h}})},Aa={default:[.32,.72,0,1]},dr={initial:{opacity:0},animate:{opacity:1,transition:{ease:Aa.default,duration:.3}},exit:{opacity:0,transition:{ease:[.32,.72,0,1],duration:.3}}},Qr=new Set,Q=new WeakMap,Pe=new WeakMap,je=new WeakMap,Mt=new WeakMap,Wa=new WeakMap,Oe=new WeakMap,lt=new WeakMap,We=new WeakSet;let ve,zt=0,Ht=0;const me="__aa_tgt",He="__aa_del",ct="__aa_new",_a=e=>{const t=qa(e);t&&t.forEach(r=>Xa(r))},Ya=e=>{e.forEach(t=>{t.target===ve&&za(),Q.has(t.target)&&Se(t.target)})};function Ia(e){Mt.get(e)?.disconnect();let r=Q.get(e),n=0;const s=5;r||(r=Fe(e),Q.set(e,r));const{offsetWidth:o,offsetHeight:a}=ve,u=[r.top-s,o-(r.left+s+r.width),a-(r.top+s+r.height),r.left-s].map(d=>`${-1*Math.floor(d)}px`).join(" "),c=new IntersectionObserver(()=>{++n>1&&Se(e)},{root:ve,threshold:1,rootMargin:u});c.observe(e),Mt.set(e,c)}function Se(e){clearTimeout(lt.get(e));const t=gt(e),r=Be(t)?500:t.duration;lt.set(e,setTimeout(async()=>{const n=je.get(e);try{await n?.finished,Q.set(e,Fe(e)),Ia(e)}catch{}},r))}function za(){clearTimeout(lt.get(ve)),lt.set(ve,setTimeout(()=>{Qr.forEach(e=>tn(e,t=>Jr(()=>Se(t))))},100))}function Ha(e){setTimeout(()=>{Wa.set(e,setInterval(()=>Jr(Se.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function Jr(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let Dt,ut;const Ba=typeof window<"u"&&"ResizeObserver"in window;Ba&&(ve=document.documentElement,Dt=new MutationObserver(_a),ut=new ResizeObserver(Ya),window.addEventListener("scroll",()=>{Ht=window.scrollY,zt=window.scrollX}),ut.observe(ve));function qa(e){return e.reduce((n,s)=>[...n,...Array.from(s.addedNodes),...Array.from(s.removedNodes)],[]).every(n=>n.nodeName==="#comment")?!1:e.reduce((n,s)=>{if(n===!1)return!1;if(s.target instanceof Element){if(Nt(s.target),!n.has(s.target)){n.add(s.target);for(let o=0;o<s.target.children.length;o++){const a=s.target.children.item(o);if(a){if(He in a)return!1;Nt(s.target,a),n.add(a)}}}if(s.removedNodes.length)for(let o=0;o<s.removedNodes.length;o++){const a=s.removedNodes[o];if(He in a)return!1;a instanceof Element&&(n.add(a),Nt(s.target,a),Pe.set(a,[s.previousSibling,s.nextSibling]))}}return n},new Set)}function Nt(e,t){!t&&!(me in e)?Object.defineProperty(e,me,{value:e}):t&&!(me in t)&&Object.defineProperty(t,me,{value:e})}function Xa(e){const t=e.isConnected,r=Q.has(e);t&&Pe.has(e)&&Pe.delete(e),je.has(e)&&je.get(e)?.cancel(),ct in e?fr(e):r&&t?Ka(e):r&&!t?Ua(e):fr(e)}function ae(e){return Number(e.replace(/[^0-9.\-]/g,""))}function Va(e){let t=e.parentElement;for(;t;){if(t.scrollLeft||t.scrollTop)return{x:t.scrollLeft,y:t.scrollTop};t=t.parentElement}return{x:0,y:0}}function Fe(e){const t=e.getBoundingClientRect(),{x:r,y:n}=Va(e);return{top:t.top+n,left:t.left+r,width:t.width,height:t.height}}function Zr(e,t,r){let n=t.width,s=t.height,o=r.width,a=r.height;const i=getComputedStyle(e);if(i.getPropertyValue("box-sizing")==="content-box"){const c=ae(i.paddingTop)+ae(i.paddingBottom)+ae(i.borderTopWidth)+ae(i.borderBottomWidth),d=ae(i.paddingLeft)+ae(i.paddingRight)+ae(i.borderRightWidth)+ae(i.borderLeftWidth);n-=d,o-=d,s-=c,a-=c}return[n,o,s,a].map(Math.round)}function gt(e){return me in e&&Oe.has(e[me])?Oe.get(e[me]):{duration:250,easing:"ease-in-out"}}function en(e){if(me in e)return e[me]}function Bt(e){const t=en(e);return t?We.has(t):!1}function tn(e,...t){t.forEach(r=>r(e,Oe.has(e)));for(let r=0;r<e.children.length;r++){const n=e.children.item(r);n&&t.forEach(s=>s(n,Oe.has(n)))}}function qt(e){return Array.isArray(e)?e:[e]}function Be(e){return typeof e=="function"}function Ka(e){const t=Q.get(e),r=Fe(e);if(!Bt(e))return Q.set(e,r);let n;if(!t)return;const s=gt(e);if(typeof s!="function"){const o=t.left-r.left,a=t.top-r.top,[i,u,c,d]=Zr(e,t,r),m={transform:`translate(${o}px, ${a}px)`},h={transform:"translate(0, 0)"};s.fromBorderRadius!==void 0&&s.toBorderRadius!==void 0&&(m.borderRadius=`${s.fromBorderRadius}px`,h.borderRadius=`${s.toBorderRadius}px`),i!==u&&(m.width=`${i}px`,h.width=`${u}px`),c!==d&&(m.height=`${c}px`,h.height=`${d}px`),n=e.animate([m,h],{duration:s.duration,easing:s.easing})}else{const[o]=qt(s(e,"remain",t,r));n=new Animation(o),n.play()}je.set(e,n),Q.set(e,r),n.addEventListener("finish",Se.bind(null,e))}function fr(e){ct in e&&delete e[ct];const t=Fe(e);Q.set(e,t);const r=gt(e);if(!Bt(e))return;let n;if(typeof r!="function")n=e.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:r.duration*1.5,easing:"ease-in"});else{const[s]=qt(r(e,"add",t));n=new Animation(s),n.play()}je.set(e,n),n.addEventListener("finish",Se.bind(null,e))}function mr(e,t){e.remove(),Q.delete(e),Pe.delete(e),je.delete(e),Mt.get(e)?.disconnect(),setTimeout(()=>{if(He in e&&delete e[He],Object.defineProperty(e,ct,{value:!0,configurable:!0}),t&&e instanceof HTMLElement)for(const r in t)e.style[r]=""},0)}function Ua(e){if(!Pe.has(e)||!Q.has(e))return;const[t,r]=Pe.get(e);Object.defineProperty(e,He,{value:!0,configurable:!0});const n=window.scrollX,s=window.scrollY;if(r&&r.parentNode&&r.parentNode instanceof Element?r.parentNode.insertBefore(e,r):t&&t.parentNode?t.parentNode.appendChild(e):en(e)?.appendChild(e),!Bt(e))return mr(e);const[o,a,i,u]=Qa(e),c=gt(e),d=Q.get(e);(n!==zt||s!==Ht)&&Ga(e,n,s,c);let m,h={position:"absolute",top:`${o}px`,left:`${a}px`,width:`${i}px`,height:`${u}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!Be(c))Object.assign(e.style,h),m=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:c.duration,easing:"ease-out"});else{const[p,b]=qt(c(e,"remove",d));b?.styleReset!==!1&&(h=b?.styleReset||h,Object.assign(e.style,h)),m=new Animation(p),m.play()}je.set(e,m),m.addEventListener("finish",mr.bind(null,e,h))}function Ga(e,t,r,n){const s=zt-t,o=Ht-r,a=document.documentElement.style.scrollBehavior;if(getComputedStyle(ve).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+s,window.scrollY+o),!e.parentElement)return;const u=e.parentElement;let c=u.clientHeight,d=u.clientWidth;const m=performance.now();function h(){requestAnimationFrame(()=>{if(!Be(n)){const p=c-u.clientHeight,b=d-u.clientWidth;m+n.duration>performance.now()?(window.scrollTo({left:window.scrollX-b,top:window.scrollY-p}),c=u.clientHeight,d=u.clientWidth,h()):document.documentElement.style.scrollBehavior=a}})}h()}function Qa(e){const t=Q.get(e),[r,,n]=Zr(e,t,Fe(e));let s=e.parentElement;for(;s&&(getComputedStyle(s).position==="static"||s instanceof HTMLBodyElement);)s=s.parentElement;s||(s=document.body);const o=getComputedStyle(s),a=Q.get(s)||Fe(s),i=Math.round(t.top-a.top)-ae(o.borderTopWidth),u=Math.round(t.left-a.left)-ae(o.borderLeftWidth);return[i,u,r,n]}function rn(e,t={}){return Dt&&ut&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!Be(t)&&!t.disrespectUserMotionPreference||(We.add(e),getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),tn(e,Se,Ha,s=>ut?.observe(s)),Be(t)?Oe.set(e,t):Oe.set(e,{duration:250,easing:"ease-in-out",...t}),Dt.observe(e,{childList:!0}),Qr.add(e))),Object.freeze({parent:e,enable:()=>{We.add(e)},disable:()=>{We.delete(e)},isEnabled:()=>We.has(e)})}const pe={rounded:{3:"rounded-3",6:"rounded-6",full:"rounded-full"},colors:{solid:"bg-base-3",brand:"bg-brand text-brand-text",contrast:"bg-base-12 text-base-1"},unselectedColors:{none:"",solid:"bg-bg-uiel"},border:{solid:"border-base-6 dark-theme:border-base-5",subtle:"border-base-5 dark-theme:border-base-4",brand:"border-brand-border"},widths:{fit:{container:"max-w-fit",item:"w-fit"},full:{container:"w-full",item:"grow"}}},Ja=({options:e,selected:t,onChange:r,keyExtractor:n,labelExtractor:s,itemColor:o,itemClassName:a,color:i="contrast",unselectedColor:u="none",width:c="fit",border:d="solid",rounded:m=6,trackScroll:h=!0,className:p})=>{const[b,x]=f.useState({left:!1,right:!1}),{ref:v}=vr({onOverflow:C=>{x({left:C.canScrollLeft,right:C.canScrollRight})},trackScroll:h});return l.jsxs("div",{className:k("relative overflow-hidden",pe.widths[c].container,pe.rounded[m],p),children:[l.jsx("div",{ref:v,className:k("flex items-center border overflow-x-scroll scrollbar-hide",pe.rounded[m],pe.border[d]),children:e.map(C=>{const j=n(t)===n(C);return l.jsx("button",{onClick:()=>r?.(C),className:k("border-r px-3 py-1 last:border-none text-nowrap shrink-0",pe.widths[c].item,!j&&"lg:hover:bg-overlay-3",o?o(j):j?pe.colors[i]:pe.unselectedColors[u],pe.border[d],a),children:s(C)},n(C))})}),l.jsxs(P.AnimatePresence,{children:[b.left?l.jsx(P.motion.button,{variants:dr,initial:"initial",animate:"animate",exit:"exit",onClick:()=>{v.current&&ur({el:v.current,direction:"left"})},className:"absolute shrink-0 left-0 px-1 h-full bg-gradient-to-r from-base-2 top-0",children:l.jsx(A.ChevronLeft,{className:"text-base-13"})},"leftarrow"):null,b.right?l.jsx(P.motion.button,{variants:dr,initial:"initial",animate:"animate",exit:"exit",onClick:()=>{v.current&&ur({el:v.current,direction:"right"})},className:"absolute shrink-0 right-0 px-1 h-full bg-gradient-to-l from-base-2 top-0",children:l.jsx(A.ChevronRight,{className:"text-base-13"})},"rightarrow"):null]})]})};function nn({label:e,labelPosition:t="default",options:r,selected:n,onChange:s,idExtractor:o,labelExtractor:a,descriptionExtractor:i,classNameExtractor:u,customGetter:c,customSetter:d,error:m,placeholder:h="Selecciona una opción",searchable:p,className:b}){const[x,v]=f.useState(-1),C=f.useRef(null),{triggerRef:j,triggerProps:R,popoverRef:T,getPopoverPosition:M,open:y,toggle:N,close:O}=dt({align:"start",side:"bottom",avoidCollisions:!0,onOpen:()=>{p&&C.current&&setTimeout(()=>C.current?.focus(),10)},onClose:()=>{v(-1)}});ft(T,g=>{!j.current||!y||!g.target||j.current.contains(g.target)||O()});const W=M(),E=c&&n?c(n,r):n;return l.jsxs("div",{className:k("relative",b),children:[t==="default"&&l.jsx("label",{className:k("top-[18px] font-medium ml-0.5 text-xs",m&&"text-red-9"),children:e}),l.jsxs(q,{ref:j,color:"solidhybrid",className:"w-full justify-between",onClick:N,...R,children:[E?a(E):h,l.jsx(A.ChevronDown,{size:18,className:k("transition",y&&"rotate-180")})]}),l.jsx(P.AnimatePresence,{children:y&&l.jsx($e,{children:l.jsx(P.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},ref:T,style:{position:"fixed",left:W.x,top:W.top,bottom:W.bottom,width:j.current?.offsetWidth??200},className:k("bg-base-1 dark-theme:bg-base-3 border border-base-4","rounded-6 shadow-lg max-h-[300px] overflow-y-auto z-50","customscrollbarnohide"),role:"listbox",children:r.map((g,S)=>{const $=!!(E&&o(g)===o(E)),F=S===x,Y=i?.(g);return l.jsxs("div",{className:k("px-3 py-2 text-sm cursor-pointer flex items-center justify-between gap-x-4","first:rounded-t-6 last:rounded-b-6 relative",F&&"bg-base-3 dark-theme:bg-base-4",$&&"bg-brandfadedbg text-brand",u&&u($)),onClick:()=>{s(d?d(g):g),O()},role:"option",onMouseEnter:()=>v(S),children:[l.jsxs("div",{children:[l.jsxs("p",{children:[a(g)," "]}),Y&&l.jsx("p",{className:"text-xs text-base-11 mt-0.5 line-clamp-2",children:Y})]}),$&&l.jsx(A.CheckIcon,{size:16,className:"shrink-0"})]},o(g))})})})})]})}const Za=({name:e,...t})=>{const{control:r}=J.useFormContext();return r?l.jsx(J.Controller,{name:e,control:r,render:({field:n,fieldState:s})=>l.jsx(nn,{selected:n.value??null,onChange:o=>n.onChange(o),error:s.error?.message,...t})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},ei=({className:e})=>l.jsx("div",{className:k("w-full h-px bg-base-4",e)}),ti=({text:e,length:t=120,size:r="sm",className:n,buttonClassName:s})=>{const[o,a]=f.useState(!1),i=f.useMemo(()=>e.length>t,[e]),u=f.useMemo(()=>i?o?e:e.slice(0,t).trim()+"...":e,[e,o,i]);return l.jsxs("div",{children:[l.jsx("p",{className:k("text-base-12",r==="sm"&&"text-sm",n),children:u}),i?l.jsx("button",{onClick:()=>a(c=>!c),className:k("text-xs text-base-11",s),children:o?"Ver menos":"Ver más"}):null]})},Xt=({loading:e=!0,wrapperClassName:t,spinnerClassName:r})=>l.jsx("div",{className:k("flex justify-center",t),children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",className:k({"animate-spin":e},r),children:l.jsx("path",{fill:"currentColor",d:"M10 3a7 7 0 0 0-7 7a.5.5 0 0 1-1 0a8 8 0 1 1 8 8a.5.5 0 0 1 0-1a7 7 0 1 0 0-14Z"})})}),ri=({isEditable:e,isDeletable:t=!0,createUpdateLoading:r,deleteLoading:n,onDelete:s,onDeleteConfirm:o,addText:a="Añadir",updateText:i="Actualizar",deleteText:u="Eliminar",className:c})=>{const[d,m]=f.useState(!1);return l.jsxs("div",{className:`w-full grid grid-cols-2 gap-4 col-span-full ${c}`,children:[e&&t?l.jsxs(q,{color:"dangersolid",state:n?"loading":r?"disabled":"enabled",onClick:()=>{o?d?s?.():m(!0):s?.()},children:[l.jsx(A.X,{size:18}),o&&d?"Confirmar":u]}):null,l.jsxs(q,{color:"brand",className:k(e&&t?"":"col-span-2"),state:r?"loading":n?"disabled":"enabled",type:"submit",children:[r?l.jsx(Xt,{}):e?l.jsx(A.Check,{size:18}):l.jsx(A.Plus,{size:18}),e?i:a]})]})},sn=f.createContext(void 0),ni=({children:e,debug:t=!1})=>{const r=f.useRef([]),n=f.useCallback(d=>{r.current.push(d),t&&console.log("Modal",d,"added",r.current)},[t]),s=f.useCallback(d=>{r.current=r.current.filter(m=>m!==d),t&&console.log("Modal",d,"removed",r.current)},[t]),o=f.useCallback(()=>{const d=r.current[r.current.length-2];return t&&console.log("prev modal id",d),d},[t]),a=f.useCallback((d,m="modal",h)=>{P.animate(d,{y:m==="modal"?-30:-50,scale:.9},{ease:[.32,.72,0,1],duration:.3,delay:h?.2:void 0})},[]),i=f.useCallback(d=>{P.animate(d,{y:0,scale:1},{ease:[.32,.72,0,1],duration:.2})},[]),u=f.useCallback(()=>r.current,[]),c={add:n,remove:s,getPrevId:o,animateParentModal:a,restoreParentModal:i,getModals:u};return l.jsx(sn.Provider,{value:c,children:e})},on=()=>{const e=f.useContext(sn);if(e===void 0)throw new Error("useModals must be used within a ModalsProvider");return e},si=({withPortal:e,children:t})=>e?l.jsx($e,{children:t}):l.jsx(l.Fragment,{children:t}),oi=({id:e,prevPath:t,withDelay:r,withPortal:n=!0,title:s,description:o,showHeader:a=!0,mode:i,onReplace:u,className:c,contentClassName:d,children:m})=>{const h=de.useInitialChangeEvent(),p=qe(),b=f.useRef(null),x=on(),v=f.useMemo(()=>i==="modal"||p,[i,p]);return f.useEffect(()=>{x.add(e);const C=x.getPrevId();if(!C||(b.current=document.getElementById(C),!b.current))return;C&&x.animateParentModal(b.current,v?"modal":"sheet");//! cleanups not running on new router system
12
12
  //! IDK WHY
13
13
  return()=>{console.log("IS THIS CLEANUP RUNNING?")};//! NOT RUNNING...
14
- },[p]),f.useLayoutEffect(()=>()=>v.remove(e),[]),l.jsxs(ri,{withPortal:n,children:[l.jsx(L.motion.div,{initial:{opacity:0},animate:{opacity:1,transition:{ease:[.32,.72,0,1],duration:.3,delay:r?.2:void 0}},exit:{opacity:0,transition:{ease:[.32,.72,0,1],duration:.3}},onClick:()=>{h?ue.navigate.back():ue.navigate.replace(u??t)},className:k("bg-black/40 absolute w-full h-full left-0 top-0",n&&"z-500")}),l.jsxs(L.motion.div,{id:e,initial:{opacity:x?0:1,scale:x?.8:void 0,y:x?void 0:window.innerHeight},animate:{opacity:1,scale:1,y:x?void 0:0,transition:{ease:[.32,.72,0,1],duration:.3,delay:r?.2:void 0}},exit:{scale:x?.8:void 0,opacity:x?0:void 0,y:x?void 0:window.innerHeight,transition:{ease:[.32,.72,0,1],duration:.3}},style:{left:"50%",translateX:"-50%",bottom:x?"50%":0,translateY:x?"50%":0,height:x?"65%":"95%"},onAnimationStart:$=>{($?.scale===.8||$?.y>50)&&b.current&&v.restoreParentModal(b.current)},className:k("bg-base-1 absolute w-full lg:max-w-[600px] h-full rounded-6 overflow-hidden flex flex-col",!x&&"rounded-b-none",n&&"z-500",c),children:[a&&l.jsxs("div",{className:"flex items-start justify-between p-4 border-b border-base-3",children:[l.jsxs("div",{children:[s&&l.jsx("p",{className:"font-medium text-lg",children:s}),o&&l.jsx("p",{className:"text-base-11 text-xs",children:o})]}),l.jsx(q,{size:"xs",onClick:()=>{h?ue.navigate.back():ue.navigate.replace(u??t)},children:l.jsx(I.X,{size:20})})]}),l.jsx("div",{id:`${e}-content`,className:k("grow customscrollbar p-4 pb-6",d),children:m})]})]})};function sn({checked:e,onCheckedChange:t,disabled:r=!1,name:n,required:s,className:o=""}){const a=f.useId(),i=()=>{r||t(!e)};return l.jsxs("button",{id:a,type:"button",role:"switch","aria-checked":e,"aria-required":s,"data-state":e?"checked":"unchecked",disabled:r,onClick:i,className:k(`relative inline-flex h-[28px] w-[48px] items-center rounded-full
14
+ },[p]),f.useLayoutEffect(()=>()=>x.remove(e),[]),l.jsxs(si,{withPortal:n,children:[l.jsx(P.motion.div,{initial:{opacity:0},animate:{opacity:1,transition:{ease:[.32,.72,0,1],duration:.3,delay:r?.2:void 0}},exit:{opacity:0,transition:{ease:[.32,.72,0,1],duration:.3}},onClick:()=>{h?de.navigate.back():de.navigate.replace(u??t)},className:k("bg-black/40 absolute w-full h-full left-0 top-0",n&&"z-500")}),l.jsxs(P.motion.div,{id:e,initial:{opacity:v?0:1,scale:v?.8:void 0,y:v?void 0:window.innerHeight},animate:{opacity:1,scale:1,y:v?void 0:0,transition:{ease:[.32,.72,0,1],duration:.3,delay:r?.2:void 0}},exit:{scale:v?.8:void 0,opacity:v?0:void 0,y:v?void 0:window.innerHeight,transition:{ease:[.32,.72,0,1],duration:.3}},style:{left:"50%",translateX:"-50%",bottom:v?"50%":0,translateY:v?"50%":0,height:v?"65%":"95%"},onAnimationStart:C=>{(C?.scale===.8||C?.y>50)&&b.current&&x.restoreParentModal(b.current)},className:k("bg-base-1 absolute w-full lg:max-w-[600px] h-full rounded-6 overflow-hidden flex flex-col",!v&&"rounded-b-none",n&&"z-500",c),children:[a&&l.jsxs("div",{className:"flex items-start justify-between p-4 border-b border-base-3",children:[l.jsxs("div",{children:[s&&l.jsx("p",{className:"font-medium text-lg",children:s}),o&&l.jsx("p",{className:"text-base-11 text-xs",children:o})]}),l.jsx(q,{size:"xs",onClick:()=>{h?de.navigate.back():de.navigate.replace(u??t)},children:l.jsx(A.X,{size:20})})]}),l.jsx("div",{id:`${e}-content`,className:k("grow customscrollbar p-4 pb-6",d),children:m})]})]})};function an({checked:e,onCheckedChange:t,disabled:r=!1,name:n,required:s,className:o=""}){const a=f.useId(),i=()=>{r||t(!e)};return l.jsxs("button",{id:a,type:"button",role:"switch","aria-checked":e,"aria-required":s,"data-state":e?"checked":"unchecked",disabled:r,onClick:i,className:k(`relative inline-flex h-[28px] w-[48px] items-center rounded-full
15
15
  transition-colors duration-200 ease-in-out
16
16
  focus-visible:outline-none focus-visible:ring-1
17
17
  focus-visible:ring-base-6`,e?"bg-brand":"bg-base-3",r?"opacity-50 cursor-not-allowed":"cursor-pointer",o),children:[l.jsx("span",{className:k(`inline-block h-6 w-6 transform rounded-full
18
18
  transition-transform duration-200 ease-in-out
19
- shadow`,e?"bg-brand-text translate-x-[22px]":"bg-base-1 dark-theme:bg-base-12 translate-x-[2px]")}),n&&l.jsx("input",{type:"checkbox",name:n,checked:e,required:s,disabled:r,onChange:()=>{},tabIndex:-1,"aria-hidden":"true",className:"sr-only"})]})}const on=({label:e,variant:t="default",color:r="solid",tags:n,onChange:s,valid:o,error:a,placeholder:i="Add a tag...",maxTags:u,validateTag:c})=>{const[d,m]=f.useState(""),[h,p]=f.useState(!1),[b,v]=f.useState(null),x=f.useRef(null),$=f.useRef(null),j=f.useRef([]),R=n.length>0,T=f.useRef(`taginput-${Math.random().toString(36).substr(2,9)}`).current,M=f.useRef(`label-${Math.random().toString(36).substr(2,9)}`).current,y=f.useRef(`error-${Math.random().toString(36).substr(2,9)}`).current;f.useEffect(()=>{j.current=j.current.slice(0,n.length)},[n.length]);const N=C=>{if(C.key==="Enter"&&d.trim()){C.preventDefault();const O=d.trim();if(u&&n.length>=u){v(`Maximum of ${u} tags allowed`);return}if(n.includes(O)){v("Tag already exists");return}if(c){const _=c(O);if(typeof _=="string"){v(_);return}else if(_===!1){v("Invalid tag");return}}s([...n,O]),m(""),v(null),S(`Added tag ${O}`)}else if(C.key==="Backspace"&&!d&&n.length>0){const O=n[n.length-1];s(n.slice(0,-1)),S(`Removed tag ${O}`)}else C.key==="ArrowLeft"&&d===""&&n.length>0&&j.current[n.length-1]&&j.current[n.length-1]?.focus()},P=(C,O)=>{if(C.key==="Backspace"||C.key==="Delete"){C.preventDefault();const _=n[O],X=[...n];X.splice(O,1),s(X),setTimeout(()=>{x.current&&x.current.focus()},0),S(`Removed tag ${_}`)}else C.key==="ArrowRight"?(C.preventDefault(),O<n.length-1?j.current[O+1]?.focus():x.current?.focus()):C.key==="ArrowLeft"&&(C.preventDefault(),O>0&&j.current[O-1]?.focus())},A=(C,O)=>{s(n.filter(_=>_!==C)),setTimeout(()=>{O<n.length-1?j.current[O]?.focus():O>0?j.current[O-1]?.focus():x.current?.focus()},0),S(`Removed tag ${C}`)},E=C=>{m(C.target.value),v(null)},g=()=>{x.current&&x.current.focus()},S=C=>{console.log(`Accessibility announcement: ${C}`)};return l.jsxs("div",{children:[l.jsxs("div",{className:"relative",ref:$,children:[t==="default"?l.jsxs("label",{id:M,htmlFor:T,className:k("text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":h||R||i,"text-red-9":!!a}),children:[e," ",u&&`(${n.length}/${u})`]}):null,l.jsxs("div",{className:k("rounded-6 px-2 transition cursor-text pr-10",{"bg-base-3":r==="solid","border border-uielborder focus-visible:border-transparent":r==="outline","py-3":t==="default","pt-5 pb-2":t==="floating","ring-2 ring-branduielborder":h,"text-red-9":a||b,"ring-2 ring-red-6":(a||b)&&h}),onClick:g,role:"group","aria-labelledby":M,"aria-describedby":a||b?y:void 0,children:[t==="floating"?l.jsxs("label",{id:M,htmlFor:T,className:k("absolute transition-all duration-200 pointer-events-none","text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":h||R||i,"text-red-9":!!a}),children:[e," ",u&&`(${n.length}/${u})`]}):null,l.jsxs("div",{className:k("flex flex-wrap gap-1 items-center",{"mt-2.5":t==="floating"}),children:[n.map((C,O)=>l.jsxs("div",{ref:_=>{j.current[O]=_},className:k("line-clamp-1 text-brand rounded-full px-2 text-sm flex items-center",{"bg-brandfadedbg text-brand":!a&&!b,"bg-red-4 text-red-9":a||b}),tabIndex:0,role:"button","aria-label":`${C}, press delete or backspace to remove`,onKeyDown:_=>P(_,O),children:[C,l.jsx("button",{type:"button",className:"ml-1 text-brand hover:text-brandhover shrink-0",onClick:()=>A(C,O),"aria-label":`Remove ${C} tag`,children:"x"})]},`${C}-${O}`)),l.jsx("input",{id:T,ref:x,type:"text",className:"flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm placeholder:text-secondarytext",value:d,onChange:E,onKeyDown:N,onFocus:()=>p(!0),onBlur:()=>p(!1),enterKeyHint:"enter",autoComplete:"off",placeholder:n.length>0?"":i,style:{width:`${Math.max(60,d.length*8)}px`},"aria-describedby":a||b?y:void 0,"aria-invalid":!!(a||b)})]})]}),o&&l.jsx("span",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:l.jsx(I.CheckIcon,{})})]}),(a||b)&&l.jsx("p",{id:y,className:"text-red-500 text-xs mt-1","aria-live":"assertive",children:a||b}),l.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:n.length>0?`Current tags: ${n.join(", ")}`:"No tags added yet"})]})},si=({name:e,...t})=>{const{control:r}=J.useFormContext();return r?l.jsx(J.Controller,{name:e,control:r,render:({field:n,fieldState:s})=>l.jsx(on,{tags:n.value,onChange:o=>n.onChange(o),error:s.error?.message,...t})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},oi={brand:"ring-1 ring-brand",solid:"ring-1 ring-base-6"},Bt=f.forwardRef(({label:e,labelPosition:t="default",placeholder:r,error:n,focusColor:s="brand",className:o,value:a,rows:i=3,...u},c)=>{const[d,m]=f.useState(!1),h=a!==""&&a!==null&&a!==void 0;return l.jsxs("div",{className:"relative",children:[t==="default"?l.jsx("label",{className:k("top-[18px] font-medium ml-0.5 text-xs",n&&"text-red-9"),children:e}):null,l.jsxs("div",{className:k(t==="default"?"p-0":"pt-5 pb-2",{"bg-red-4 text-red-9":!!n}),children:[t==="floating"&&l.jsx("label",{className:k("absolute transition-all duration-200 pointer-events-none","text-sm top-2.5 font-semibold left-2.5",{"text-xs top-2.5":d||h||r,"text-red-9":!!n}),children:e}),l.jsx("textarea",{ref:c,className:k(!n&&d&&oi[s],"bg-base-3 border border-base-4 light-theme:drop-shadow-sm rounded-6 w-full focus-visible:outline-none customscrollbarnohide","placeholder:text-base-11 text-sm","resize-none",t==="default"?"p-3":"mt-1",{"text-red-9 placeholder:text-red-9":!!n},o),value:a,placeholder:r,onFocus:()=>m(!0),onBlur:()=>m(!1),rows:i,...u})]})]})});Bt.displayName="TextArea";const ai=({name:e,customRead:t,customSet:r,...n})=>{const{control:s}=J.useFormContext(),o=f.useCallback(i=>t?t(i):i===null?Mt(i):i,[t]),a=f.useCallback(i=>r?r(i):i===null?et(i):i,[r]);return s?l.jsx(J.Controller,{name:e,control:s,render:({field:i,fieldState:u})=>l.jsxs("div",{children:[l.jsx(Bt,{value:o(i.value),onChange:c=>i.onChange(a(c.target.value)),error:!!u.error,ref:i.ref,...n}),u.error?l.jsx("span",{role:"alert",className:"text-red-9 text-sm mt-1 ml-0.5",children:u.error.message}):null]})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},ii=["Lunes","Martes","Miercoles","Jueves","Viernes","Sábado","Domingo"],li=()=>l.jsx(ci,{}),ci=()=>l.jsx("div",{children:ii.map(e=>l.jsx(ui,{day:e},e))}),ui=({day:e})=>{const[t,r]=f.useState(!1),n=f.useRef(null);return f.useEffect(()=>{n.current&&Zr(n.current)},[]),l.jsxs("div",{ref:n,className:k("p-2 rounded-xl mt-2",{"border border-uielborder":t,"bg-uielbg border border-transparent":!t}),children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{children:e}),l.jsx(sn,{className:"mt-0",checked:t,onCheckedChange:s=>r(s)})]}),t?l.jsx(di,{}):null]},e)},di=()=>{const[e,t]=f.useState([{from:"08:00",to:"12:00"},{from:"14:00",to:"18:00"}]),r=f.useRef(null);return f.useEffect(()=>{r.current&&Zr(r.current)},[]),l.jsxs("div",{ref:r,children:[e.map((n,s)=>l.jsxs("div",{className:"flex items-center justify-between mt-2",children:[l.jsx("p",{className:"text-sm text-secondarytext",children:"De"}),l.jsx(q,{color:"solid",className:"w-24",children:n.from}),l.jsx("p",{className:"text-sm text-secondarytext mx-1",children:"a"}),l.jsx(q,{color:"solid",className:"w-24",children:n.to}),l.jsx(q,{className:"rounded-full",children:l.jsx(I.X,{className:"text-secondarytext",size:20})})]},`${n.from}${s}`)),l.jsxs(q,{onClick:()=>t(n=>[...n,{from:"19:00",to:"21:00"}]),className:"w-full mt-4",color:"contrast",children:[l.jsx(I.Plus,{className:"stroke-1"}),"Añadir hora"]})]})};/**
19
+ shadow`,e?"bg-brand-text translate-x-[22px]":"bg-base-1 dark-theme:bg-base-12 translate-x-[2px]")}),n&&l.jsx("input",{type:"checkbox",name:n,checked:e,required:s,disabled:r,onChange:()=>{},tabIndex:-1,"aria-hidden":"true",className:"sr-only"})]})}const ln=({label:e,variant:t="default",color:r="solid",tags:n,onChange:s,valid:o,error:a,placeholder:i="Add a tag...",maxTags:u,validateTag:c})=>{const[d,m]=f.useState(""),[h,p]=f.useState(!1),[b,x]=f.useState(null),v=f.useRef(null),C=f.useRef(null),j=f.useRef([]),R=n.length>0,T=f.useRef(`taginput-${Math.random().toString(36).substr(2,9)}`).current,M=f.useRef(`label-${Math.random().toString(36).substr(2,9)}`).current,y=f.useRef(`error-${Math.random().toString(36).substr(2,9)}`).current;f.useEffect(()=>{j.current=j.current.slice(0,n.length)},[n.length]);const N=$=>{if($.key==="Enter"&&d.trim()){$.preventDefault();const F=d.trim();if(u&&n.length>=u){x(`Maximum of ${u} tags allowed`);return}if(n.includes(F)){x("Tag already exists");return}if(c){const Y=c(F);if(typeof Y=="string"){x(Y);return}else if(Y===!1){x("Invalid tag");return}}s([...n,F]),m(""),x(null),S(`Added tag ${F}`)}else if($.key==="Backspace"&&!d&&n.length>0){const F=n[n.length-1];s(n.slice(0,-1)),S(`Removed tag ${F}`)}else $.key==="ArrowLeft"&&d===""&&n.length>0&&j.current[n.length-1]&&j.current[n.length-1]?.focus()},O=($,F)=>{if($.key==="Backspace"||$.key==="Delete"){$.preventDefault();const Y=n[F],X=[...n];X.splice(F,1),s(X),setTimeout(()=>{v.current&&v.current.focus()},0),S(`Removed tag ${Y}`)}else $.key==="ArrowRight"?($.preventDefault(),F<n.length-1?j.current[F+1]?.focus():v.current?.focus()):$.key==="ArrowLeft"&&($.preventDefault(),F>0&&j.current[F-1]?.focus())},W=($,F)=>{s(n.filter(Y=>Y!==$)),setTimeout(()=>{F<n.length-1?j.current[F]?.focus():F>0?j.current[F-1]?.focus():v.current?.focus()},0),S(`Removed tag ${$}`)},E=$=>{m($.target.value),x(null)},g=()=>{v.current&&v.current.focus()},S=$=>{console.log(`Accessibility announcement: ${$}`)};return l.jsxs("div",{children:[l.jsxs("div",{className:"relative",ref:C,children:[t==="default"?l.jsxs("label",{id:M,htmlFor:T,className:k("text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":h||R||i,"text-red-9":!!a}),children:[e," ",u&&`(${n.length}/${u})`]}):null,l.jsxs("div",{className:k("rounded-6 px-2 transition cursor-text pr-10",{"bg-base-3":r==="solid","border border-uielborder focus-visible:border-transparent":r==="outline","py-3":t==="default","pt-5 pb-2":t==="floating","ring-2 ring-branduielborder":h,"text-red-9":a||b,"ring-2 ring-red-6":(a||b)&&h}),onClick:g,role:"group","aria-labelledby":M,"aria-describedby":a||b?y:void 0,children:[t==="floating"?l.jsxs("label",{id:M,htmlFor:T,className:k("absolute transition-all duration-200 pointer-events-none","text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":h||R||i,"text-red-9":!!a}),children:[e," ",u&&`(${n.length}/${u})`]}):null,l.jsxs("div",{className:k("flex flex-wrap gap-1 items-center",{"mt-2.5":t==="floating"}),children:[n.map(($,F)=>l.jsxs("div",{ref:Y=>{j.current[F]=Y},className:k("line-clamp-1 text-brand rounded-full px-2 text-sm flex items-center",{"bg-brandfadedbg text-brand":!a&&!b,"bg-red-4 text-red-9":a||b}),tabIndex:0,role:"button","aria-label":`${$}, press delete or backspace to remove`,onKeyDown:Y=>O(Y,F),children:[$,l.jsx("button",{type:"button",className:"ml-1 text-brand hover:text-brandhover shrink-0",onClick:()=>W($,F),"aria-label":`Remove ${$} tag`,children:"x"})]},`${$}-${F}`)),l.jsx("input",{id:T,ref:v,type:"text",className:"flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm placeholder:text-secondarytext",value:d,onChange:E,onKeyDown:N,onFocus:()=>p(!0),onBlur:()=>p(!1),enterKeyHint:"enter",autoComplete:"off",placeholder:n.length>0?"":i,style:{width:`${Math.max(60,d.length*8)}px`},"aria-describedby":a||b?y:void 0,"aria-invalid":!!(a||b)})]})]}),o&&l.jsx("span",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:l.jsx(A.CheckIcon,{})})]}),(a||b)&&l.jsx("p",{id:y,className:"text-red-500 text-xs mt-1","aria-live":"assertive",children:a||b}),l.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:n.length>0?`Current tags: ${n.join(", ")}`:"No tags added yet"})]})},ai=({name:e,...t})=>{const{control:r}=J.useFormContext();return r?l.jsx(J.Controller,{name:e,control:r,render:({field:n,fieldState:s})=>l.jsx(ln,{tags:n.value,onChange:o=>n.onChange(o),error:s.error?.message,...t})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},ii={brand:"ring-1 ring-brand",solid:"ring-1 ring-base-6"},Vt=f.forwardRef(({label:e,labelPosition:t="default",placeholder:r,error:n,focusColor:s="brand",className:o,value:a,rows:i=3,...u},c)=>{const[d,m]=f.useState(!1),h=a!==""&&a!==null&&a!==void 0;return l.jsxs("div",{className:"relative",children:[t==="default"?l.jsx("label",{className:k("top-[18px] font-medium ml-0.5 text-xs",n&&"text-red-9"),children:e}):null,l.jsxs("div",{className:k(t==="default"?"p-0":"pt-5 pb-2",{"bg-red-4 text-red-9":!!n}),children:[t==="floating"&&l.jsx("label",{className:k("absolute transition-all duration-200 pointer-events-none","text-sm top-2.5 font-semibold left-2.5",{"text-xs top-2.5":d||h||r,"text-red-9":!!n}),children:e}),l.jsx("textarea",{ref:c,className:k(!n&&d&&ii[s],"bg-base-3 border border-base-4 light-theme:drop-shadow-sm rounded-6 w-full focus-visible:outline-none customscrollbarnohide","placeholder:text-base-11 text-sm","resize-none",t==="default"?"p-3":"mt-1",{"text-red-9 placeholder:text-red-9":!!n},o),value:a,placeholder:r,onFocus:()=>m(!0),onBlur:()=>m(!1),rows:i,...u})]})]})});Vt.displayName="TextArea";const li=({name:e,customRead:t,customSet:r,...n})=>{const{control:s}=J.useFormContext(),o=f.useCallback(i=>t?t(i):i===null?Pt(i):i,[t]),a=f.useCallback(i=>r?r(i):i===null?rt(i):i,[r]);return s?l.jsx(J.Controller,{name:e,control:s,render:({field:i,fieldState:u})=>l.jsxs("div",{children:[l.jsx(Vt,{value:o(i.value),onChange:c=>i.onChange(a(c.target.value)),error:!!u.error,ref:i.ref,...n}),u.error?l.jsx("span",{role:"alert",className:"text-red-9 text-sm mt-1 ml-0.5",children:u.error.message}):null]})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},ci=["Lunes","Martes","Miercoles","Jueves","Viernes","Sábado","Domingo"],ui=()=>l.jsx(di,{}),di=()=>l.jsx("div",{children:ci.map(e=>l.jsx(fi,{day:e},e))}),fi=({day:e})=>{const[t,r]=f.useState(!1),n=f.useRef(null);return f.useEffect(()=>{n.current&&rn(n.current)},[]),l.jsxs("div",{ref:n,className:k("p-2 rounded-xl mt-2",{"border border-uielborder":t,"bg-uielbg border border-transparent":!t}),children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{children:e}),l.jsx(an,{className:"mt-0",checked:t,onCheckedChange:s=>r(s)})]}),t?l.jsx(mi,{}):null]},e)},mi=()=>{const[e,t]=f.useState([{from:"08:00",to:"12:00"},{from:"14:00",to:"18:00"}]),r=f.useRef(null);return f.useEffect(()=>{r.current&&rn(r.current)},[]),l.jsxs("div",{ref:r,children:[e.map((n,s)=>l.jsxs("div",{className:"flex items-center justify-between mt-2",children:[l.jsx("p",{className:"text-sm text-secondarytext",children:"De"}),l.jsx(q,{color:"solid",className:"w-24",children:n.from}),l.jsx("p",{className:"text-sm text-secondarytext mx-1",children:"a"}),l.jsx(q,{color:"solid",className:"w-24",children:n.to}),l.jsx(q,{className:"rounded-full",children:l.jsx(A.X,{className:"text-secondarytext",size:20})})]},`${n.from}${s}`)),l.jsxs(q,{onClick:()=>t(n=>[...n,{from:"19:00",to:"21:00"}]),className:"w-full mt-4",color:"contrast",children:[l.jsx(A.Plus,{className:"stroke-1"}),"Añadir hora"]})]})};/**
20
20
  * @license
21
21
  * Attempt
22
22
  * Copyright (c) 2025 Mateo Suarez. All rights reserved.
@@ -24,4 +24,4 @@ return()=>{console.log("IS THIS CLEANUP RUNNING?")};//! NOT RUNNING...
24
24
  * Free to use in your own personal or commercial applications and projects.
25
25
  * Unauthorized copying, modification, or distribution is strictly prohibited.
26
26
  * See LICENSE file for full terms.
27
- */class fi{listeners=new Map;emit(t,r){let n=this.listeners.get(t);n&&n.forEach(s=>s(r))}listen(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>{let n=this.listeners.get(t);n&&(n.delete(r),n.size===0&&this.listeners.delete(t))}}}class mi{constructor(){this.listeners=new Map}emit(t,r){const n=this.listeners.get(t);n&&n.forEach(s=>s(r))}listen(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>{const n=this.listeners.get(t);n&&(n.delete(r),n.size===0&&this.listeners.delete(t))}}}function hi(e,t,r=!0){const n=f.useRef(void 0);f.useEffect(()=>(r||n.current&&n.current(),n.current=an.listen(e,t),()=>n.current&&n.current()),[e,t,r])}const an=new fi;exports.AliveScope=ka;exports.Avatar=xn;exports.AvatarsGroup=wn;exports.Button=q;exports.Calendar=Wt;exports.Checkbox=Ar;exports.ConfirmationDialog=ra;exports.DatePickerDemo=Jo;exports.DatePickerPopover=Zo;exports.DateTimePicker=ta;exports.ElasticHeader=na;exports.EventEmitter=mi;exports.FocusTrap=gn;exports.Form=ba;exports.FormInput=xa;exports.FormMultiSelect=Ta;exports.FormSelect=Qa;exports.FormSubmit=ei;exports.FormTags=si;exports.FormTextArea=ai;exports.FormWorkingHours=li;exports.Icon=Br;exports.Input=_t;exports.KeepAlive=ja;exports.List=Ca;exports.ListItem=Sa;exports.ModalsProvider=ti;exports.MultiSelect=Vr;exports.PageScroller=Ma;exports.PageTitle=Oa;exports.PopoverCard=Rr;exports.PopoverCardContent=Uo;exports.PopoverCardFooter=Go;exports.PopoverCardHeader=Ko;exports.Portal=Fe;exports.SearchInput=Fa;exports.SegmentedControl=Ga;exports.Select=en;exports.Separator=Ja;exports.ShowMoreText=Za;exports.Spinner=tn;exports.SuperModal=ni;exports.Switch=sn;exports.Tags=on;exports.TextArea=Bt;exports.TimePicker=ea;exports.calculatePopoverPosition=vr;exports.checkOverflow=_e;exports.cn=k;exports.debounce=hn;exports.eventEmitter=an;exports.extractDirtyData=pn;exports.generateInitials=mr;exports.nullRead=Mt;exports.nullSet=et;exports.removeWhitespaces=br;exports.setFocusEnd=hr;exports.throttle=Oe;exports.toTitleCase=bn;exports.useClickAway=kn;exports.useClickAwayAdvanced=Nn;exports.useClickAwayWithRef=ut;exports.useEventListener=hi;exports.useKeepAlive=$a;exports.useKeyListener=xr;exports.useLargeScreen=Be;exports.useMergedRef=Dt;exports.useMethods=pa;exports.useModals=nn;exports.useOverflow=pr;exports.useOverflowState=vn;exports.usePopover=ct;exports.useRipple=gr;exports.useScroller=Da;
27
+ */class hi{listeners=new Map;emit(t,r){let n=this.listeners.get(t);n&&n.forEach(s=>s(r))}listen(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>{let n=this.listeners.get(t);n&&(n.delete(r),n.size===0&&this.listeners.delete(t))}}}class bi{constructor(){this.listeners=new Map}emit(t,r){const n=this.listeners.get(t);n&&n.forEach(s=>s(r))}listen(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>{const n=this.listeners.get(t);n&&(n.delete(r),n.size===0&&this.listeners.delete(t))}}}function tt(e,t,r=!0){const n=f.useRef(void 0);f.useEffect(()=>(r||n.current&&n.current(),n.current=ie.listen(e,t),()=>n.current&&n.current()),[e,t,r])}const ie=new hi;function cn(e=8){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let r="";for(let n=0;n<e;n++)r+=t.charAt(Math.floor(Math.random()*t.length));return r}const pi=({colors:e})=>{const[t,r]=f.useState([]),n=f.useCallback(a=>{r(i=>[...i,{...a,id:a.id??cn()}])},[]),s=f.useCallback(a=>r(i=>i.filter(u=>u.id!==a)),[]),o=f.useCallback((a,i)=>{r(u=>{const c=u.findIndex(h=>h.id===a);if(c===-1)return u;const d=u[c];return[...u.slice(0,c),{...d,...i},...u.slice(c+1)]})},[]);return tt("create-toast",a=>{n(a)}),tt("update-toast",a=>{o(a.id,a.toast)}),tt("remove-toast",a=>{s(a.id)}),l.jsx($e,{children:l.jsx(P.motion.div,{id:"toaster",className:"fixed z-9999 top-[calc(var(--safe-area-top)+0px)] pointer-events-none left-0 mt-4 mb-4 px-4 w-full flex flex-col gap-y-2 items-center justify-center",children:l.jsx(P.AnimatePresence,{mode:"popLayout",children:t.map(a=>l.jsx(xi,{toast:a,remove:s,colors:e},a.id))})})})},gi={simple:{icon:A.ArrowRight,color:"text-base-12"},info:{icon:A.Info,color:"text-blue-9"},success:{icon:A.CheckCircle,color:"text-brand"},warning:{icon:A.TriangleAlert,color:"text-yellow-9"},error:{icon:A.XCircle,color:"text-red-9"}},xi=({toast:e,remove:t,colors:r})=>{f.useEffect(()=>{let o;return e.type==="loading"?o=setTimeout(()=>{t(e.id)},e?.timeout??1e4):o=setTimeout(()=>{t(e.id)},e?.duration??3e3),()=>clearTimeout(o)},[e.type,e.id,e.duration,e.timeout,t]);const n=f.useMemo(()=>r?r[e.type]??null:null,[r]),s=f.useMemo(()=>gi[e.type]??null,[e.type]);return l.jsxs(P.motion.div,{layout:!0,initial:{y:-40,opacity:0},animate:{y:0,opacity:1},exit:{y:-40,opacity:0},className:k("p-2 max-w-96 origin-center rounded-6 flex items-center gap-x-1.5 bg-base-1"),children:[e.type==="loading"?l.jsx(Xt,{wrapperClassName:"shrink-0",spinnerClassName:"h-5 w-5"}):e.type!=="simple"&&s?l.jsx(s.icon,{size:20,className:k("shrink-0",n??s.color)}):null,l.jsx("p",{className:"text-sm",children:e.message})]})},vi={simple:(e,t)=>ie.emit("create-toast",{type:"simple",message:e,...t}),info:(e,t)=>ie.emit("create-toast",{type:"info",message:e,...t}),success:(e,t)=>ie.emit("create-toast",{type:"success",message:e,...t}),warning:(e,t)=>ie.emit("create-toast",{type:"warning",message:e,...t}),error:(e,t)=>ie.emit("create-toast",{type:"error",message:e,...t}),loading:(e,t)=>{const r=cn();return ie.emit("create-toast",{id:r,type:"loading",message:e,...t}),r},update:(e,t)=>{ie.emit("update-toast",{id:e,toast:t})},dismiss:e=>{ie.emit("remove-toast",{id:e})}};exports.AliveScope=Ea;exports.Avatar=yn;exports.AvatarsGroup=kn;exports.Button=q;exports.Calendar=Yt;exports.Checkbox=Yr;exports.ConfirmationDialog=sa;exports.DatePickerDemo=ea;exports.DatePickerPopover=ta;exports.DateTimePicker=na;exports.ElasticHeader=oa;exports.EventEmitter=bi;exports.FocusTrap=vn;exports.Form=ga;exports.FormInput=ya;exports.FormMultiSelect=Da;exports.FormSelect=Za;exports.FormSubmit=ri;exports.FormTags=ai;exports.FormTextArea=li;exports.FormWorkingHours=ui;exports.Icon=Vr;exports.Input=It;exports.KeepAlive=Sa;exports.List=Ta;exports.ListItem=Ma;exports.ModalsProvider=ni;exports.MultiSelect=Gr;exports.PageScroller=Pa;exports.PageTitle=La;exports.PopoverCard=_r;exports.PopoverCardContent=Qo;exports.PopoverCardFooter=Jo;exports.PopoverCardHeader=Go;exports.Portal=$e;exports.SearchInput=Ra;exports.SegmentedControl=Ja;exports.Select=nn;exports.Separator=ei;exports.ShowMoreText=ti;exports.Spinner=Xt;exports.SuperModal=oi;exports.Switch=an;exports.Tags=ln;exports.TextArea=Vt;exports.TimePicker=ra;exports.Toaster=pi;exports.calculatePopoverPosition=yr;exports.checkOverflow=Ye;exports.cn=k;exports.debounce=pn;exports.eventEmitter=ie;exports.extractDirtyData=xn;exports.generateInitials=pr;exports.nullRead=Pt;exports.nullSet=rt;exports.removeWhitespaces=xr;exports.setFocusEnd=gr;exports.throttle=Le;exports.toTitleCase=gn;exports.toast=vi;exports.useClickAway=En;exports.useClickAwayAdvanced=Cn;exports.useClickAwayWithRef=ft;exports.useEventListener=tt;exports.useKeepAlive=$a;exports.useKeyListener=kr;exports.useLargeScreen=qe;exports.useMergedRef=Ot;exports.useMethods=xa;exports.useModals=on;exports.useOverflow=vr;exports.useOverflowState=wn;exports.usePopover=dt;exports.useRipple=wr;exports.useScroller=Oa;