@mateosuarezdev/react-ui 1.0.34 → 1.0.36
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 +1 -1
- package/dist/index.js +2 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),f=require("react"),br=require("react-dom"),hn=require("clsx"),bn=require("tailwind-merge"),pn=require("@mateosuarezdev/atoms"),Y=require("lucide-react"),R=require("framer-motion"),te=require("react-hook-form"),Je=require("@hookform/resolvers"),pr=require("@mateosuarezdev/gestures"),Re=require("@mateosuarezdev/react-router"),N=(...e)=>bn.twMerge(hn.clsx(e));function Fe(e,t=100){let r=null,n=null;return function(...o){const s=Date.now();r===null||s-r>=t?(e.apply(this,o),r=s):(n&&clearTimeout(n),n=setTimeout(()=>{e.apply(this,o),r=Date.now()},t-(s-r)))}}function gn(e,t=500){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{e.apply(this,n),r=null},t)}}function gr(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 vr(e){e.focus();const t=e.value.length;e.setSelectionRange(t,t)}function wr(e){return e.replace(/\s/g,"")}function vn(e){return e.toLowerCase().split(" ").map(o=>{if(o.length===0)return o;const s=[...o][0],a=o.slice(s.length);return s.toUpperCase()+a}).join(" ")}function Dt(e){return e===null?"":e}function ot(e){return wr(e)===""?null:e}function wn(e,t,r={}){const n={...r};return Object.keys(t).forEach(o=>{if(t[o]===!0&&o in e){const s=o;n[s]=e[s]}}),n}class xn{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],o=r[r.length-1];t.key==="Tab"&&(t.shiftKey&&document.activeElement===n?(t.preventDefault(),o.focus()):!t.shiftKey&&document.activeElement===o&&(t.preventDefault(),n.focus()))}handleClickOutside(t){this.container&&!this.container.contains(t.target)&&(t.preventDefault(),this.previouslyFocusedElement&&this.previouslyFocusedElement.focus&&this.previouslyFocusedElement.focus())}}const Ie=e=>{const t=e.scrollWidth>e.clientWidth,r=e.scrollHeight>e.clientHeight,n=Math.max(0,e.scrollWidth-e.clientWidth),o=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<o,scrollPercentageX:t&&n>0?e.scrollLeft/n*100:0,scrollPercentageY:r&&o>0?e.scrollTop/o*100:0}},xr=({onOverflow:e,trackScroll:t=!1,withObserver:r=!1,enabled:n=!0,deps:o=[]}={})=>{const s=f.useRef(null);return f.useEffect(()=>{if(!s.current||!n)return;let a=!1;const u=Fe(()=>{if(s.current){const h=Ie(s.current);e?.(h)}}),l=Ie(s.current);a=l.horizontal||l.vertical,e?.(l),window.addEventListener("resize",u);let d=null;r&&(d=new ResizeObserver(u),s.current&&d.observe(s.current));let m=null;return t&&a&&(m=s.current,m.addEventListener("scroll",u)),()=>{window.removeEventListener("resize",u),d&&d.disconnect(),m&&a&&m.removeEventListener("scroll",u)}},[n,...o]),{ref:s}},yn=({trackScroll:e=!1,withObserver:t=!1,enabled:r=!0,deps:n=[]}={})=>{const o=f.useRef(null),[s,a]=f.useState(null);return f.useEffect(()=>{if(!o.current||!r)return;let i=!1;const l=Fe(()=>{if(o.current){const p=Ie(o.current);a(p)}}),d=Ie(o.current);i=d.horizontal||d.vertical,a(d),window.addEventListener("resize",l);let m=null;t&&(m=new ResizeObserver(l),o.current&&m.observe(o.current));let h=null;return e&&i&&(h=o.current,h.addEventListener("scroll",l)),()=>{window.removeEventListener("resize",l),m&&m.disconnect(),h&&i&&h.removeEventListener("scroll",l)}},[r,...n]),{ref:o,overflowInfo:s}},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"},kn=({src:e,name:t,size:r="md",className:n})=>e?c.jsx("img",{alt:"avatar",src:e,className:N("rounded-full bg-base-3",vt[r])}):t?c.jsx("p",{className:N("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:gr(t)}):c.jsx("div",{className:N("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:c.jsxs(Kr,{size:r==="xs"?16:r==="sm"?20:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[c.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),c.jsx("circle",{cx:"12",cy:"7",r:"4"})]})});function Nn({className:e,children:t,animate:r=!1,...n}){return c.jsx("div",{className:N("flex -space-x-3 rtl:space-x-reverse",e),...n,children:t})}function En(e){return f.useSyncExternalStore(t=>e.subscribe(t),()=>e.get(),()=>e.get())}const Et=pn.atom(typeof window<"u"?window.innerWidth>1024:!0);let wt=!1;const Ut=Fe(()=>{Et.set(window.innerWidth>1024)});typeof window<"u"&&(wt&&(window.removeEventListener("resize",Ut),wt=!1),window.addEventListener("resize",Ut),wt=!0);const Xe=()=>(f.useLayoutEffect(()=>{Et.set(window.innerWidth>1024)},[]),En(Et));function Pt(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}const yr=(e=!0,t)=>{const r=Xe(),n=f.useRef(null),o=f.useCallback(s=>{if(!e||r)return;const a=n.current;if(!a)return;const i=a.getBoundingClientRect(),u=Math.max(i.width,i.height),l=s.clientX-i.left-u/2,d=s.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=`${l}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:o,styles:{position:"relative"}}},Ot=({scrollerId:e,align:t="start",side:r="bottom",offset:n=8,collisionPadding:o=8,avoidCollisions:s=!0,closeOnScroll:a=!0,onOpen:i,onClose:u}={})=>{const[l,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}),y=f.useRef(null),$=f.useId(),C=f.useCallback(x=>{const k=x??v.current;if(!k)return{x:0,top:0,bottom:void 0};const O=m.width,W=m.height;return kr({triggerRect:k,popoverWidth:O,popoverHeight:W,align:t,side:r,offset:n,collisionPadding:o,avoidCollisions:s})},[v.current,m,t,r]);f.useEffect(()=>{if(!l||!e||(y.current=document.getElementById(e),!y.current))return;l&&L();const x=()=>{y.current&&(d(!1),i?.(),y.current.removeEventListener("scroll",x))};return a&&y.current.addEventListener("scroll",x,{passive:!0}),()=>{y.current&&y.current.removeEventListener("scroll",x)}},[l,e]);const L=()=>{b.current&&h({width:b.current.offsetWidth,height:b.current.offsetHeight})},M=f.useCallback(()=>{if(!p.current)return;const x=p.current.getBoundingClientRect();v.current={left:x.left,right:x.right,top:x.top,bottom:x.bottom,x:x.x,y:x.y,width:x.width,height:x.height},d(k=>(k?u?.():i?.(),!k))},[]),D=f.useCallback(()=>{d(!1),u?.()},[]);return{triggerRef:p,triggerProps:{id:$,"aria-expanded":l,"aria-haspopup":!0},popoverRef:b,getPopoverPosition:C,open:l,toggle:M,close:D}},kr=({triggerRect:e,popoverWidth:t,popoverHeight:r,align:n="start",side:o="bottom",offset:s=4,collisionPadding:a=8,avoidCollisions:i=!0})=>{const u={width:window.innerWidth,height:window.innerHeight};let l=0,d=0;if(i){if(o==="right"){const p=e.right+s,b=e.left-t-s,v=Math.max(0,p+t-(u.width-a)),y=Math.max(0,a-b);v<=y?(l=p,v>0&&(l=u.width-t-a)):(l=b,y>0&&(l=a)),d=e.top,d+r>u.height-a&&(d=u.height-r-a),d<a&&(d=a)}else if(o==="left"){const p=e.left-t-s,b=e.right+s,v=Math.max(0,a-p),y=Math.max(0,b+t-(u.width-a));v<=y?(l=p,v>0&&(l=a)):(l=b,y>0&&(l=u.width-t-a)),d=e.top,d+r>u.height-a&&(d=u.height-r-a),d<a&&(d=a)}else if(o==="bottom"){const p=u.height-e.bottom,b=e.top;p>=r+s?d=e.bottom+s:b>=r+s?d=e.top-r-s:(d=e.bottom+s,d=Math.min(d,u.height-r-a));const v=u.width-e.left,y=e.right;if(n==="start")l=e.left,l+t>u.width-a&&(y>=t?l=e.right-t:l=u.width-t-a);else if(n==="end")l=e.right-t,l<a&&(v>=t?l=e.left:l=a);else{const $=e.left+e.width/2-t/2;$>=a&&$+t<=u.width-a?l=$:$<a?l=a:l=u.width-t-a}}else{const p=e.top,b=u.height-e.bottom;p>=r+s?d=e.top-r-s:b>=r+s?d=e.bottom+s:(d=e.top-r-s,d=Math.max(a,d));const v=u.width-e.left,y=e.right;if(n==="start")l=e.left,l+t>u.width-a&&(y>=t?l=e.right-t:l=u.width-t-a);else if(n==="end")l=e.right-t,l<a&&(v>=t?l=e.left:l=a);else{const $=e.left+e.width/2-t/2;$>=a&&$+t<=u.width-a?l=$:$<a?l=a:l=u.width-t-a}}l=Math.max(a,Math.min(l,u.width-t-a)),d=Math.max(a,Math.min(d,u.height-r-a))}else o==="right"?(l=e.right+s,d=e.top):o==="left"?(l=e.left-t-s,d=e.top):o==="bottom"?d=e.bottom+s:d=e.top-r-s,(o==="top"||o==="bottom")&&(n==="start"?l=e.left:n==="end"?l=e.right-t:l=e.left+e.width/2-t/2);let m,h;return d+r<=e.top?h=window.innerHeight-(d+r):m=d,{x:l,top:m,bottom:h}};function $n(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:o=[]}=t,s=f.useRef(null);return f.useEffect(()=>{if(!r)return;const a=i=>{const u=i.target;s.current?.contains(u)||o.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,o]),s}function Ft(e,t,r=!0){f.useEffect(()=>{if(!r)return;const n=o=>{e.current&&!e.current.contains(o.target)&&t(o)};return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}},[e,t,r])}function Nr(e,{target:t=window,event:r="keydown",enabled:n}={}){const o=f.useRef(e);f.useEffect(()=>{o.current=e},[e]),f.useEffect(()=>{if(!n)return;const s=a=>{const i=a.key,u=o.current[i];u&&u(a)};return t.addEventListener(r,s),()=>{t.removeEventListener(r,s)}},[t,r,n])}const Sn="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",jn={xs:"text-xs px-1 gap-x-0.5 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"},Tn={all:"focus-visible:ring-1",desktop:"lg:focus-visible:ring-1",mobile:"focus-visible:ring-1 lg:focus-ring-0",none:""},Mn={light:"font-light",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},Dn={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"},Pn={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"},On={enabled:"",disabled:"opacity-75",loading:""},Q=f.forwardRef(({color:e="transparent",size:t="mdsm",fontWeight:r="normal",rounded:n="6",state:o="enabled",onClick:s,className:a,children:i,withRipple:u=!0,contrastRipple:l,showFocus:d="desktop",withDisabledDelay:m=!1,type:h="button",...p},b)=>{const[v,y]=f.useState(!1),$=D=>{o==="enabled"&&(m?(y(!0),s&&s(D),setTimeout(()=>y(!1),1e3)):s&&s(D))},{ref:C,ripple:L}=yr(u,e==="contrast"||l),M=Pt(C,b);return c.jsx("button",{ref:M,type:h,disabled:p.disabled?p.disabled:o==="disabled"||o==="loading",onMouseDown:L,onClick:D=>v?null:$(D),className:N(Sn,jn[t],Mn[r],Dn[n],Tn[d],Pn[e],On[o],p.disabled&&"opacity-50",a),...p,children:i})});Q.displayName="Button";const Er=6048e5,Fn=864e5,Gt=Symbol.for("constructDateFrom");function se(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Gt in e?e[Gt](t):e instanceof Date?new e.constructor(t):new Date(t)}function J(e,t){return se(t||e,e)}function rt(e,t,r){const n=J(e,r?.in);if(isNaN(t))return se(e,NaN);if(!t)return n;const o=n.getDate(),s=se(e,n.getTime());s.setMonth(n.getMonth()+t+1,0);const a=s.getDate();return o>=a?s:(n.setFullYear(s.getFullYear(),s.getMonth(),o),n)}let Ln={};function dt(){return Ln}function ze(e,t){const r=dt(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,o=J(e,t?.in),s=o.getDay(),a=(s<n?7:0)+s-n;return o.setDate(o.getDate()-a),o.setHours(0,0,0,0),o}function st(e,t){return ze(e,{...t,weekStartsOn:1})}function $r(e,t){const r=J(e,t?.in),n=r.getFullYear(),o=se(r,0);o.setFullYear(n+1,0,4),o.setHours(0,0,0,0);const s=st(o),a=se(r,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const i=st(a);return r.getTime()>=s.getTime()?n+1:r.getTime()>=i.getTime()?n:n-1}function Qt(e){const t=J(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 at(e,t){const r=J(e,t?.in);return r.setHours(0,0,0,0),r}function Rn(e,t,r){const[n,o]=ft(r?.in,e,t),s=at(n),a=at(o),i=+s-Qt(s),u=+a-Qt(a);return Math.round((i-u)/Fn)}function An(e,t){const r=$r(e,t),n=se(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),st(n)}function xt(e,t,r){const[n,o]=ft(r?.in,e,t);return+at(n)==+at(o)}function Wn(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function _n(e){return!(!Wn(e)&&typeof e!="number"||isNaN(+J(e)))}function Yn(e,t){const r=J(e,t?.in),n=r.getMonth();return r.setFullYear(r.getFullYear(),n+1,0),r.setHours(23,59,59,999),r}function In(e,t){const[r,n]=ft(e,t.start,t.end);return{start:r,end:n}}function zn(e,t){const{start:r,end:n}=In(t?.in,e);let o=+r>+n;const s=o?+r:+n,a=o?n:r;a.setHours(0,0,0,0);let i=1;const u=[];for(;+a<=s;)u.push(se(r,a)),a.setDate(a.getDate()+i),a.setHours(0,0,0,0);return o?u.reverse():u}function Hn(e,t){const r=J(e,t?.in);return r.setDate(1),r.setHours(0,0,0,0),r}function Bn(e,t){const r=J(e,t?.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}const qn={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"}},Vn=(e,t,r)=>{let n;const o=qn[e];return typeof o=="string"?n=o:t===1?n=o.one:n=o.other.replace("{{count}}",t.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function Pe(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"},Kn={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Un={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Gn={date:Pe({formats:Xn,defaultWidth:"full"}),time:Pe({formats:Kn,defaultWidth:"full"}),dateTime:Pe({formats:Un,defaultWidth:"full"})},Qn={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Jn=(e,t,r,n)=>Qn[e];function ce(e){return(t,r)=>{const n=r?.context?String(r.context):"standalone";let o;if(n==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,i=r?.width?String(r.width):a;o=e.formattingValues[i]||e.formattingValues[a]}else{const a=e.defaultWidth,i=r?.width?String(r.width):e.defaultWidth;o=e.values[i]||e.values[a]}const s=e.argumentCallback?e.argumentCallback(t):t;return o[s]}}const Zn={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},eo={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},to={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"]},ro={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"]},no={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"}},oo={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"}},so=(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"},ao={ordinalNumber:so,era:ce({values:Zn,defaultWidth:"wide"}),quarter:ce({values:eo,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ce({values:to,defaultWidth:"wide"}),day:ce({values:ro,defaultWidth:"wide"}),dayPeriod:ce({values:no,defaultWidth:"wide",formattingValues:oo,defaultFormattingWidth:"wide"})};function le(e){return(t,r={})=>{const n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],s=t.match(o);if(!s)return null;const a=s[0],i=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(i)?co(i,m=>m.test(a)):io(i,m=>m.test(a));let l;l=e.valueCallback?e.valueCallback(u):u,l=r.valueCallback?r.valueCallback(l):l;const d=t.slice(a.length);return{value:l,rest:d}}}function io(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function co(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 o=n[0],s=t.match(e.parsePattern);if(!s)return null;let a=e.valueCallback?e.valueCallback(s[0]):s[0];a=r.valueCallback?r.valueCallback(a):a;const i=t.slice(o.length);return{value:a,rest:i}}}const lo=/^(\d+)(th|st|nd|rd)?/i,uo=/\d+/i,fo={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},mo={any:[/^b/i,/^(a|c)/i]},ho={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},bo={any:[/1/i,/2/i,/3/i,/4/i]},po={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},go={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]},vo={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},wo={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]},xo={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},yo={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}},ko={ordinalNumber:Cr({matchPattern:lo,parsePattern:uo,valueCallback:e=>parseInt(e,10)}),era:le({matchPatterns:fo,defaultMatchWidth:"wide",parsePatterns:mo,defaultParseWidth:"any"}),quarter:le({matchPatterns:ho,defaultMatchWidth:"wide",parsePatterns:bo,defaultParseWidth:"any",valueCallback:e=>e+1}),month:le({matchPatterns:po,defaultMatchWidth:"wide",parsePatterns:go,defaultParseWidth:"any"}),day:le({matchPatterns:vo,defaultMatchWidth:"wide",parsePatterns:wo,defaultParseWidth:"any"}),dayPeriod:le({matchPatterns:xo,defaultMatchWidth:"any",parsePatterns:yo,defaultParseWidth:"any"})},Sr={code:"en-US",formatDistance:Vn,formatLong:Gn,formatRelative:Jn,localize:ao,match:ko,options:{weekStartsOn:0,firstWeekContainsDate:1}};function No(e,t){const r=J(e,t?.in);return Rn(r,Bn(r))+1}function Eo(e,t){const r=J(e,t?.in),n=+st(r)-+An(r);return Math.round(n/Er)+1}function jr(e,t){const r=J(e,t?.in),n=r.getFullYear(),o=dt(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,a=se(t?.in||e,0);a.setFullYear(n+1,0,s),a.setHours(0,0,0,0);const i=ze(a,t),u=se(t?.in||e,0);u.setFullYear(n,0,s),u.setHours(0,0,0,0);const l=ze(u,t);return+r>=+i?n+1:+r>=+l?n:n-1}function $o(e,t){const r=dt(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=jr(e,t),s=se(t?.in||e,0);return s.setFullYear(o,0,n),s.setHours(0,0,0,0),ze(s,t)}function Co(e,t){const r=J(e,t?.in),n=+ze(r,t)-+$o(r,t);return Math.round(n/Er)+1}function _(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 _(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):_(r+1,2)},d(e,t){return _(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 _(e.getHours()%12||12,t.length)},H(e,t){return _(e.getHours(),t.length)},m(e,t){return _(e.getMinutes(),t.length)},s(e,t){return _(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),o=Math.trunc(n*Math.pow(10,r-3));return _(o,t.length)}},Te={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Jt={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(),o=n>0?n:1-n;return r.ordinalNumber(o,{unit:"year"})}return be.y(e,t)},Y:function(e,t,r,n){const o=jr(e,n),s=o>0?o:1-o;if(t==="YY"){const a=s%100;return _(a,2)}return t==="Yo"?r.ordinalNumber(s,{unit:"year"}):_(s,t.length)},R:function(e,t){const r=$r(e);return _(r,t.length)},u:function(e,t){const r=e.getFullYear();return _(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 _(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 _(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 _(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 o=Co(e,n);return t==="wo"?r.ordinalNumber(o,{unit:"week"}):_(o,t.length)},I:function(e,t,r){const n=Eo(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):_(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=No(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):_(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 o=e.getDay(),s=(o-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return _(s,2);case"eo":return r.ordinalNumber(s,{unit:"day"});case"eee":return r.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(o,{width:"short",context:"formatting"});case"eeee":default:return r.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const o=e.getDay(),s=(o-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return _(s,t.length);case"co":return r.ordinalNumber(s,{unit:"day"});case"ccc":return r.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(o,{width:"narrow",context:"standalone"});case"cccccc":return r.day(o,{width:"short",context:"standalone"});case"cccc":default:return r.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),o=n===0?7:n;switch(t){case"i":return String(o);case"ii":return _(o,t.length);case"io":return r.ordinalNumber(o,{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 o=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let o;switch(n===12?o=Te.noon:n===0?o=Te.midnight:o=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let o;switch(n>=17?o=Te.evening:n>=12?o=Te.afternoon:n>=4?o=Te.morning:o=Te.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(o,{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"}):_(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):_(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 er(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 er(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"+Zt(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"+Zt(n,":");case"zzzz":default:return"GMT"+ye(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return _(n,t.length)},T:function(e,t,r){return _(+e,t.length)}};function Zt(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=Math.trunc(n/60),s=n%60;return s===0?r+String(o):r+String(o)+t+_(s,2)}function er(e,t){return e%60===0?(e>0?"-":"+")+_(Math.abs(e)/60,2):ye(e,t)}function ye(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=_(Math.trunc(n/60),2),s=_(n%60,2);return r+o+t+s}const tr=(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"})}},Tr=(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"})}},So=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],o=r[2];if(!o)return tr(e,t);let s;switch(n){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",tr(n,t)).replace("{{time}}",Tr(o,t))},jo={p:Tr,P:So},To=/^D+$/,Mo=/^Y+$/,Do=["D","DD","YY","YYYY"];function Po(e){return To.test(e)}function Oo(e){return Mo.test(e)}function Fo(e,t,r){const n=Lo(e,t,r);if(console.warn(n),Do.includes(e))throw new RangeError(n)}function Lo(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 Ro=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ao=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Wo=/^'([^]*?)'?$/,_o=/''/g,Yo=/[a-zA-Z]/;function $e(e,t,r){const n=dt(),o=r?.locale??n.locale??Sr,s=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=J(e,r?.in);if(!_n(i))throw new RangeError("Invalid time value");let u=t.match(Ao).map(d=>{const m=d[0];if(m==="p"||m==="P"){const h=jo[m];return h(d,o.formatLong)}return d}).join("").match(Ro).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const m=d[0];if(m==="'")return{isToken:!1,value:Io(d)};if(Jt[m])return{isToken:!0,value:d};if(m.match(Yo))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:d}});o.localize.preprocessor&&(u=o.localize.preprocessor(i,u));const l={firstWeekContainsDate:s,weekStartsOn:a,locale:o};return u.map(d=>{if(!d.isToken)return d.value;const m=d.value;(!r?.useAdditionalWeekYearTokens&&Oo(m)||!r?.useAdditionalDayOfYearTokens&&Po(m))&&Fo(m,t,String(e));const h=Jt[m[0]];return h(i,m,o.localize,l)}).join("")}function Io(e){const t=e.match(Wo);return t?t[1].replace(_o,"'"):e}function rr(e,t,r){const[n,o]=ft(r?.in,e,t);return n.getFullYear()===o.getFullYear()&&n.getMonth()===o.getMonth()}function yt(e,t,r){return rt(e,-t,r)}const zo={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"}},Ho=(e,t,r)=>{let n;const o=zo[e];return typeof o=="string"?n=o:t===1?n=o.one:n=o.other.replace("{{count}}",t.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"en "+n:"hace "+n:n},Bo={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},qo={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Vo={full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Xo={date:Pe({formats:Bo,defaultWidth:"full"}),time:Pe({formats:qo,defaultWidth:"full"}),dateTime:Pe({formats:Vo,defaultWidth:"full"})},Ko={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"},Uo={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"},Go=(e,t,r,n)=>t.getHours()!==1?Uo[e]:Ko[e],Qo={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},Jo={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},Zo={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"]},es={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"]},ts={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"}},rs={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"}},ns=(e,t)=>Number(e)+"º",os={ordinalNumber:ns,era:ce({values:Qo,defaultWidth:"wide"}),quarter:ce({values:Jo,defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:ce({values:Zo,defaultWidth:"wide"}),day:ce({values:es,defaultWidth:"wide"}),dayPeriod:ce({values:ts,defaultWidth:"wide",formattingValues:rs,defaultFormattingWidth:"wide"})},ss=/^(\d+)(º)?/i,as=/\d+/i,is={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},cs={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]},ls={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},us={any:[/1/i,/2/i,/3/i,/4/i]},ds={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},fs={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]},ms={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},hs={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]},bs={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},ps={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}},gs={ordinalNumber:Cr({matchPattern:ss,parsePattern:as,valueCallback:function(e){return parseInt(e,10)}}),era:le({matchPatterns:is,defaultMatchWidth:"wide",parsePatterns:cs,defaultParseWidth:"any"}),quarter:le({matchPatterns:ls,defaultMatchWidth:"wide",parsePatterns:us,defaultParseWidth:"any",valueCallback:e=>e+1}),month:le({matchPatterns:ds,defaultMatchWidth:"wide",parsePatterns:fs,defaultParseWidth:"any"}),day:le({matchPatterns:ms,defaultMatchWidth:"wide",parsePatterns:hs,defaultParseWidth:"any"}),dayPeriod:le({matchPatterns:bs,defaultMatchWidth:"any",parsePatterns:ps,defaultParseWidth:"any"})},He={code:"es",formatDistance:Ho,formatLong:Xo,formatRelative:Go,localize:os,match:gs,options:{weekStartsOn:1,firstWeekContainsDate:1}},ue=typeof document<"u"?f.useLayoutEffect:()=>{},X=e=>{var t;return(t=e?.ownerDocument)!==null&&t!==void 0?t:document},it=e=>e&&"window"in e&&e.window===e?e:X(e).defaultView||window;function vs(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function ws(e){return vs(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let xs=!1;function mt(){return xs}function nr(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:ws(r)?r=r.host:r=r.parentNode}return!1}const oe=(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 Me(e){return mt()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}class ys{get currentNode(){return this._currentNode}set currentNode(t){if(!nr(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,o=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=o,this._currentSetFor.add(i),n=o=a.host}else n=n.parentNode;const s=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});r.push(s),s.currentNode=o,this._currentSetFor.add(s),this._walkerStack=r}get doc(){return this._doc}firstChild(){let t=this.currentNode,r=this.nextNode();return nr(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 o;if(typeof this.filter=="function"?o=this.filter(t):!((r=this.filter)===null||r===void 0)&&r.acceptNode&&(o=this.filter.acceptNode(t)),o===NodeFilter.FILTER_ACCEPT)return this.currentNode=t,t;let s=this.nextNode();return s&&(this.currentNode=s),s}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 o=this.previousNode();return o&&(this.currentNode=o),o}else return null;return null}const r=t.previousNode();if(r){if(r.shadowRoot){var n;let s;if(typeof this.filter=="function"?s=this.filter(r):!((n=this.filter)===null||n===void 0)&&n.acceptNode&&(s=this.filter.acceptNode(r)),s===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 o=this.previousNode();return o&&(this.currentNode=o),o}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}constructor(t,r,n,o){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=a=>{if(a.nodeType===Node.ELEMENT_NODE){const u=a.shadowRoot;if(u){const l=this._doc.createTreeWalker(u,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(l),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=o??null,this.whatToShow=n??NodeFilter.SHOW_ALL,this._currentNode=r,this._walkerStack.unshift(t.createTreeWalker(r,n,this._acceptNode));const s=r.shadowRoot;if(s){const a=this._doc.createTreeWalker(s,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(a)}}}function ks(e,t,r,n){return mt()?new ys(e,t,r,n):e.createTreeWalker(t,r,n)}function or(e){if(Ns())e.focus({preventScroll:!0});else{let t=Es(e);e.focus(),$s(t)}}let Ze=null;function Ns(){if(Ze==null){Ze=!1;try{document.createElement("div").focus({get preventScroll(){return Ze=!0,!0}})}catch{}}return Ze}function Es(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 $s(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 Lt(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 Rt=he(function(){return Lt(/^Mac/i)}),Cs=he(function(){return Lt(/^iPhone/i)}),Ss=he(function(){return Lt(/^iPad/i)||Rt()&&navigator.maxTouchPoints>1}),js=he(function(){return Cs()||Ss()});he(function(){return Rt()||js()});he(function(){return ht(/AppleWebKit/i)&&!Mr()});const Mr=he(function(){return ht(/Chrome/i)}),Dr=he(function(){return ht(/Android/i)});he(function(){return ht(/Firefox/i)});let ge=new Map,$t=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 o=ge.get(n.target);o||(o=new Set,ge.set(n.target,o),n.target.addEventListener("transitioncancel",r,{once:!0})),o.add(n.propertyName)},r=n=>{if(!e(n)||!n.target)return;let o=ge.get(n.target);if(o&&(o.delete(n.propertyName),o.size===0&&(n.target.removeEventListener("transitioncancel",r),ge.delete(n.target)),ge.size===0)){for(let s of $t)s();$t.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",r)}typeof document<"u"&&(document.readyState!=="loading"?sr():document.addEventListener("DOMContentLoaded",sr));function Ts(){for(const[e]of ge)"isConnected"in e&&!e.isConnected&&ge.delete(e)}function Ms(e){requestAnimationFrame(()=>{Ts(),ge.size===0?e():$t.add(e)})}function Ds(e){return e.pointerType===""&&e.isTrusted?!0:Dr()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}const Ps=typeof Element<"u"&&"checkVisibility"in Element.prototype;function Os(e){const t=it(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:r,visibility:n}=e.style,o=r!=="none"&&n!=="hidden"&&n!=="collapse";if(o){const{getComputedStyle:s}=e.ownerDocument.defaultView;let{display:a,visibility:i}=s(e);o=a!=="none"&&i!=="hidden"&&i!=="collapse"}return o}function Fs(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 At(e,t){return Ps?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&Os(e)&&Fs(e,t)&&(!e.parentElement||At(e.parentElement,e))}const Wt=["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"],Ls=Wt.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Wt.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const Rs=Wt.join(':not([hidden]):not([tabindex="-1"]),');function As(e){return e.matches(Ls)&&At(e)&&!Pr(e)}function Ws(e){return e.matches(Rs)&&At(e)&&!Pr(e)}function Pr(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}let _s=!1,Ke=null,Ys=new Set,_e=new Map,Ce=!1,Ct=!1;function _t(e,t){for(let r of Ys)r(e,t)}function Is(e){return!(e.metaKey||!Rt()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ct(e){Ce=!0,Is(e)&&(Ke="keyboard",_t("keyboard",e))}function ee(e){Ke="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Ce=!0,_t("pointer",e))}function Or(e){Ds(e)&&(Ce=!0,Ke="virtual")}function Fr(e){e.target===window||e.target===document||_s||!e.isTrusted||(!Ce&&!Ct&&(Ke="virtual",_t("virtual",e)),Ce=!1,Ct=!1)}function Lr(){Ce=!1,Ct=!0}function ar(e){if(typeof window>"u"||typeof document>"u"||_e.get(it(e)))return;const t=it(e),r=X(e);let n=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Ce=!0,n.apply(this,arguments)},r.addEventListener("keydown",ct,!0),r.addEventListener("keyup",ct,!0),r.addEventListener("click",Or,!0),t.addEventListener("focus",Fr,!0),t.addEventListener("blur",Lr,!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",()=>{Rr(e)},{once:!0}),_e.set(t,{focus:n})}const Rr=(e,t)=>{const r=it(e),n=X(e);t&&n.removeEventListener("DOMContentLoaded",t),_e.has(r)&&(r.HTMLElement.prototype.focus=_e.get(r).focus,n.removeEventListener("keydown",ct,!0),n.removeEventListener("keyup",ct,!0),n.removeEventListener("click",Or,!0),r.removeEventListener("focus",Fr,!0),r.removeEventListener("blur",Lr,!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 zs(e){const t=X(e);let r;return t.readyState!=="loading"?ar(e):(r=()=>{ar(e)},t.addEventListener("DOMContentLoaded",r)),()=>Rr(e,r)}typeof document<"u"&&zs();function Ar(){return Ke}function Hs(e){const t=X(e),r=oe(t);if(Ar()==="virtual"){let n=r;Ms(()=>{oe(t)===n&&e.isConnected&&or(e)})}else or(e)}const ir=f.createContext(null),St="react-aria-focus-scope-restore";let z=null;function Bs(e){let{children:t,contain:r,restoreFocus:n,autoFocus:o}=e,s=f.useRef(null),a=f.useRef(null),i=f.useRef([]),{parentNode:u}=f.useContext(ir)||{},l=f.useMemo(()=>new Tt({scopeRef:i}),[i]);ue(()=>{let h=u||B.root;if(B.getTreeNode(h.scopeRef)&&z&&!lt(z,h.scopeRef)){let p=B.getTreeNode(z);p&&(h=p)}h.addChild(l),B.addNode(l)},[l,u]),ue(()=>{let h=B.getTreeNode(i);h&&(h.contain=!!r)},[r]),ue(()=>{var h;let p=(h=s.current)===null||h===void 0?void 0:h.nextSibling,b=[],v=y=>y.stopPropagation();for(;p&&p!==a.current;)b.push(p),p.addEventListener(St,v),p=p.nextSibling;return i.current=b,()=>{for(let y of b)y.removeEventListener(St,v)}},[t]),Us(i,n,r),Xs(i,r),Gs(i,n,r),Ks(i,o),f.useEffect(()=>{const h=oe(X(i.current?i.current[0]:void 0));let p=null;if(re(h,i.current)){for(let b of B.traverse())b.scopeRef&&re(h,b.scopeRef.current)&&(p=b);p===B.getTreeNode(i)&&(z=p.scopeRef)}},[i]),ue(()=>()=>{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||lt(i,z))&&(!v||B.getTreeNode(v))&&(z=v),B.removeTreeNode(i)},[i]);let d=f.useMemo(()=>qs(i),[]),m=f.useMemo(()=>({focusManager:d,parentNode:l}),[l,d]);return f.createElement(ir.Provider,{value:m},f.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:s}),t,f.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:a}))}function qs(e){return{focusNext(t={}){let r=e.current,{from:n,tabbable:o,wrap:s,accept:a}=t;var i;let u=n||oe(X((i=r[0])!==null&&i!==void 0?i:void 0)),l=r[0].previousElementSibling,d=ke(r),m=ve(d,{tabbable:o,accept:a},r);m.currentNode=re(u,r)?u:l;let h=m.nextNode();return!h&&s&&(m.currentNode=l,h=m.nextNode()),h&&fe(h,!0),h},focusPrevious(t={}){let r=e.current,{from:n,tabbable:o,wrap:s,accept:a}=t;var i;let u=n||oe(X((i=r[0])!==null&&i!==void 0?i:void 0)),l=r[r.length-1].nextElementSibling,d=ke(r),m=ve(d,{tabbable:o,accept:a},r);m.currentNode=re(u,r)?u:l;let h=m.previousNode();return!h&&s&&(m.currentNode=l,h=m.previousNode()),h&&fe(h,!0),h},focusFirst(t={}){let r=e.current,{tabbable:n,accept:o}=t,s=ke(r),a=ve(s,{tabbable:n,accept:o},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:o}=t,s=ke(r),a=ve(s,{tabbable:n,accept:o},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 Vs(e){if(e.checked)return!0;let t=[];if(!e.form)t=[...X(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)].filter(s=>!s.form);else{var r,n;let s=(n=e.form)===null||n===void 0||(r=n.elements)===null||r===void 0?void 0:r.namedItem(e.name);t=[...s??[]]}return t?!t.some(s=>s.checked):!1}function Xs(e,t){let r=f.useRef(void 0),n=f.useRef(void 0);ue(()=>{let o=e.current;if(!t){n.current&&(cancelAnimationFrame(n.current),n.current=void 0);return}const s=X(o?o[0]:void 0);let a=l=>{if(l.key!=="Tab"||l.altKey||l.ctrlKey||l.metaKey||!Ae(e)||l.isComposing)return;let d=oe(s),m=e.current;if(!m||!re(d,m))return;let h=ke(m),p=ve(h,{tabbable:!0},m);if(!d)return;p.currentNode=d;let b=l.shiftKey?p.previousNode():p.nextNode();b||(p.currentNode=l.shiftKey?m[m.length-1].nextElementSibling:m[0].previousElementSibling,b=l.shiftKey?p.previousNode():p.nextNode()),l.preventDefault(),b&&fe(b,!0)},i=l=>{(!z||lt(z,e))&&re(Me(l),e.current)?(z=e,r.current=Me(l)):Ae(e)&&!Ne(Me(l),e)?r.current?r.current.focus():z&&z.current&&jt(z.current):Ae(e)&&(r.current=Me(l))},u=l=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{let d=Ar(),m=(d==="virtual"||d===null)&&Dr()&&Mr(),h=oe(s);if(!m&&h&&Ae(e)&&!Ne(h,e)){z=e;let b=Me(l);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 s.addEventListener("keydown",a,!1),s.addEventListener("focusin",i,!1),o?.forEach(l=>l.addEventListener("focusin",i,!1)),o?.forEach(l=>l.addEventListener("focusout",u,!1)),()=>{s.removeEventListener("keydown",a,!1),s.removeEventListener("focusin",i,!1),o?.forEach(l=>l.removeEventListener("focusin",i,!1)),o?.forEach(l=>l.removeEventListener("focusout",u,!1))}},[e,t]),ue(()=>()=>{n.current&&cancelAnimationFrame(n.current)},[n])}function Wr(e){return Ne(e)}function re(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&&re(e,r.current))return!0;return!1}function lt(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{Hs(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function _r(e,t=!0){let r=e[0].previousElementSibling,n=ke(e),o=ve(n,{tabbable:t},e);o.currentNode=r;let s=o.nextNode();return t&&!s&&(n=ke(e),o=ve(n,{tabbable:!1},e),o.currentNode=r,s=o.nextNode()),s}function jt(e,t=!0){fe(_r(e,t))}function Ks(e,t){const r=f.useRef(t);f.useEffect(()=>{if(r.current){z=e;const n=X(e.current?e.current[0]:void 0);!re(oe(n),z.current)&&e.current&&jt(e.current)}r.current=!1},[e])}function Us(e,t,r){ue(()=>{if(t||r)return;let n=e.current;const o=X(n?n[0]:void 0);let s=a=>{let i=Me(a);re(i,e.current)?z=e:Wr(i)||(z=null)};return o.addEventListener("focusin",s,!1),n?.forEach(a=>a.addEventListener("focusin",s,!1)),()=>{o.removeEventListener("focusin",s,!1),n?.forEach(a=>a.removeEventListener("focusin",s,!1))}},[e,t,r])}function cr(e){let t=B.getTreeNode(z);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Gs(e,t,r){const n=f.useRef(typeof document<"u"?oe(X(e.current?e.current[0]:void 0)):null);ue(()=>{let o=e.current;const s=X(o?o[0]:void 0);if(!t||r)return;let a=()=>{(!z||lt(z,e))&&re(oe(s),e.current)&&(z=e)};return s.addEventListener("focusin",a,!1),o?.forEach(i=>i.addEventListener("focusin",a,!1)),()=>{s.removeEventListener("focusin",a,!1),o?.forEach(i=>i.removeEventListener("focusin",a,!1))}},[e,r]),ue(()=>{const o=X(e.current?e.current[0]:void 0);if(!t)return;let s=a=>{if(a.key!=="Tab"||a.altKey||a.ctrlKey||a.metaKey||!Ae(e)||a.isComposing)return;let i=o.activeElement;if(!Ne(i,e)||!cr(e))return;let u=B.getTreeNode(e);if(!u)return;let l=u.nodeToRestore,d=ve(o.body,{tabbable:!0});d.currentNode=i;let m=a.shiftKey?d.previousNode():d.nextNode();if((!l||!l.isConnected||l===o.body)&&(l=void 0,u.nodeToRestore=void 0),(!m||!Ne(m,e))&&l){d.currentNode=l;do m=a.shiftKey?d.previousNode():d.nextNode();while(Ne(m,e));a.preventDefault(),a.stopPropagation(),m?fe(m,!0):Wr(l)?fe(l,!0):i.blur()}};return r||o.addEventListener("keydown",s,!0),()=>{r||o.removeEventListener("keydown",s,!0)}},[e,t,r]),ue(()=>{const o=X(e.current?e.current[0]:void 0);if(!t)return;let s=B.getTreeNode(e);if(s){var a;return s.nodeToRestore=(a=n.current)!==null&&a!==void 0?a:void 0,()=>{let i=B.getTreeNode(e);if(!i)return;let u=i.nodeToRestore,l=oe(o);if(t&&u&&(l&&Ne(l,e)||l===o.body&&cr(e))){let d=B.clone();requestAnimationFrame(()=>{if(o.activeElement===o.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=_r(m.scopeRef.current,!0);lr(h);return}m=m.parent}}})}}}},[e,t])}function lr(e){e.dispatchEvent(new CustomEvent(St,{bubbles:!0,cancelable:!0}))&&fe(e)}function ve(e,t,r){let n=t?.tabbable?Ws:As,o=e?.nodeType===Node.ELEMENT_NODE?e:null,s=X(o),a=ks(s,e||s,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"&&(!Vs(i)||a.currentNode.tagName==="INPUT"&&a.currentNode.type==="radio"&&a.currentNode.name===i.name)?NodeFilter.FILTER_REJECT:n(i)&&(!r||re(i,r))&&(!t?.accept||t.accept(i))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(a.currentNode=t.from),a}class Yt{get size(){return this.fastMap.size}getTreeNode(t){return this.fastMap.get(t)}addTreeNode(t,r,n){let o=this.fastMap.get(r??null);if(!o)return;let s=new Tt({scopeRef:t});o.addChild(s),s.parent=o,this.fastMap.set(t,s),n&&(s.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 s of this.traverse())s!==r&&r.nodeToRestore&&s.nodeToRestore&&r.scopeRef&&r.scopeRef.current&&re(s.nodeToRestore,r.scopeRef.current)&&(s.nodeToRestore=r.nodeToRestore);let o=r.children;n&&(n.removeChild(r),o.size>0&&o.forEach(s=>n&&n.addChild(s))),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 Yt;var n;for(let o of this.traverse())r.addTreeNode(o.scopeRef,(n=(t=o.parent)===null||t===void 0?void 0:t.scopeRef)!==null&&n!==void 0?n:null,o.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 Yt;const bt=({children:e,node:t})=>br.createPortal(e,t??document.body),Yr=({children:e,customTrigger:t,triggerContent:r,align:n="start",side:o="bottom",offset:s=8,className:a,triggerClassName:i,closeOnEscape:u=!0,closeOnClickAway:l=!0,scrollerId:d,onOpen:m,onClose:h,maxHeight:p="400px",minWidth:b="200px",maxWidth:v="500px"})=>{const{triggerRef:y,triggerProps:$,popoverRef:C,getPopoverPosition:L,open:M,toggle:D,close:x}=Ot({align:n,side:o,offset:s,scrollerId:d,onOpen:()=>{m?.()},onClose:()=>{h?.()}});Nr({Escape:O=>{u&&(O.preventDefault(),x(),y.current?.focus())}},{enabled:M}),Ft(C,O=>{!l||!y.current||!M||!O.target||y.current.contains(O.target)||x()});const k=L();return c.jsxs(c.Fragment,{children:[t?t({triggerRef:y,triggerProps:$,toggle:D,open:M,close:x}):c.jsx("button",{ref:y,...$,onClick:D,className:N("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}),c.jsx(R.AnimatePresence,{children:M&&c.jsx(bt,{children:c.jsx(Bs,{contain:!0,restoreFocus:!0,autoFocus:!0,children:c.jsx(R.motion.div,{initial:{opacity:0,scale:.95,y:o==="bottom"?-10:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:o==="bottom"?-10:10},transition:{type:"spring",duration:.2,bounce:.1},ref:C,style:{position:"fixed",left:k.x,top:k.top,bottom:k.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:N("bg-base-1 dark-theme:bg-base-2","border border-base-4 rounded-6","customscrollbar overflow-auto",a),children:typeof e=="function"?e(D):e})})})})]})},Qs=({title:e,subtitle:t,onClose:r,className:n})=>c.jsx("div",{className:N("p-4 border-b border-base-4",n),children:c.jsxs("div",{className:"flex items-start justify-between",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"font-semibold text-base-12",children:e}),t&&c.jsx("p",{className:"text-sm text-base-11 mt-1",children:t})]}),r&&c.jsx("button",{onClick:r,className:"ml-4 text-base-11 hover:text-base-12 transition-colors",children:"×"})]})}),Js=({children:e,className:t})=>c.jsx("div",{className:N("p-4",t),children:e}),Zs=({children:e,className:t})=>c.jsx("div",{className:N("p-4 border-t border-base-4",t),children:e}),ea=(e,t)=>{const r=new Date(2023,0,1),n=[];for(let o=0;o<7;o++){const s=new Date(r);s.setDate(r.getDate()+o),n.push($e(s,"EEE",{locale:e??Sr}))}return t?[...n.slice(1),n[0]]:n},It=({selectedDate:e,onDateSelect:t,disabledDates:r,disabledDaysOfWeek:n,minDate:o,maxDate:s,locale:a,weekStartsOnMonday:i=!0,className:u=""})=>{const[l,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(x=>new Date(x).toDateString())):new Set,[r]),v=f.useMemo(()=>new Set(n||[]),[n]),y=f.useMemo(()=>{const x=Hn(l),k=Yn(l),O=new Date(x),W=new Date(k);if(i){const E=x.getDay(),g=E===0?6:E-1;O.setDate(x.getDate()-g);const T=k.getDay(),S=T===0?0:7-T;W.setDate(k.getDate()+S)}else O.setDate(x.getDate()-x.getDay()),W.setDate(k.getDate()+(6-k.getDay()));return zn({start:O,end:W})},[l,i]),$=f.useMemo(()=>ea(a??He,i),[a,i]),C=x=>{const k=x.toDateString(),O=x.getDay();return!(b.has(k)||v.has(O)||o&&x<o||s&&x>s)},L=x=>{C(x)&&t&&t(x),h(x)},M=x=>{if(!m)return;let k=new Date(m),O=!0,W,E;switch(x.key){case"ArrowUp":k.setDate(k.getDate()-7);break;case"ArrowDown":k.setDate(k.getDate()+7);break;case"ArrowLeft":k.setDate(k.getDate()-1);break;case"ArrowRight":k.setDate(k.getDate()+1);break;case"Home":W=k.getDay(),k.setDate(k.getDate()-W);break;case"End":E=k.getDay(),k.setDate(k.getDate()+(6-E));break;case"PageUp":k=x.shiftKey?yt(k,12):yt(k,1);break;case"PageDown":k=x.shiftKey?rt(k,12):rt(k,1);break;case"Enter":case" ":C(m)&&t&&t(m);break;default:O=!1}O&&(x.preventDefault(),k.getTime()!==m.getTime()&&(h(k),rr(k,l)||d(k)))},D=x=>{d(k=>x==="prev"?yt(k,1):rt(k,1))};return c.jsxs("div",{ref:p,className:N("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:M,tabIndex:0,role:"grid","aria-label":"Calendar",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx(Q,{onClick:()=>D("prev"),size:"iconSm","aria-label":"Previous month",children:c.jsx(Y.ChevronLeft,{size:16})}),c.jsx("h2",{className:"text-sm font-medium",children:$e(l,"MMMM yyyy")}),c.jsx(Q,{onClick:()=>D("next"),size:"iconSm","aria-label":"Next month",children:c.jsx(Y.ChevronRight,{size:16})})]}),c.jsx("div",{className:"grid grid-cols-7 gap-1 mt-4",role:"row",children:$.map(x=>c.jsx("div",{className:"text-xs flex items-center w-8 justify-center text-base-11",role:"columnheader",children:x},x))}),c.jsx("div",{className:"grid grid-cols-7 gap-1 mt-4",role:"grid",children:y.map((x,k)=>{const O=rr(x,l),W=e?xt(x,e):!1,E=m&&xt(x,m),g=C(x),T=xt(x,new Date);return c.jsx("button",{onClick:()=>L(x),disabled:!g,tabIndex:E?0:-1,role:"gridcell","aria-label":`${x.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}${W?", selected":""}${g?"":", disabled"}`,"aria-selected":W,"aria-disabled":!g,className:N("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":T?"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:$e(x,"d")},k)})})]})},ta=()=>{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 c.jsx("div",{className:"p-8 bg-gray-100 min-h-screen",children:c.jsxs("div",{className:"max-w-md mx-auto",children:[c.jsx("h1",{className:"text-2xl font-bold mb-6 text-gray-800",children:"Calendar Date Picker Demo"}),c.jsx("div",{className:"mb-6",children:c.jsx(It,{selectedDate:e,onDateSelect:t,disabledDates:r,disabledDaysOfWeek:n,minDate:new Date(2025,8,1),maxDate:new Date(2025,11,31)})}),e&&c.jsxs("div",{className:"bg-white p-4 rounded-lg shadow",children:[c.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Selected Date:"}),c.jsx("p",{className:"text-gray-600",children:e.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),c.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["ISO: ",e.toISOString()]})]}),c.jsxs("div",{className:"mt-6 bg-white p-4 rounded-lg shadow",children:[c.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Keyboard Navigation:"}),c.jsxs("div",{className:"text-sm text-gray-600 space-y-1",children:[c.jsxs("p",{children:[c.jsx("strong",{children:"Arrow Keys:"})," Navigate between dates"]}),c.jsxs("p",{children:[c.jsx("strong",{children:"Enter/Space:"})," Select focused date"]}),c.jsxs("p",{children:[c.jsx("strong",{children:"Home/End:"})," Go to start/end of week"]}),c.jsxs("p",{children:[c.jsx("strong",{children:"Page Up/Down:"})," Previous/next month"]}),c.jsxs("p",{children:[c.jsx("strong",{children:"Shift + Page Up/Down:"})," Previous/next year"]})]})]}),c.jsxs("div",{className:"mt-4 bg-white p-4 rounded-lg shadow",children:[c.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Features:"}),c.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[c.jsx("li",{children:"✅ All dates enabled by default"}),c.jsx("li",{children:"✅ Disable specific dates (PostgreSQL ISO strings)"}),c.jsx("li",{children:"✅ Disable entire days of week (e.g., weekends)"}),c.jsx("li",{children:"✅ Min/max date constraints"}),c.jsx("li",{children:"✅ Full keyboard navigation with arrow keys"}),c.jsx("li",{children:"✅ Focus management and accessibility"})]})]})]})})};function ra({customTrigger:e,scrollerId:t}){const[r,n]=f.useState(new Date);return c.jsx(Yr,{className:"p-0",scrollerId:t,customTrigger:({toggle:o,triggerRef:s})=>e?e(o,s):c.jsxs(Q,{ref:s,onClick:o,color:"solid",className:"px-3 mt-1 w-full justify-start",children:[$e(new Date,"PP",{locale:He}),c.jsx("span",{className:"grow"}),c.jsx(Y.CalendarDays,{size:18,className:"text-base-11"})]}),children:o=>c.jsx(It,{selectedDate:r,onDateSelect:s=>{n(s),o()},className:"border-none",disabledDaysOfWeek:[0,6]})})}const na=()=>c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Time"}),c.jsxs(Q,{color:"solid",className:"px-3 mt-1",children:[$e(new Date,"p",{locale:He}),c.jsx("span",{className:"grow"}),c.jsx(Y.Clock,{size:18,className:"text-base-11"})]})]}),oa=()=>c.jsxs("div",{className:"flex items-center gap-x-4",children:[c.jsxs("div",{className:"grow",children:[c.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Date"}),c.jsxs(Q,{color:"solid",className:"px-3 mt-1 w-full justify-start",children:[$e(new Date,"PP",{locale:He}),c.jsx("span",{className:"grow"}),c.jsx(Y.CalendarDays,{size:18,className:"text-base-11"})]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Time"}),c.jsxs(Q,{color:"solid",className:"px-3 mt-1",children:[$e(new Date,"p",{locale:He}),c.jsx("span",{className:"grow"}),c.jsx(Y.Clock,{size:18,className:"text-base-11"})]})]})]}),et={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"},Ir=f.forwardRef(({checked:e=!1,onCheckedChange:t,disabled:r=!1,required:n=!1,name:o,value:s,id:a,className:i="",size:u="sm",...l},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 c.jsxs(c.Fragment,{children:[c.jsxs("button",{ref:d,type:"button",role:"checkbox","aria-checked":e==="indeterminate"?"mixed":e,"aria-required":n,disabled:r,onClick:m,onKeyDown:h,className:N("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?et.checkedDisabled:et.checked:r?et.uncheckedDisabled:et.unchecked,typeof i=="function"?i(e):i),...l,children:[e===!0&&c.jsx(Y.Check,{size:b[u],className:"stroke-current"}),e==="indeterminate"&&c.jsx(Y.Minus,{size:b[u],className:"stroke-current"})]}),c.jsx("input",{type:"checkbox",name:o,value:s,checked:e===!0,onChange:()=>{},disabled:r,required:n,id:a,className:"sr-only",tabIndex:-1})]})});Ir.displayName="Checkbox";const sa=({scrollY:e,height:t=300,className:r,children:n})=>{const o=R.useTransform(e,a=>a<0?1+Math.abs(a)/t:1),s=R.useTransform(e,a=>a<0?-Math.abs(a)/2:0);return c.jsx(R.motion.div,{style:{scale:o,y:s,height:t},className:r,children:n})};function zr(e,t,r){function n(i,u){var l;Object.defineProperty(i,"_zod",{value:i._zod??{},enumerable:!1}),(l=i._zod).traits??(l.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 o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function a(i){var u;const l=r?.Parent?new s:this;n(l,i),(u=l._zod).deferred??(u.deferred=[]);for(const d of l._zod.deferred)d();return l}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 Hr(e){return ia}function ca(e,t){return typeof t=="bigint"?t.toString():t}const Br=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function tt(e){return typeof e=="string"?e:e?.message}function qr(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=tt(e.inst?._zod.def?.error?.(e))??tt(t?.error?.(e))??tt(r.customError?.(e))??tt(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}const Vr=(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,ca,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},la=zr("$ZodError",Vr),Xr=zr("$ZodError",Vr,{Parent:Error}),ua=e=>(t,r,n,o)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new aa;if(a.issues.length){const i=new(o?.Err??e)(a.issues.map(u=>qr(u,s,Hr())));throw Br(i,o?.callee),i}return a.value},da=ua(Xr),fa=e=>async(t,r,n,o)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const i=new(o?.Err??e)(a.issues.map(u=>qr(u,s,Hr())));throw Br(i,o?.callee),i}return a.value},ma=fa(Xr);function ur(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],o=n.code,s=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:s,type:o};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,l=u&&u[n.code];r[a]=te.appendErrors(a,t,r,o,l?[].concat(l,n.message):n.message)}e.shift()}return r}function ba(e,t){for(var r={};e.length;){var n=e[0],o=n.code,s=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:s,type:o};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,l=u&&u[n.code];r[a]=te.appendErrors(a,t,r,o,l?[].concat(l,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,o,s){try{return Promise.resolve(ur(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(a){return s.shouldUseNativeValidation&&Je.validateFieldsNatively({},s),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(i){return Array.isArray(i?.issues)})(a))return{values:{},errors:Je.toNestErrors(ha(a.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw a}))}catch(a){return Promise.reject(a)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,o,s){try{return Promise.resolve(ur(function(){return Promise.resolve((r.mode==="sync"?da:ma)(e,n,t)).then(function(a){return s.shouldUseNativeValidation&&Je.validateFieldsNatively({},s),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(i){return i instanceof la})(a))return{values:{},errors:Je.toNestErrors(ba(a.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};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:o,className:s}){return c.jsx(te.FormProvider,{...e,children:c.jsx("form",{className:N("mt-4 lg:mt-8 grid grid-cols-1 lg:grid-cols-2 gap-4 lg:gap-8 relative",s),onSubmit:e.handleSubmit((a,i)=>t(a,i),a=>{o&&console.log(a),r?.(a)}),children:n})})}function va(e,t){return te.useForm({resolver:pa(e),defaultValues:t})}const Kr=({children:e,size:t=24,strokeWidth:r=2,viewBox:n="0 0 24 24",className:o,...s})=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:n,className:o,...s,children:e}),wa={solid:"bg-base-3 border border-base-4 drop-shadow-sm dark-theme:drop-shadow-none",outline:"border border-base-6"},xa={brand:"ring-1 ring-brand",solid:"ring-1 ring-base-6"},zt=f.forwardRef(({label:e,description:t,labelPosition:r="default",color:n="solid",focusColor:o="brand",placeholder:s,valid:a,error:i,errorMessage:u,isPrice:l,prefix:d,wrapperClassName:m,containerClassName:h,className:p,type:b="text",value:v,...y},$)=>{const C=f.useRef(null),L=f.useRef(!1),[M,D]=f.useState(!1),[x,k]=f.useState(!1),O=b==="password",W=O&&M?"text":l?"number":b,E=v!==""&&v!==null&&v!==void 0;return f.useEffect(()=>{if(!L.current){L.current=!0;return}C.current&&vr(C.current)},[M,C]),c.jsxs("div",{className:N("relative",m),children:[e&&r==="default"&&c.jsx("label",{className:N("font-medium ml-0.5 text-xs",i&&"text-red-9"),children:e}),c.jsxs("div",{className:N("rounded-6 transition cursor-text relative",wa[n],{"pt-[22px] pb-1.5":r==="floating",[xa[o]]:!i&&x,"bg-red-4 text-red-9":!!i,"ring-1 ring-red-9":!!i&&x},h),children:[e&&r==="floating"&&c.jsx("label",{className:N("absolute transition-all duration-200 pointer-events-none","text-sm top-[18px] font-semibold left-3",{"text-xs top-2.5":x||E||s,"text-red-9":!!i}),children:e}),l&&c.jsx(Y.DollarSign,{size:16,className:N("absolute top-1/2 -translate-y-1/2 left-3",i?"text-red-9":"text-base-11")}),d&&c.jsx("p",{className:"text-sm text-base-11 absolute top-1/2 -translate-y-1/2 left-3",children:d}),c.jsx("input",{ref:g=>{$&&(typeof $=="function"?$(g):$.current=g),C.current=g},type:W,className:N("w-full bg-transparent focus-visible:outline-none","placeholder:text-sm text-sm placeholder:text-base-11",l||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:s,onFocus:()=>k(!0),onBlur:()=>k(!1),...y})]}),a?c.jsx(Y.CheckIcon,{size:20,className:`absolute top-1/2 -translate-y-1/2 text-green-500 ${O?"right-10":"right-3"}`}):null,O&&c.jsx("button",{type:"button",className:N(r==="floating"?"absolute right-3 top-1/2 -translate-y-1/2":"absolute right-3 top-10"),onClick:()=>{D(!M)},children:M?c.jsx(Y.EyeOffIcon,{size:20,className:N(i?"text-red-9":"text-base-11")}):c.jsx(Y.Eye,{size:20,className:N(i?"text-red-9":"text-base-11")})}),u?c.jsx("span",{role:"alert",className:"text-red-9 text-sm mt-1 ml-0.5",children:u}):t?c.jsx("p",{className:"text-xs text-base-11 mt-1 ml-0.5",children:t}):null]})});zt.displayName="Input";const ya=({name:e,customRead:t,customSet:r,withNullSet:n=!0,...o})=>{const{control:s}=te.useFormContext(),a=f.useCallback(u=>t?t(u):u===null?Dt(u):u,[t]),i=f.useCallback(u=>r?n&&u===null?ot(u):r(u):u===null?ot(u):u,[r]);return s?c.jsx(te.Controller,{name:e,control:s,render:({field:u,fieldState:l})=>c.jsx(zt,{value:a(u.value),onChange:d=>u.onChange(i(d.target.value)),error:!!l.error,errorMessage:l.error?.message,ref:u.ref,...o})}):(console.error(`Form control is missing for field: ${e}`),c.jsxs("p",{children:["Form control missing for field: ",e]}))},Ur=f.createContext(null),ka=({children:e,value:t})=>c.jsx(Ur.Provider,{value:t,children:e}),Na=()=>{const e=f.useContext(Ur);if(!e)throw new Error("useAliveScope must be wrapped within AliveScopeProvider");return e},Ea=({children:e})=>{const[t,r]=f.useState({}),n=f.useRef({}),o=f.useRef({}),s=(i,u,l)=>{if(!t[i]){const d=document.createElement("div");return i&&(d.id=i),l&&(d.className=l),r(m=>({...m,[i]:{children:u,element:d}})),n.current[i]=[],o.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 l={...u};return delete l[i],l}),o.current&&o.current[i]&&o.current[i].forEach(u=>u(i))};return c.jsxs(ka,{value:{getPortalElement:s,dropPortalElement:a},children:[e,Object.entries(t).map(([i,{children:u,element:l}])=>c.jsx(Ca,{id:i,onMountCallbacks:n,onDropCallbacks:o,children:u,element:l},i))]})},Gr=f.createContext(null),$a=({children:e,value:t})=>c.jsx(Gr.Provider,{value:t,children:e}),Ca=f.memo(({id:e,onMountCallbacks:t,onDropCallbacks:r,children:n,element:o})=>{const s=(i,u={runOnFirstMount:!1})=>{f.useEffect(()=>{const l=()=>{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&&l(),t.current[e].push(l),()=>{t.current[e]=t.current[e].filter(d=>d!==l)}},[])},a=i=>{f.useEffect(()=>(r.current[e].push(i),()=>{r.current[e]=r.current[e].filter(u=>u!==i)}),[])};return c.jsx($a,{value:{keepAliveId:e,onKeepAliveMount:s,onKeepAliveDrop:a},children:br.createPortal(n,o,e)})}),Sa=()=>{const e=f.useContext(Gr);if(!e)throw new Error("useKeepAlive must be used within KeepAliveProvider");return e},ja=({aliveKey:e,children:t,enabled:r=!0,...n})=>{const o=f.useRef(null),{getPortalElement:s}=Na();return f.useEffect(()=>{const a=s(e,t,n.className);return r&&o.current&&o.current.replaceWith(a),()=>{}},[e,t,r,n]),c.jsx("div",{...n,ref:o,children:t})},Ta=({lightSolid:e=!0,className:t,children:r,...n})=>c.jsx("div",{className:N("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})=>c.jsx("button",{onClick:e,className:N("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}),Qr=({label:e,labelPosition:t="default",options:r,selectedValues:n,onChange:o,idExtractor:s,labelExtractor:a,customSetter:i,valid:u,error:l,placeholder:d="Select options...",maxSelections:m,searchable:h=!1,disabled:p=!1,className:b})=>{const[v,y]=f.useState(""),[$,C]=f.useState(!1),[L,M]=f.useState(-1),D=f.useRef(null),x=f.useRef(null),k=f.useRef([]),{triggerRef:O,triggerProps:W,popoverRef:E,getPopoverPosition:g,open:T,toggle:S,close:F}=Ot({align:"start",side:"top",avoidCollisions:!1,onOpen:()=>{C(!0),h&&D.current&&setTimeout(()=>D.current?.focus(),10)},onClose:()=>{C(!1),y(""),M(-1)}}),I=f.useRef(`multiselect-${Math.random().toString(36).substr(2,9)}`).current,q=f.useRef(`label-${Math.random().toString(36).substr(2,9)}`).current,P=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(j=>r.find(U=>s(U)===j||s(U)===s(j))).filter(Boolean):n,ae=V.length>0,K=h?r.filter(j=>a(j).toLowerCase().includes(v.toLowerCase())):r;f.useEffect(()=>{k.current=k.current.slice(0,K.length)},[K.length]);const ne=j=>i?n.some(A=>A===s(j)||s(A)===s(j)):n.some(A=>s(A)===s(j)),Le=j=>{if(!p)if(ne(j)){let A;if(i){const U=s(j);A=n.filter(xe=>xe!==U&&s(xe)!==U)}else A=n.filter(U=>s(U)!==s(j));o(A),Qe(`Removed ${a(j)}`)}else{if(m&&V.length>=m){Qe(`Maximum of ${m} selections allowed`);return}let A;i?A=[...n,i(j)]:A=[...n,j],o(A),Qe(`Added ${a(j)}`)}},Ue=j=>{if(p)return;let A;if(i){const U=s(j);A=n.filter(xe=>xe!==U&&s(xe)!==U)}else A=n.filter(U=>s(U)!==s(j));o(A),Qe(`Removed ${a(j)}`)},Ge=j=>{if(!p)switch(j.key){case"Enter":j.preventDefault(),T?L>=0&&Le(K[L]):S();break;case"Escape":j.preventDefault(),F();break;case"ArrowDown":if(j.preventDefault(),!T)S();else{const A=L>=K.length-1?0:L+1;M(A),k.current[A]?.scrollIntoView({block:"nearest"})}break;case"ArrowUp":if(j.preventDefault(),T){const A=L<=0?K.length-1:L-1;M(A),k.current[A]?.scrollIntoView({block:"nearest"})}break;case"Backspace":if(h&&v===""&&V.length>0){const A=V[V.length-1];Ue(A)}break}},dn=j=>{y(j.target.value),M(-1)},fn=()=>{p||(h&&D.current&&D.current.focus(),S())},Qe=j=>{console.log(`Accessibility announcement: ${j}`)};Ft(E,j=>{!O.current||!T||!j.target||O.current.contains(j.target)||F()});const gt=g();return c.jsxs("div",{className:N("relative",b),children:[c.jsxs("div",{className:"relative",ref:x,children:[t==="default"&&c.jsx("label",{className:N("top-[18px] font-medium ml-0.5 text-xs",l&&"text-red-9"),children:e}),c.jsxs("div",{ref:O,...W,className:N("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":T||$,"text-red-9":l,"ring-2 ring-red-6":l&&(T||$),"opacity-60 cursor-not-allowed":p}),onClick:fn,role:"combobox","aria-expanded":T,"aria-haspopup":"listbox","aria-owns":w,"aria-labelledby":q,"aria-describedby":l?P:void 0,onKeyDown:Ge,tabIndex:p?-1:0,children:[t==="floating"&&c.jsxs("label",{id:q,htmlFor:I,className:N("absolute transition-all duration-200 pointer-events-none","text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":$||ae,"text-red-9":!!l}),children:[e," ",m&&`(${n.length}/${m})`]}),c.jsxs("div",{className:N("flex flex-wrap gap-2 items-center",{"mt-2.5":t==="floating"}),children:[V.map(j=>c.jsxs("div",{className:N("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":l}),children:[c.jsx("span",{className:"line-clamp-1",children:a(j)}),!p&&c.jsx("button",{type:"button",className:"hover:bg-brand/20 rounded-full p-0.5 transition-colors",onClick:A=>{A.stopPropagation(),Ue(j)},"aria-label":`Remove ${a(j)}`,children:c.jsx(Y.XIcon,{size:12})})]},s(j))),h&&c.jsx("input",{ref:D,id:I,type:"text",className:"flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm",value:v,onChange:dn,onKeyDown:Ge,placeholder:ae?"":d,disabled:p,"aria-autocomplete":"list","aria-controls":w,autoComplete:"off"}),!h&&!ae&&c.jsx("span",{className:"text-secondarytext text-sm flex-grow",children:d})]}),c.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:[u&&c.jsx(Y.CheckIcon,{size:16,className:"text-green-600"}),c.jsx(Y.ChevronDownIcon,{size:16,className:N("transition-transform text-base-11",{"rotate-180":T})})]})]})]}),c.jsx(R.AnimatePresence,{children:T&&c.jsx(bt,{children:c.jsx(R.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:gt.x,top:gt.top,bottom:gt.bottom,width:x.current?.offsetWidth??200},className:N("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":q,children:K.length===0?c.jsx("div",{className:"px-3 py-2 text-sm text-secondarytext",children:v?"No results found":"No options available"}):K.map((j,A)=>{const U=ne(j),xe=A===L;return c.jsxs("div",{ref:mn=>{k.current[A]=mn},className:N("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":U}),onClick:()=>Le(j),role:"option","aria-selected":U,onMouseEnter:()=>M(A),children:[c.jsx("span",{children:a(j)}),U&&c.jsx(Y.CheckIcon,{size:16})]},s(j))})})})}),l&&c.jsx("p",{id:P,className:"text-red-9 text-xs mt-1","aria-live":"assertive",children:l}),c.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}=te.useFormContext();return r?c.jsx(te.Controller,{name:e,control:r,render:({field:n,fieldState:o})=>c.jsx(Qr,{selectedValues:n.value||[],onChange:s=>n.onChange(s),error:o.error?.message,...t})}):(console.error(`Form control is missing for field: ${e}`),c.jsxs("p",{children:["Form control missing for field: ",e]}))},Pa={2:"text-2xl",4:"text-4xl",5:"text-5xl",6:"text-6xl"},Oa=({title:e,description:t,size:r="6",descriptionClassName:n,className:o})=>c.jsxs("div",{className:N("text-center",o),children:[c.jsx("p",{className:`${Pa[r]} font-medium`,children:e}),t?c.jsx("p",{className:N("mt-6 text-base-11",n),children:t}):null]}),Fa=({id:e,tabPage:t,absolute:r=!0,navBar:n,children:o,onRefresh:s,style:a,className:i,contentClassName:u,bounceBackDuration:l=300,showScrollbar:d=!0,onScroll:m})=>{const h=f.useRef(null),p=f.useRef(null),b=f.useRef(null),v=f.useRef(null),y=f.useRef(null),[$,C]=f.useState(!1),L=f.useRef(null),M=f.useRef({startY:0,currentY:0,maxScroll:0,lastTimestamp:0,frameCallback:null,isScrolling:!1,pullDistance:0,refreshThreshold:50,isPullingToRefresh:!1}),D=Xe(),x=f.useCallback(Fe(()=>{h.current&&p.current&&(M.current.maxScroll=Math.max(0,p.current.offsetHeight-h.current.offsetHeight))}),[]),k=f.useCallback(P=>{const{maxScroll:w}=M.current;return P>0?Math.pow(P,.8):P<-w?-w-Math.pow(-(P+w),.8):P},[]),O=f.useCallback(()=>{if(!d||!h.current||!v.current)return;const{currentY:P,maxScroll:w}=M.current,H=h.current.offsetHeight,V=Math.max(30,H/(H+w)*H),ae=H-V;let K=-P/w*ae,ne=1;P>0?(K=0,ne=1-P/H,v.current.style.transformOrigin="top"):P<-w?(K=ae,ne=1-Math.abs(P+w)/H,v.current.style.transformOrigin="bottom"):v.current.style.transformOrigin="top",v.current.style.transform=`translate3d(0, ${K}px, 0) scaleY(${ne})`,v.current.style.height=`${V}px`},[d]),W=f.useCallback(P=>{if(M.current.currentY=P,p.current&&(p.current.style.transform=`translate3d(0, ${P}px, 0)`),b.current){const w=Math.max(P-M.current.refreshThreshold,-M.current.refreshThreshold);b.current.style.transform=`translate3d(0, ${w}px, 0)`}m&&m(P),O()},[O]),E=f.useCallback(P=>{const w=M.current;w.frameCallback&&(R.cancelFrame(w.frameCallback),w.frameCallback=null);const H=performance.now(),V=w.currentY,ae=P-V,K=()=>{const ne=performance.now()-H,Le=Math.min(ne/l,1),Ue=1-Math.pow(1-Le,3),Ge=V+ae*Ue;W(Ge),Le>=1&&(w.frameCallback&&(R.cancelFrame(w.frameCallback),w.frameCallback=null),W(P),P===0&&b.current&&(b.current.textContent="Pull to refresh"))};w.frameCallback=R.frame.render(K,!0)},[W,l]),g=f.useCallback(P=>{const w=M.current;w.frameCallback&&(R.cancelFrame(w.frameCallback),w.frameCallback=null);let H=P,V=Date.now();const ae=()=>{const K=Date.now(),ne=K-V;if(V=K,H*=Math.pow(.95,ne/16),w.currentY+=H*ne,w.currentY>0||w.currentY<-w.maxScroll){w.frameCallback&&(R.cancelFrame(w.frameCallback),w.frameCallback=null),E(w.currentY>0?0:-w.maxScroll);return}W(w.currentY),Math.abs(H)<.01&&w.frameCallback&&(R.cancelFrame(w.frameCallback),w.frameCallback=null)};w.frameCallback=R.frame.render(ae,!0)},[W,E]),T=f.useCallback(()=>{if(!d||!v.current)return;y.current!==null&&clearTimeout(y.current),requestAnimationFrame(()=>{v.current&&(v.current.style.opacity="1")});const P=window.requestIdleCallback||(w=>setTimeout(w,1e3));y.current=window.setTimeout(()=>{P(()=>{v.current&&(v.current.style.opacity="0"),y.current=null})},1e3)},[d]),S=f.useCallback(P=>{if(L.current!==null&&Date.now()-L.current<50)return;L.current=Date.now();const w=M.current;w.isScrolling=!0,w.startY=w.currentY,w.lastTimestamp=Date.now(),w.isPullingToRefresh=w.currentY===0,w.pullDistance=0,w.frameCallback&&(R.cancelFrame(w.frameCallback),w.frameCallback=null),T()},[T]),F=f.useCallback(P=>{const w=M.current;if(!w.isScrolling)return;const H=k(w.startY+P.deltaY);w.isPullingToRefresh&&H<w.startY&&(w.isPullingToRefresh=!1),W(H),s&&w.isPullingToRefresh&&!$&&H>0&&(w.pullDistance=H,b.current&&(b.current.textContent=w.pullDistance>w.refreshThreshold?"Release to refresh":"Pull to refresh")),T()},[s,W,$,T,k]),I=f.useCallback(P=>{const w=M.current;w.isScrolling&&(w.isScrolling=!1,s&&w.isPullingToRefresh&&!$&&w.pullDistance>w.refreshThreshold?q():w.currentY>0||w.currentY<-w.maxScroll?E(w.currentY>0?0:-w.maxScroll):g(P.velocityY),w.isPullingToRefresh=!1)},[s,g,E,$]),q=f.useCallback(()=>{C(!0),E(M.current.refreshThreshold),b.current&&(b.current.textContent="Refreshing..."),s&&s().then(()=>{C(!1),E(0)})},[s,E]);return f.useEffect(()=>{if(!h.current)return;const P=pr.createGesture(h.current,{name:"page-scroller-gesture",priority:10,passive:!0,direction:"y",onStart:S,onMove:F,onEnd:I});return P.init(),()=>P.destroy()},[S,F,I]),f.useEffect(()=>{if(h.current)return x(),O(),window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x),y.current!==null&&clearTimeout(y.current)}},[x,O]),c.jsxs(R.motion.div,{id:e,ref:h,initial:{x:t||D?0:window.innerWidth,y:D?20:void 0,opacity:D&&!t?0:1},animate:{x:D||t?void 0:0,y:D?0:void 0,opacity:1,transition:{ease:[.32,.72,0,1],duration:D?.34:.44,delay:.2}},exit:{x:D||t?void 0:window.innerWidth+80,y:D?20:0,opacity:D?0:1,transition:{duration:D?.34:.6,ease:[.32,.72,0,1]}},style:{overflow:"hidden",position:r?"absolute":"relative",...a},className:N("top-0 right-0 h-full w-full bg-base-1 isolate will-change-transform",i),children:[s&&c.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"}),c.jsx("div",{ref:p,style:{position:"absolute",top:0,left:0,width:"100%",willChange:"transform"},className:u,children:o}),n,d&&c.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 La({id:e,showScrollbar:t=!0,onRefresh:r,bounceBackDuration:n=300,isolate:o=!1,onScroll:s}){const a=f.useRef(null),i=f.useRef(null),u=f.useRef(null),l=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(Fe(()=>{a.current&&i.current&&(b.current.maxScroll=Math.max(0,i.current.offsetHeight-a.current.offsetHeight))}),[]),y=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||!l.current)return;const{currentY:E,maxScroll:g}=b.current,T=a.current.offsetHeight,S=Math.max(30,T/(T+g)*T),F=T-S;let I=-E/g*F,q=1;E>0?(I=0,q=1-E/T,l.current.style.transformOrigin="top"):E<-g?(I=F,q=1-Math.abs(E+g)/T,l.current.style.transformOrigin="bottom"):l.current.style.transformOrigin="top",l.current.style.transform=`translate3d(0, ${I}px, 0) scaleY(${q})`,l.current.style.height=`${S}px`},[t]),C=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)`}s&&s(E),$()},[$]),L=f.useCallback(E=>{const g=b.current;g.frameCallback&&(R.cancelFrame(g.frameCallback),g.frameCallback=null);const T=performance.now(),S=g.currentY,F=E-S,I=()=>{const q=performance.now()-T,P=Math.min(q/n,1),w=1-Math.pow(1-P,3),H=S+F*w;C(H),P>=1&&(g.frameCallback&&(R.cancelFrame(g.frameCallback),g.frameCallback=null),C(E))};g.frameCallback=R.frame.render(I,!0)},[C,n]),M=f.useCallback(E=>{const g=b.current;g.frameCallback&&(R.cancelFrame(g.frameCallback),g.frameCallback=null);let T=E,S=Date.now();const F=()=>{const I=Date.now(),q=I-S;if(S=I,T*=Math.pow(.95,q/16),g.currentY+=T*q,g.currentY>0||g.currentY<-g.maxScroll){g.frameCallback&&(R.cancelFrame(g.frameCallback),g.frameCallback=null),L(g.currentY>0?0:-g.maxScroll);return}C(g.currentY),Math.abs(T)<.01&&g.frameCallback&&(R.cancelFrame(g.frameCallback),g.frameCallback=null)};g.frameCallback=R.frame.render(F,!0)},[C,L]),D=f.useCallback(()=>{if(!t||!l.current)return;d.current!==null&&clearTimeout(d.current),requestAnimationFrame(()=>{l.current&&(l.current.style.opacity="1")});const E=window.requestIdleCallback||(g=>setTimeout(g,1e3));d.current=window.setTimeout(()=>{E(()=>{l.current&&(l.current.style.opacity="0"),d.current=null})},1e3)},[t]),x=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&&(R.cancelFrame(g.frameCallback),g.frameCallback=null),D()},[D]),k=f.useCallback(E=>{const g=b.current;if(!g.isScrolling)return;const T=y(g.startY+E.deltaY);g.isPullingToRefresh&&T<g.startY&&(g.isPullingToRefresh=!1),C(T),r&&g.isPullingToRefresh&&!m&&T>0&&(g.pullDistance=T),D()},[r,C,m,D,y]),O=f.useCallback(()=>{h(!0),L(b.current.refreshThreshold),r&&r().then(()=>{h(!1),L(0)})},[r,L]),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?L(g.currentY>0?0:-g.maxScroll):M(E.velocityY),g.isPullingToRefresh=!1)},[r,M,L,m,O]);return f.useEffect(()=>{if(!a.current)return;const E=pr.createGesture(a.current,{name:"page-scroller-gesture",priority:10,passive:!0,direction:"y",onStart:x,onMove:k,onEnd:W});return E.init(),()=>E.destroy()},[x,k,W]),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 ${o?"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:l}},refreshing:m,updateMaxScroll:v,rubberBandEffect:y,updateScrollbarPosition:$,setPosition:C}}const Ra=f.forwardRef(({placeholder:e="Buscar",value:t,exposedRef:r,autoFocus:n,onClear:o,onChange:s,className:a,onMount:i,error:u},l)=>{const d=f.useRef(null),m=Xe(),h=Pt(d,l),p=f.useCallback(()=>r&&r(d),[]);return f.useEffect(()=>{const b=async()=>{i&&await i(d,m)};p(),b()},[]),c.jsxs("div",{className:N("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:[c.jsx("input",{ref:h,placeholder:e,value:t,onChange:s,autoComplete:"off",autoCorrect:"off",type:"search",autoFocus:n?n(m):void 0,className:N("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")}),c.jsx(Y.Search,{size:20,className:N("absolute left-3 text-base-11 pointer-events-none",{"text-red-9":u})}),o&&t&&t.length>0?c.jsx("button",{onClick:()=>{o(),d.current?.focus()},className:N("absolute right-2.5 rounded-full",u?"text-red-9":"text-base-11"),children:c.jsx(Y.X,{size:20})}):null]})}),Aa=({text:e,length:t=120,size:r="sm",className:n,buttonClassName:o})=>{const[s,a]=f.useState(!1),i=f.useMemo(()=>e.length>t,[e]),u=f.useMemo(()=>i?s?e:e.slice(0,t).trim()+"...":e,[e,s,i]);return c.jsxs("div",{children:[c.jsx("p",{className:N("text-base-12",r==="sm"&&"text-sm",n),children:u}),i?c.jsx("button",{onClick:()=>a(l=>!l),className:N("text-xs text-base-11",o),children:s?"Ver menos":"Ver más"}):null]})},dr=({el:e,direction:t,amount:r=200,multiplier:n=.4,speed:o="normal"})=>{if(!e)return;const s=t==="up"||t==="down",a=s?e.scrollTop:e.scrollLeft,i=s?e.scrollHeight-e.clientHeight:e.scrollWidth-e.clientWidth;let u;r==="max"?u=i:u=r??(s?e.clientHeight:e.clientWidth)*n;let l;if(t==="right"||t==="down"?l=Math.min(a+u,i):l=Math.max(a-u,0),l===a)return;const d={fast:.15,normal:.4,slow:.8};R.animate(0,1,{duration:d[o],ease:"easeOut",onUpdate:m=>{if(!e)return;const h=a+(l-a)*m;s?e.scrollTop=h:e.scrollLeft=h}})},Wa={default:[.32,.72,0,1]},fr={initial:{opacity:0},animate:{opacity:1,transition:{ease:Wa.default,duration:.3}},exit:{opacity:0,transition:{ease:[.32,.72,0,1],duration:.3}}},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"}}},_a=({options:e,selected:t,onChange:r,keyExtractor:n,labelExtractor:o,itemColor:s,itemClassName:a,color:i="contrast",unselectedColor:u="none",width:l="fit",border:d="solid",rounded:m=6,trackScroll:h=!0,className:p})=>{const[b,v]=f.useState({left:!1,right:!1}),{ref:y}=xr({onOverflow:$=>{v({left:$.canScrollLeft,right:$.canScrollRight})},trackScroll:h});return c.jsxs("div",{className:N("relative overflow-hidden",pe.widths[l].container,pe.rounded[m],p),children:[c.jsx("div",{ref:y,className:N("flex items-center border overflow-x-scroll scrollbar-hide",pe.rounded[m],pe.border[d]),children:e.map($=>{const C=n(t)===n($);return c.jsx("button",{onClick:()=>r?.($),className:N("border-r px-3 py-1 last:border-none text-nowrap shrink-0",pe.widths[l].item,!C&&"lg:hover:bg-overlay-3",s?s(C):C?pe.colors[i]:pe.unselectedColors[u],pe.border[d],a),children:o($)},n($))})}),c.jsxs(R.AnimatePresence,{children:[b.left?c.jsx(R.motion.button,{variants:fr,initial:"initial",animate:"animate",exit:"exit",onClick:()=>{y.current&&dr({el:y.current,direction:"left"})},className:"absolute shrink-0 left-0 px-1 h-full bg-gradient-to-r from-base-2 top-0",children:c.jsx(Y.ChevronLeft,{className:"text-base-13"})},"leftarrow"):null,b.right?c.jsx(R.motion.button,{variants:fr,initial:"initial",animate:"animate",exit:"exit",onClick:()=>{y.current&&dr({el:y.current,direction:"right"})},className:"absolute shrink-0 right-0 px-1 h-full bg-gradient-to-l from-base-2 top-0",children:c.jsx(Y.ChevronRight,{className:"text-base-13"})},"rightarrow"):null]})]})},Ya=({className:e})=>c.jsx("div",{className:N("w-full h-px bg-base-4",e)}),Jr=({loading:e=!0,wrapperClassName:t,spinnerClassName:r})=>c.jsx("div",{className:N("flex justify-center",t),children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",className:N({"animate-spin":e},r),children:c.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"})})}),Ia=({isEditable:e,isDeletable:t=!0,createUpdateLoading:r,deleteLoading:n,onDelete:o,onDeleteConfirm:s,addText:a="Añadir",updateText:i="Actualizar",deleteText:u="Eliminar",className:l})=>{const[d,m]=f.useState(!1);return c.jsxs("div",{className:`w-full grid grid-cols-2 gap-4 col-span-full ${l}`,children:[e&&t?c.jsxs(Q,{color:"dangersolid",state:n?"loading":r?"disabled":"enabled",onClick:()=>{s?d?o?.():m(!0):o?.()},children:[c.jsx(Y.X,{size:18}),s&&d?"Confirmar":u]}):null,c.jsxs(Q,{color:"brand",className:N(e&&t?"":"col-span-2"),state:r?"loading":n?"disabled":"enabled",type:"submit",children:[r?c.jsx(Jr,{}):e?c.jsx(Y.Check,{size:18}):c.jsx(Y.Plus,{size:18}),e?i:a]})]})},Zr=f.createContext(void 0),za=({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]),o=f.useCallback(d=>{r.current=r.current.filter(m=>m!==d),t&&console.log("Modal",d,"removed",r.current)},[t]),s=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)=>{R.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=>{R.animate(d,{y:0,scale:1},{ease:[.32,.72,0,1],duration:.2})},[]),u=f.useCallback(()=>r.current,[]),l={add:n,remove:o,getPrevId:s,animateParentModal:a,restoreParentModal:i,getModals:u};return c.jsx(Zr.Provider,{value:l,children:e})},en=()=>{const e=f.useContext(Zr);if(e===void 0)throw new Error("useModals must be used within a ModalsProvider");return e},Ha=({id:e,prevPath:t,withDelay:r,title:n,description:o,showHeader:s=!0,mode:a,onReplace:i,className:u,contentClassName:l,children:d})=>{const m=Re.useInitialChangeEvent(),h=Xe(),p=f.useRef(null),b=en(),v=f.useMemo(()=>a==="modal"||h,[a,h]);return f.useEffect(()=>{b.add(e);const y=b.getPrevId();if(!y||(p.current=document.getElementById(y),!p.current))return;y&&b.animateParentModal(p.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
|
-
},[h]),f.useLayoutEffect(()=>()=>b.remove(e),[]),c.jsxs(bt,{children:[c.jsx(R.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:()=>{m?Re.navigate.back():Re.navigate.replace(i??t)},className:"bg-black/40 absolute w-full h-full left-0 top-0 z-[500]"}),c.jsxs(R.motion.div,{id:e,initial:{scale:v?.8:void 0,y:v?void 0:window.innerHeight},animate:{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:y=>{(y?.scale===.8||y?.y>50)&&p.current&&b.restoreParentModal(p.current)},className:N("bg-base-1 absolute w-full lg:max-w-[600px] h-full rounded-6 overflow-hidden z-[500] flex flex-col",!v&&"rounded-b-none",u),children:[s&&c.jsxs("div",{className:"flex items-start justify-between p-4 border-b border-base-3",children:[c.jsxs("div",{children:[n&&c.jsx("p",{className:"font-medium text-lg",children:n}),o&&c.jsx("p",{className:"text-base-11 text-xs",children:o})]}),c.jsx(Q,{size:"xs",onClick:()=>{m?Re.navigate.back():Re.navigate.replace(i??t)},children:c.jsx(Y.X,{size:20})})]}),c.jsx("div",{id:`${e}-content`,className:N("grow customscrollbar p-4 pb-6",l),children:d})]})]})};function tn({checked:e,onCheckedChange:t,disabled:r=!1,name:n,required:o,className:s=""}){const a=f.useId(),i=()=>{r||t(!e)};return c.jsxs("button",{id:a,type:"button",role:"switch","aria-checked":e,"aria-required":o,"data-state":e?"checked":"unchecked",disabled:r,onClick:i,className:N(`relative inline-flex h-[28px] w-[48px] items-center rounded-full
|
|
14
|
+
},[h]),f.useLayoutEffect(()=>()=>b.remove(e),[]),c.jsxs(bt,{children:[c.jsx(R.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:()=>{m?Re.navigate.back():Re.navigate.replace(i??t)},className:"bg-black/40 absolute w-full h-full left-0 top-0 z-[500]"}),c.jsxs(R.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:y=>{(y?.scale===.8||y?.y>50)&&p.current&&b.restoreParentModal(p.current)},className:N("bg-base-1 absolute w-full lg:max-w-[600px] h-full rounded-6 overflow-hidden z-[500] flex flex-col",!v&&"rounded-b-none",u),children:[s&&c.jsxs("div",{className:"flex items-start justify-between p-4 border-b border-base-3",children:[c.jsxs("div",{children:[n&&c.jsx("p",{className:"font-medium text-lg",children:n}),o&&c.jsx("p",{className:"text-base-11 text-xs",children:o})]}),c.jsx(Q,{size:"xs",onClick:()=>{m?Re.navigate.back():Re.navigate.replace(i??t)},children:c.jsx(Y.X,{size:20})})]}),c.jsx("div",{id:`${e}-content`,className:N("grow customscrollbar p-4 pb-6",l),children:d})]})]})};function tn({checked:e,onCheckedChange:t,disabled:r=!1,name:n,required:o,className:s=""}){const a=f.useId(),i=()=>{r||t(!e)};return c.jsxs("button",{id:a,type:"button",role:"switch","aria-checked":e,"aria-required":o,"data-state":e?"checked":"unchecked",disabled:r,onClick:i,className:N(`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",s),children:[c.jsx("span",{className:N(`inline-block h-6 w-6 transform rounded-full
|
package/dist/index.js
CHANGED
|
@@ -5435,10 +5435,12 @@ const Ui = Ue(
|
|
|
5435
5435
|
{
|
|
5436
5436
|
id: e,
|
|
5437
5437
|
initial: {
|
|
5438
|
+
opacity: g ? 0 : 1,
|
|
5438
5439
|
scale: g ? 0.8 : void 0,
|
|
5439
5440
|
y: g ? void 0 : window.innerHeight
|
|
5440
5441
|
},
|
|
5441
5442
|
animate: {
|
|
5443
|
+
opacity: 1,
|
|
5442
5444
|
scale: 1,
|
|
5443
5445
|
y: g ? void 0 : 0,
|
|
5444
5446
|
transition: {
|