@mateosuarezdev/react-ui 1.0.39 → 1.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -8,12 +8,12 @@
8
8
  * See LICENSE file for full terms.
9
9
  */
10
10
 
11
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),f=require("react"),hr=require("react-dom"),un=require("clsx"),dn=require("tailwind-merge"),fn=require("@mateosuarezdev/atoms"),_=require("lucide-react"),A=require("framer-motion"),Z=require("react-hook-form"),Ge=require("@hookform/resolvers"),br=require("@mateosuarezdev/gestures"),We=require("@mateosuarezdev/react-router"),N=(...e)=>dn.twMerge(un.clsx(e));function Ae(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 mn(e,t=500){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{e.apply(this,n),r=null},t)}}function pr(e){if(!e)return"";const r=e.trim().replace(/\s+/g," ").split(" ");return r.length===0||r[0]===""?"":r.length===1?r[0].charAt(0).toUpperCase():(r[0].charAt(0)+r[1].charAt(0)).toUpperCase()}function gr(e){e.focus();const t=e.value.length;e.setSelectionRange(t,t)}function vr(e){return e.replace(/\s/g,"")}function hn(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 Ot(e){return e===null?"":e}function tt(e){return vr(e)===""?null:e}function bn(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 pn{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 ze=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=Ae(()=>{if(s.current){const h=ze(s.current);e?.(h)}}),c=ze(s.current);a=c.horizontal||c.vertical,e?.(c),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}},gn=({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 c=Ae(()=>{if(o.current){const p=ze(o.current);a(p)}}),d=ze(o.current);i=d.horizontal||d.vertical,a(d),window.addEventListener("resize",c);let m=null;t&&(m=new ResizeObserver(c),o.current&&m.observe(o.current));let h=null;return e&&i&&(h=o.current,h.addEventListener("scroll",c)),()=>{window.removeEventListener("resize",c),m&&m.disconnect(),h&&i&&h.removeEventListener("scroll",c)}},[r,...n]),{ref:o,overflowInfo:s}},wt={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"},vn=({src:e,name:t,size:r="md",className:n})=>e?l.jsx("img",{alt:"avatar",src:e,className:N("rounded-full bg-base-3",wt[r])}):t?l.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",wt[r],n),children:pr(t)}):l.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",wt[r],n),children:l.jsxs(Xr,{size:r==="xs"?16:r==="sm"?20:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),l.jsx("circle",{cx:"12",cy:"7",r:"4"})]})});function xn({className:e,children:t,animate:r=!1,...n}){return l.jsx("div",{className:N("flex -space-x-3 rtl:space-x-reverse",e),...n,children:t})}function wn(e){return f.useSyncExternalStore(t=>e.subscribe(t),()=>e.get(),()=>e.get())}const $t=fn.atom(typeof window<"u"?window.innerWidth>1024:!0);let yt=!1;const Kt=Ae(()=>{$t.set(window.innerWidth>1024)});typeof window<"u"&&(yt&&(window.removeEventListener("resize",Kt),yt=!1),window.addEventListener("resize",Kt),yt=!0);const Xe=()=>(f.useLayoutEffect(()=>{$t.set(window.innerWidth>1024)},[]),wn($t));function Ft(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}const wr=(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),c=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=`${c}px`,h.style.top=`${d}px`,m.appendChild(h);const p=a.getElementsByClassName("ripple-wrapper");if(p?.length)for(const b of p)b.remove();a.appendChild(m),setTimeout(()=>{m.remove()},700)},[e,r,t]);return{ref:n,ripple:o,styles:{position:"relative"}}},ut=({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[c,d]=f.useState(!1),[m,h]=f.useState({width:192,height:300}),p=f.useRef(null),b=f.useRef(null),x=f.useRef({left:0,right:0,top:0,bottom:0,x:0,y:0,width:0,height:0}),w=f.useRef(null),$=f.useId(),S=f.useCallback(y=>{const E=y??x.current;if(!E)return{x:0,top:0,bottom:void 0};const R=m.width,W=m.height;return yr({triggerRect:E,popoverWidth:R,popoverHeight:W,align:t,side:r,offset:n,collisionPadding:o,avoidCollisions:s})},[x.current,m,t,r]);f.useEffect(()=>{if(!c||!e||(w.current=document.getElementById(e),!w.current))return;c&&O();const y=()=>{w.current&&(d(!1),i?.(),w.current.removeEventListener("scroll",y))};return a&&w.current.addEventListener("scroll",y,{passive:!0}),()=>{w.current&&w.current.removeEventListener("scroll",y)}},[c,e]);const O=()=>{b.current&&h({width:b.current.offsetWidth,height:b.current.offsetHeight})},T=f.useCallback(()=>{if(!p.current)return;const y=p.current.getBoundingClientRect();x.current={left:y.left,right:y.right,top:y.top,bottom:y.bottom,x:y.x,y:y.y,width:y.width,height:y.height},d(E=>(E?u?.():i?.(),!E))},[]),M=f.useCallback(()=>{d(!1),u?.()},[]);return{triggerRef:p,triggerProps:{id:$,"aria-expanded":c,"aria-haspopup":!0},popoverRef:b,getPopoverPosition:S,open:c,toggle:T,close:M}},yr=({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 c=0,d=0;if(i){if(o==="right"){const p=e.right+s,b=e.left-t-s,x=Math.max(0,p+t-(u.width-a)),w=Math.max(0,a-b);x<=w?(c=p,x>0&&(c=u.width-t-a)):(c=b,w>0&&(c=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,x=Math.max(0,a-p),w=Math.max(0,b+t-(u.width-a));x<=w?(c=p,x>0&&(c=a)):(c=b,w>0&&(c=u.width-t-a)),d=e.top,d+r>u.height-a&&(d=u.height-r-a),d<a&&(d=a)}else if(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 x=u.width-e.left,w=e.right;if(n==="start")c=e.left,c+t>u.width-a&&(w>=t?c=e.right-t:c=u.width-t-a);else if(n==="end")c=e.right-t,c<a&&(x>=t?c=e.left:c=a);else{const $=e.left+e.width/2-t/2;$>=a&&$+t<=u.width-a?c=$:$<a?c=a:c=u.width-t-a}}else{const p=e.top,b=u.height-e.bottom;p>=r+s?d=e.top-r-s:b>=r+s?d=e.bottom+s:(d=e.top-r-s,d=Math.max(a,d));const x=u.width-e.left,w=e.right;if(n==="start")c=e.left,c+t>u.width-a&&(w>=t?c=e.right-t:c=u.width-t-a);else if(n==="end")c=e.right-t,c<a&&(x>=t?c=e.left:c=a);else{const $=e.left+e.width/2-t/2;$>=a&&$+t<=u.width-a?c=$:$<a?c=a:c=u.width-t-a}}c=Math.max(a,Math.min(c,u.width-t-a)),d=Math.max(a,Math.min(d,u.height-r-a))}else o==="right"?(c=e.right+s,d=e.top):o==="left"?(c=e.left-t-s,d=e.top):o==="bottom"?d=e.bottom+s:d=e.top-r-s,(o==="top"||o==="bottom")&&(n==="start"?c=e.left:n==="end"?c=e.right-t:c=e.left+e.width/2-t/2);let m,h;return d+r<=e.top?h=window.innerHeight-(d+r):m=d,{x:c,top:m,bottom:h}};function yn(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 kn(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 dt(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 kr(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 Nn="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",En={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"},$n={all:"focus-visible:ring-1",desktop:"lg:focus-visible:ring-1",mobile:"focus-visible:ring-1 lg:focus-ring-0",none:""},Cn={light:"font-light",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},jn={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"},Sn={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"},Tn={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:c,showFocus:d="desktop",withDisabledDelay:m=!1,type:h="button",...p},b)=>{const[x,w]=f.useState(!1),$=M=>{o==="enabled"&&(m?(w(!0),s&&s(M),setTimeout(()=>w(!1),1e3)):s&&s(M))},{ref:S,ripple:O}=wr(u,e==="contrast"||c),T=Ft(S,b);return l.jsx("button",{ref:T,type:h,disabled:p.disabled?p.disabled:o==="disabled"||o==="loading",onMouseDown:O,onClick:M=>x?null:$(M),className:N(Nn,En[t],Cn[r],jn[n],$n[d],Sn[e],Tn[o],p.disabled&&"opacity-50",a),...p,children:i})});Q.displayName="Button";const Nr=6048e5,Mn=864e5,Ut=Symbol.for("constructDateFrom");function se(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Ut in e?e[Ut](t):e instanceof Date?new e.constructor(t):new Date(t)}function ee(e,t){return se(t||e,e)}function et(e,t,r){const n=ee(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 Dn={};function ft(){return Dn}function He(e,t){const r=ft(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,o=ee(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 rt(e,t){return He(e,{...t,weekStartsOn:1})}function Er(e,t){const r=ee(e,t?.in),n=r.getFullYear(),o=se(r,0);o.setFullYear(n+1,0,4),o.setHours(0,0,0,0);const s=rt(o),a=se(r,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const i=rt(a);return r.getTime()>=s.getTime()?n+1:r.getTime()>=i.getTime()?n:n-1}function Gt(e){const t=ee(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 mt(e,...t){const r=se.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}function nt(e,t){const r=ee(e,t?.in);return r.setHours(0,0,0,0),r}function Pn(e,t,r){const[n,o]=mt(r?.in,e,t),s=nt(n),a=nt(o),i=+s-Gt(s),u=+a-Gt(a);return Math.round((i-u)/Mn)}function On(e,t){const r=Er(e,t),n=se(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),rt(n)}function kt(e,t,r){const[n,o]=mt(r?.in,e,t);return+nt(n)==+nt(o)}function Fn(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Rn(e){return!(!Fn(e)&&typeof e!="number"||isNaN(+ee(e)))}function Ln(e,t){const r=ee(e,t?.in),n=r.getMonth();return r.setFullYear(r.getFullYear(),n+1,0),r.setHours(23,59,59,999),r}function An(e,t){const[r,n]=mt(e,t.start,t.end);return{start:r,end:n}}function Wn(e,t){const{start:r,end:n}=An(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 _n(e,t){const r=ee(e,t?.in);return r.setDate(1),r.setHours(0,0,0,0),r}function Yn(e,t){const r=ee(e,t?.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}const In={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"}},zn=(e,t,r)=>{let n;const o=In[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 Oe(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const Hn={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Bn={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},qn={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Vn={date:Oe({formats:Hn,defaultWidth:"full"}),time:Oe({formats:Bn,defaultWidth:"full"}),dateTime:Oe({formats:qn,defaultWidth:"full"})},Xn={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Kn=(e,t,r,n)=>Xn[e];function ie(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 Un={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Gn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Qn={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"]},Jn={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"]},Zn={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"}},eo={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"}},to=(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"},ro={ordinalNumber:to,era:ie({values:Un,defaultWidth:"wide"}),quarter:ie({values:Gn,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ie({values:Qn,defaultWidth:"wide"}),day:ie({values:Jn,defaultWidth:"wide"}),dayPeriod:ie({values:Zn,defaultWidth:"wide",formattingValues:eo,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)?oo(i,m=>m.test(a)):no(i,m=>m.test(a));let c;c=e.valueCallback?e.valueCallback(u):u,c=r.valueCallback?r.valueCallback(c):c;const d=t.slice(a.length);return{value:c,rest:d}}}function no(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function oo(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function $r(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 so=/^(\d+)(th|st|nd|rd)?/i,ao=/\d+/i,io={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},lo={any:[/^b/i,/^(a|c)/i]},co={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},uo={any:[/1/i,/2/i,/3/i,/4/i]},fo={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},mo={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]},ho={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},bo={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]},po={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},go={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}},vo={ordinalNumber:$r({matchPattern:so,parsePattern:ao,valueCallback:e=>parseInt(e,10)}),era:le({matchPatterns:io,defaultMatchWidth:"wide",parsePatterns:lo,defaultParseWidth:"any"}),quarter:le({matchPatterns:co,defaultMatchWidth:"wide",parsePatterns:uo,defaultParseWidth:"any",valueCallback:e=>e+1}),month:le({matchPatterns:fo,defaultMatchWidth:"wide",parsePatterns:mo,defaultParseWidth:"any"}),day:le({matchPatterns:ho,defaultMatchWidth:"wide",parsePatterns:bo,defaultParseWidth:"any"}),dayPeriod:le({matchPatterns:po,defaultMatchWidth:"any",parsePatterns:go,defaultParseWidth:"any"})},Cr={code:"en-US",formatDistance:zn,formatLong:Vn,formatRelative:Kn,localize:ro,match:vo,options:{weekStartsOn:0,firstWeekContainsDate:1}};function xo(e,t){const r=ee(e,t?.in);return Pn(r,Yn(r))+1}function wo(e,t){const r=ee(e,t?.in),n=+rt(r)-+On(r);return Math.round(n/Nr)+1}function jr(e,t){const r=ee(e,t?.in),n=r.getFullYear(),o=ft(),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=He(a,t),u=se(t?.in||e,0);u.setFullYear(n,0,s),u.setHours(0,0,0,0);const c=He(u,t);return+r>=+i?n+1:+r>=+c?n:n-1}function yo(e,t){const r=ft(),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),He(s,t)}function ko(e,t){const r=ee(e,t?.in),n=+He(r,t)-+yo(r,t);return Math.round(n/Nr)+1}function I(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const pe={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return I(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):I(r+1,2)},d(e,t){return I(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return I(e.getHours()%12||12,t.length)},H(e,t){return I(e.getHours(),t.length)},m(e,t){return I(e.getMinutes(),t.length)},s(e,t){return I(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),o=Math.trunc(n*Math.pow(10,r-3));return I(o,t.length)}},De={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Qt={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),o=n>0?n:1-n;return r.ordinalNumber(o,{unit:"year"})}return pe.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 I(a,2)}return t==="Yo"?r.ordinalNumber(s,{unit:"year"}):I(s,t.length)},R:function(e,t){const r=Er(e);return I(r,t.length)},u:function(e,t){const r=e.getFullYear();return I(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return I(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return I(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return pe.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return I(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const o=ko(e,n);return t==="wo"?r.ordinalNumber(o,{unit:"week"}):I(o,t.length)},I:function(e,t,r){const n=wo(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):I(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):pe.d(e,t)},D:function(e,t,r){const n=xo(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):I(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const o=e.getDay(),s=(o-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return I(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 I(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 I(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=De.noon:n===0?o=De.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=De.evening:n>=12?o=De.afternoon:n>=4?o=De.morning:o=De.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 pe.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):pe.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):I(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):I(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):pe.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):pe.s(e,t)},S:function(e,t){return pe.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return Zt(n);case"XXXX":case"XX":return Ne(n);case"XXXXX":case"XXX":default:return Ne(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return Zt(n);case"xxxx":case"xx":return Ne(n);case"xxxxx":case"xxx":default:return Ne(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Jt(n,":");case"OOOO":default:return"GMT"+Ne(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Jt(n,":");case"zzzz":default:return"GMT"+Ne(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return I(n,t.length)},T:function(e,t,r){return I(+e,t.length)}};function Jt(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=Math.trunc(n/60),s=n%60;return s===0?r+String(o):r+String(o)+t+I(s,2)}function Zt(e,t){return e%60===0?(e>0?"-":"+")+I(Math.abs(e)/60,2):Ne(e,t)}function Ne(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=I(Math.trunc(n/60),2),s=I(n%60,2);return r+o+t+s}const er=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Sr=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},No=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],o=r[2];if(!o)return er(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}}",er(n,t)).replace("{{time}}",Sr(o,t))},Eo={p:Sr,P:No},$o=/^D+$/,Co=/^Y+$/,jo=["D","DD","YY","YYYY"];function So(e){return $o.test(e)}function To(e){return Co.test(e)}function Mo(e,t,r){const n=Do(e,t,r);if(console.warn(n),jo.includes(e))throw new RangeError(n)}function Do(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 Po=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Oo=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Fo=/^'([^]*?)'?$/,Ro=/''/g,Lo=/[a-zA-Z]/;function Ce(e,t,r){const n=ft(),o=r?.locale??n.locale??Cr,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=ee(e,r?.in);if(!Rn(i))throw new RangeError("Invalid time value");let u=t.match(Oo).map(d=>{const m=d[0];if(m==="p"||m==="P"){const h=Eo[m];return h(d,o.formatLong)}return d}).join("").match(Po).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const m=d[0];if(m==="'")return{isToken:!1,value:Ao(d)};if(Qt[m])return{isToken:!0,value:d};if(m.match(Lo))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 c={firstWeekContainsDate:s,weekStartsOn:a,locale:o};return u.map(d=>{if(!d.isToken)return d.value;const m=d.value;(!r?.useAdditionalWeekYearTokens&&To(m)||!r?.useAdditionalDayOfYearTokens&&So(m))&&Mo(m,t,String(e));const h=Qt[m[0]];return h(i,m,o.localize,c)}).join("")}function Ao(e){const t=e.match(Fo);return t?t[1].replace(Ro,"'"):e}function tr(e,t,r){const[n,o]=mt(r?.in,e,t);return n.getFullYear()===o.getFullYear()&&n.getMonth()===o.getMonth()}function Nt(e,t,r){return et(e,-t,r)}const Wo={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"}},_o=(e,t,r)=>{let n;const o=Wo[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},Yo={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},Io={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},zo={full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Ho={date:Oe({formats:Yo,defaultWidth:"full"}),time:Oe({formats:Io,defaultWidth:"full"}),dateTime:Oe({formats:zo,defaultWidth:"full"})},Bo={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"},qo={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"},Vo=(e,t,r,n)=>t.getHours()!==1?qo[e]:Bo[e],Xo={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},Ko={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},Uo={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"]},Go={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"]},Qo={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"}},Jo={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"}},Zo=(e,t)=>Number(e)+"º",es={ordinalNumber:Zo,era:ie({values:Xo,defaultWidth:"wide"}),quarter:ie({values:Ko,defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:ie({values:Uo,defaultWidth:"wide"}),day:ie({values:Go,defaultWidth:"wide"}),dayPeriod:ie({values:Qo,defaultWidth:"wide",formattingValues:Jo,defaultFormattingWidth:"wide"})},ts=/^(\d+)(º)?/i,rs=/\d+/i,ns={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},os={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]},ss={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},as={any:[/1/i,/2/i,/3/i,/4/i]},is={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},ls={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]},cs={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},us={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]},ds={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},fs={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}},ms={ordinalNumber:$r({matchPattern:ts,parsePattern:rs,valueCallback:function(e){return parseInt(e,10)}}),era:le({matchPatterns:ns,defaultMatchWidth:"wide",parsePatterns:os,defaultParseWidth:"any"}),quarter:le({matchPatterns:ss,defaultMatchWidth:"wide",parsePatterns:as,defaultParseWidth:"any",valueCallback:e=>e+1}),month:le({matchPatterns:is,defaultMatchWidth:"wide",parsePatterns:ls,defaultParseWidth:"any"}),day:le({matchPatterns:cs,defaultMatchWidth:"wide",parsePatterns:us,defaultParseWidth:"any"}),dayPeriod:le({matchPatterns:ds,defaultMatchWidth:"any",parsePatterns:fs,defaultParseWidth:"any"})},Be={code:"es",formatDistance:_o,formatLong:Ho,formatRelative:Vo,localize:es,match:ms,options:{weekStartsOn:1,firstWeekContainsDate:1}},ce=typeof document<"u"?f.useLayoutEffect:()=>{},G=e=>{var t;return(t=e?.ownerDocument)!==null&&t!==void 0?t:document},ot=e=>e&&"window"in e&&e.window===e?e:G(e).defaultView||window;function hs(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function bs(e){return hs(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let ps=!1;function ht(){return ps}function rr(e,t){if(!ht())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:bs(r)?r=r.host:r=r.parentNode}return!1}const oe=(e=document)=>{var t;if(!ht())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 Pe(e){return ht()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}class gs{get currentNode(){return this._currentNode}set currentNode(t){if(!rr(this.root,t))throw new Error("Cannot set currentNode to a node that is not contained by the root node.");const r=[];let n=t,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 rr(t,r)?(r&&(this.currentNode=r),r):(this.currentNode=t,null)}lastChild(){let r=this._walkerStack[0].lastChild();return r&&(this.currentNode=r),r}nextNode(){const t=this._walkerStack[0].nextNode();if(t){if(t.shadowRoot){var r;let 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 c=this._doc.createTreeWalker(u,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(c),NodeFilter.FILTER_ACCEPT}else{var i;if(typeof this.filter=="function")return this.filter(a);if(!((i=this.filter)===null||i===void 0)&&i.acceptNode)return this.filter.acceptNode(a);if(this.filter===null)return NodeFilter.FILTER_ACCEPT}}return NodeFilter.FILTER_SKIP},this._doc=t,this.root=r,this.filter=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 vs(e,t,r,n){return ht()?new gs(e,t,r,n):e.createTreeWalker(t,r,n)}function nr(e){if(xs())e.focus({preventScroll:!0});else{let t=ws(e);e.focus(),ys(t)}}let Qe=null;function xs(){if(Qe==null){Qe=!1;try{document.createElement("div").focus({get preventScroll(){return Qe=!0,!0}})}catch{}}return Qe}function ws(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 ys(e){for(let{element:t,scrollTop:r,scrollLeft:n}of e)t.scrollTop=r,t.scrollLeft=n}function bt(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 Rt(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function me(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Lt=me(function(){return Rt(/^Mac/i)}),ks=me(function(){return Rt(/^iPhone/i)}),Ns=me(function(){return Rt(/^iPad/i)||Lt()&&navigator.maxTouchPoints>1}),Es=me(function(){return ks()||Ns()});me(function(){return Lt()||Es()});me(function(){return bt(/AppleWebKit/i)&&!Tr()});const Tr=me(function(){return bt(/Chrome/i)}),Mr=me(function(){return bt(/Android/i)});me(function(){return bt(/Firefox/i)});let ve=new Map,Ct=new Set;function or(){if(typeof window>"u")return;function e(n){return"propertyName"in n}let t=n=>{if(!e(n)||!n.target)return;let o=ve.get(n.target);o||(o=new Set,ve.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=ve.get(n.target);if(o&&(o.delete(n.propertyName),o.size===0&&(n.target.removeEventListener("transitioncancel",r),ve.delete(n.target)),ve.size===0)){for(let s of Ct)s();Ct.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",r)}typeof document<"u"&&(document.readyState!=="loading"?or():document.addEventListener("DOMContentLoaded",or));function $s(){for(const[e]of ve)"isConnected"in e&&!e.isConnected&&ve.delete(e)}function Cs(e){requestAnimationFrame(()=>{$s(),ve.size===0?e():Ct.add(e)})}function js(e){return e.pointerType===""&&e.isTrusted?!0:Mr()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}const Ss=typeof Element<"u"&&"checkVisibility"in Element.prototype;function Ts(e){const t=ot(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 Ms(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 Ss?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&Ts(e)&&Ms(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"],Ds=Wt.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Wt.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const Ps=Wt.join(':not([hidden]):not([tabindex="-1"]),');function Os(e){return e.matches(Ds)&&At(e)&&!Dr(e)}function Fs(e){return e.matches(Ps)&&At(e)&&!Dr(e)}function Dr(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}let Rs=!1,Ke=null,Ls=new Set,Ie=new Map,je=!1,jt=!1;function _t(e,t){for(let r of Ls)r(e,t)}function As(e){return!(e.metaKey||!Lt()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function st(e){je=!0,As(e)&&(Ke="keyboard",_t("keyboard",e))}function re(e){Ke="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(je=!0,_t("pointer",e))}function Pr(e){js(e)&&(je=!0,Ke="virtual")}function Or(e){e.target===window||e.target===document||Rs||!e.isTrusted||(!je&&!jt&&(Ke="virtual",_t("virtual",e)),je=!1,jt=!1)}function Fr(){je=!1,jt=!0}function sr(e){if(typeof window>"u"||typeof document>"u"||Ie.get(ot(e)))return;const t=ot(e),r=G(e);let n=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){je=!0,n.apply(this,arguments)},r.addEventListener("keydown",st,!0),r.addEventListener("keyup",st,!0),r.addEventListener("click",Pr,!0),t.addEventListener("focus",Or,!0),t.addEventListener("blur",Fr,!1),typeof PointerEvent<"u"?(r.addEventListener("pointerdown",re,!0),r.addEventListener("pointermove",re,!0),r.addEventListener("pointerup",re,!0)):process.env.NODE_ENV==="test"&&(r.addEventListener("mousedown",re,!0),r.addEventListener("mousemove",re,!0),r.addEventListener("mouseup",re,!0)),t.addEventListener("beforeunload",()=>{Rr(e)},{once:!0}),Ie.set(t,{focus:n})}const Rr=(e,t)=>{const r=ot(e),n=G(e);t&&n.removeEventListener("DOMContentLoaded",t),Ie.has(r)&&(r.HTMLElement.prototype.focus=Ie.get(r).focus,n.removeEventListener("keydown",st,!0),n.removeEventListener("keyup",st,!0),n.removeEventListener("click",Pr,!0),r.removeEventListener("focus",Or,!0),r.removeEventListener("blur",Fr,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",re,!0),n.removeEventListener("pointermove",re,!0),n.removeEventListener("pointerup",re,!0)):process.env.NODE_ENV==="test"&&(n.removeEventListener("mousedown",re,!0),n.removeEventListener("mousemove",re,!0),n.removeEventListener("mouseup",re,!0)),Ie.delete(r))};function Ws(e){const t=G(e);let r;return t.readyState!=="loading"?sr(e):(r=()=>{sr(e)},t.addEventListener("DOMContentLoaded",r)),()=>Rr(e,r)}typeof document<"u"&&Ws();function Lr(){return Ke}function _s(e){const t=G(e),r=oe(t);if(Lr()==="virtual"){let n=r;Cs(()=>{oe(t)===n&&e.isConnected&&nr(e)})}else nr(e)}const ar=f.createContext(null),St="react-aria-focus-scope-restore";let H=null;function Ys(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(ar)||{},c=f.useMemo(()=>new Mt({scopeRef:i}),[i]);ce(()=>{let h=u||K.root;if(K.getTreeNode(h.scopeRef)&&H&&!at(H,h.scopeRef)){let p=K.getTreeNode(H);p&&(h=p)}h.addChild(c),K.addNode(c)},[c,u]),ce(()=>{let h=K.getTreeNode(i);h&&(h.contain=!!r)},[r]),ce(()=>{var h;let p=(h=s.current)===null||h===void 0?void 0:h.nextSibling,b=[],x=w=>w.stopPropagation();for(;p&&p!==a.current;)b.push(p),p.addEventListener(St,x),p=p.nextSibling;return i.current=b,()=>{for(let w of b)w.removeEventListener(St,x)}},[t]),qs(i,n,r),Hs(i,r),Vs(i,n,r),Bs(i,o),f.useEffect(()=>{const h=oe(G(i.current?i.current[0]:void 0));let p=null;if(ne(h,i.current)){for(let b of K.traverse())b.scopeRef&&ne(h,b.scopeRef.current)&&(p=b);p===K.getTreeNode(i)&&(H=p.scopeRef)}},[i]),ce(()=>()=>{var h,p,b;let x=(b=(p=K.getTreeNode(i))===null||p===void 0||(h=p.parent)===null||h===void 0?void 0:h.scopeRef)!==null&&b!==void 0?b:null;(i===H||at(i,H))&&(!x||K.getTreeNode(x))&&(H=x),K.removeTreeNode(i)},[i]);let d=f.useMemo(()=>Is(i),[]),m=f.useMemo(()=>({focusManager:d,parentNode:c}),[c,d]);return f.createElement(ar.Provider,{value:m},f.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:s}),t,f.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:a}))}function Is(e){return{focusNext(t={}){let r=e.current,{from:n,tabbable:o,wrap:s,accept:a}=t;var i;let u=n||oe(G((i=r[0])!==null&&i!==void 0?i:void 0)),c=r[0].previousElementSibling,d=Ee(r),m=xe(d,{tabbable:o,accept:a},r);m.currentNode=ne(u,r)?u:c;let h=m.nextNode();return!h&&s&&(m.currentNode=c,h=m.nextNode()),h&&de(h,!0),h},focusPrevious(t={}){let r=e.current,{from:n,tabbable:o,wrap:s,accept:a}=t;var i;let u=n||oe(G((i=r[0])!==null&&i!==void 0?i:void 0)),c=r[r.length-1].nextElementSibling,d=Ee(r),m=xe(d,{tabbable:o,accept:a},r);m.currentNode=ne(u,r)?u:c;let h=m.previousNode();return!h&&s&&(m.currentNode=c,h=m.previousNode()),h&&de(h,!0),h},focusFirst(t={}){let r=e.current,{tabbable:n,accept:o}=t,s=Ee(r),a=xe(s,{tabbable:n,accept:o},r);a.currentNode=r[0].previousElementSibling;let i=a.nextNode();return i&&de(i,!0),i},focusLast(t={}){let r=e.current,{tabbable:n,accept:o}=t,s=Ee(r),a=xe(s,{tabbable:n,accept:o},r);a.currentNode=r[r.length-1].nextElementSibling;let i=a.previousNode();return i&&de(i,!0),i}}}function Ee(e){return e[0].parentElement}function _e(e){let t=K.getTreeNode(H);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function zs(e){if(e.checked)return!0;let t=[];if(!e.form)t=[...G(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 Hs(e,t){let r=f.useRef(void 0),n=f.useRef(void 0);ce(()=>{let o=e.current;if(!t){n.current&&(cancelAnimationFrame(n.current),n.current=void 0);return}const s=G(o?o[0]:void 0);let a=c=>{if(c.key!=="Tab"||c.altKey||c.ctrlKey||c.metaKey||!_e(e)||c.isComposing)return;let d=oe(s),m=e.current;if(!m||!ne(d,m))return;let h=Ee(m),p=xe(h,{tabbable:!0},m);if(!d)return;p.currentNode=d;let b=c.shiftKey?p.previousNode():p.nextNode();b||(p.currentNode=c.shiftKey?m[m.length-1].nextElementSibling:m[0].previousElementSibling,b=c.shiftKey?p.previousNode():p.nextNode()),c.preventDefault(),b&&de(b,!0)},i=c=>{(!H||at(H,e))&&ne(Pe(c),e.current)?(H=e,r.current=Pe(c)):_e(e)&&!$e(Pe(c),e)?r.current?r.current.focus():H&&H.current&&Tt(H.current):_e(e)&&(r.current=Pe(c))},u=c=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{let d=Lr(),m=(d==="virtual"||d===null)&&Mr()&&Tr(),h=oe(s);if(!m&&h&&_e(e)&&!$e(h,e)){H=e;let b=Pe(c);if(b&&b.isConnected){var p;r.current=b,(p=r.current)===null||p===void 0||p.focus()}else H.current&&Tt(H.current)}})};return s.addEventListener("keydown",a,!1),s.addEventListener("focusin",i,!1),o?.forEach(c=>c.addEventListener("focusin",i,!1)),o?.forEach(c=>c.addEventListener("focusout",u,!1)),()=>{s.removeEventListener("keydown",a,!1),s.removeEventListener("focusin",i,!1),o?.forEach(c=>c.removeEventListener("focusin",i,!1)),o?.forEach(c=>c.removeEventListener("focusout",u,!1))}},[e,t]),ce(()=>()=>{n.current&&cancelAnimationFrame(n.current)},[n])}function Ar(e){return $e(e)}function ne(e,t){return!e||!t?!1:t.some(r=>r.contains(e))}function $e(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:r}of K.traverse(K.getTreeNode(t)))if(r&&ne(e,r.current))return!0;return!1}function at(e,t){var r;let n=(r=K.getTreeNode(t))===null||r===void 0?void 0:r.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function de(e,t=!1){if(e!=null&&!t)try{_s(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function Wr(e,t=!0){let r=e[0].previousElementSibling,n=Ee(e),o=xe(n,{tabbable:t},e);o.currentNode=r;let s=o.nextNode();return t&&!s&&(n=Ee(e),o=xe(n,{tabbable:!1},e),o.currentNode=r,s=o.nextNode()),s}function Tt(e,t=!0){de(Wr(e,t))}function Bs(e,t){const r=f.useRef(t);f.useEffect(()=>{if(r.current){H=e;const n=G(e.current?e.current[0]:void 0);!ne(oe(n),H.current)&&e.current&&Tt(e.current)}r.current=!1},[e])}function qs(e,t,r){ce(()=>{if(t||r)return;let n=e.current;const o=G(n?n[0]:void 0);let s=a=>{let i=Pe(a);ne(i,e.current)?H=e:Ar(i)||(H=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 ir(e){let t=K.getTreeNode(H);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Vs(e,t,r){const n=f.useRef(typeof document<"u"?oe(G(e.current?e.current[0]:void 0)):null);ce(()=>{let o=e.current;const s=G(o?o[0]:void 0);if(!t||r)return;let a=()=>{(!H||at(H,e))&&ne(oe(s),e.current)&&(H=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]),ce(()=>{const o=G(e.current?e.current[0]:void 0);if(!t)return;let s=a=>{if(a.key!=="Tab"||a.altKey||a.ctrlKey||a.metaKey||!_e(e)||a.isComposing)return;let i=o.activeElement;if(!$e(i,e)||!ir(e))return;let u=K.getTreeNode(e);if(!u)return;let c=u.nodeToRestore,d=xe(o.body,{tabbable:!0});d.currentNode=i;let m=a.shiftKey?d.previousNode():d.nextNode();if((!c||!c.isConnected||c===o.body)&&(c=void 0,u.nodeToRestore=void 0),(!m||!$e(m,e))&&c){d.currentNode=c;do m=a.shiftKey?d.previousNode():d.nextNode();while($e(m,e));a.preventDefault(),a.stopPropagation(),m?de(m,!0):Ar(c)?de(c,!0):i.blur()}};return r||o.addEventListener("keydown",s,!0),()=>{r||o.removeEventListener("keydown",s,!0)}},[e,t,r]),ce(()=>{const o=G(e.current?e.current[0]:void 0);if(!t)return;let s=K.getTreeNode(e);if(s){var a;return s.nodeToRestore=(a=n.current)!==null&&a!==void 0?a:void 0,()=>{let i=K.getTreeNode(e);if(!i)return;let u=i.nodeToRestore,c=oe(o);if(t&&u&&(c&&$e(c,e)||c===o.body&&ir(e))){let d=K.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&&K.getTreeNode(m.scopeRef)){let h=Wr(m.scopeRef.current,!0);lr(h);return}m=m.parent}}})}}}},[e,t])}function lr(e){e.dispatchEvent(new CustomEvent(St,{bubbles:!0,cancelable:!0}))&&de(e)}function xe(e,t,r){let n=t?.tabbable?Fs:Os,o=e?.nodeType===Node.ELEMENT_NODE?e:null,s=G(o),a=vs(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"&&(!zs(i)||a.currentNode.tagName==="INPUT"&&a.currentNode.type==="radio"&&a.currentNode.name===i.name)?NodeFilter.FILTER_REJECT:n(i)&&(!r||ne(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 Mt({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&&ne(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 Mt({scopeRef:null}),this.fastMap.set(null,this.root)}}class Mt{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 K=new Yt;const Ue=({children:e,node:t})=>hr.createPortal(e,t??document.body),_r=({children:e,customTrigger:t,triggerContent:r,align:n="start",side:o="bottom",offset:s=8,className:a,triggerClassName:i,closeOnEscape:u=!0,closeOnClickAway:c=!0,scrollerId:d,onOpen:m,onClose:h,maxHeight:p="400px",minWidth:b="200px",maxWidth:x="500px"})=>{const{triggerRef:w,triggerProps:$,popoverRef:S,getPopoverPosition:O,open:T,toggle:M,close:y}=ut({align:n,side:o,offset:s,scrollerId:d,onOpen:()=>{m?.()},onClose:()=>{h?.()}});kr({Escape:R=>{u&&(R.preventDefault(),y(),w.current?.focus())}},{enabled:T}),dt(S,R=>{!c||!w.current||!T||!R.target||w.current.contains(R.target)||y()});const E=O();return l.jsxs(l.Fragment,{children:[t?t({triggerRef:w,triggerProps:$,toggle:M,open:T,close:y}):l.jsx("button",{ref:w,...$,onClick:M,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}),l.jsx(A.AnimatePresence,{children:T&&l.jsx(Ue,{children:l.jsx(Ys,{contain:!0,restoreFocus:!0,autoFocus:!0,children:l.jsx(A.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:S,style:{position:"fixed",left:E.x,top:E.top,bottom:E.bottom,maxHeight:typeof p=="number"?`${p}px`:p,minWidth:typeof b=="number"?`${b}px`:b,maxWidth:typeof x=="number"?`${x}px`:x,zIndex:1e3},className:N("bg-base-1 dark-theme:bg-base-2","border border-base-4 rounded-6","customscrollbar overflow-auto",a),children:typeof e=="function"?e(M):e})})})})]})},Xs=({title:e,subtitle:t,onClose:r,className:n})=>l.jsx("div",{className:N("p-4 border-b border-base-4",n),children:l.jsxs("div",{className:"flex items-start justify-between",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"font-semibold text-base-12",children:e}),t&&l.jsx("p",{className:"text-sm text-base-11 mt-1",children:t})]}),r&&l.jsx("button",{onClick:r,className:"ml-4 text-base-11 hover:text-base-12 transition-colors",children:"×"})]})}),Ks=({children:e,className:t})=>l.jsx("div",{className:N("p-4",t),children:e}),Us=({children:e,className:t})=>l.jsx("div",{className:N("p-4 border-t border-base-4",t),children:e}),Gs=(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(Ce(s,"EEE",{locale:e??Cr}))}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[c,d]=f.useState(e||new Date),[m,h]=f.useState(e||new Date),p=f.useRef(null),b=f.useMemo(()=>r?new Set(r.map(y=>new Date(y).toDateString())):new Set,[r]),x=f.useMemo(()=>new Set(n||[]),[n]),w=f.useMemo(()=>{const y=_n(c),E=Ln(c),R=new Date(y),W=new Date(E);if(i){const C=y.getDay(),g=C===0?6:C-1;R.setDate(y.getDate()-g);const j=E.getDay(),D=j===0?0:7-j;W.setDate(E.getDate()+D)}else R.setDate(y.getDate()-y.getDay()),W.setDate(E.getDate()+(6-E.getDay()));return Wn({start:R,end:W})},[c,i]),$=f.useMemo(()=>Gs(a??Be,i),[a,i]),S=y=>{const E=y.toDateString(),R=y.getDay();return!(b.has(E)||x.has(R)||o&&y<o||s&&y>s)},O=y=>{S(y)&&t&&t(y),h(y)},T=y=>{if(!m)return;let E=new Date(m),R=!0,W,C;switch(y.key){case"ArrowUp":E.setDate(E.getDate()-7);break;case"ArrowDown":E.setDate(E.getDate()+7);break;case"ArrowLeft":E.setDate(E.getDate()-1);break;case"ArrowRight":E.setDate(E.getDate()+1);break;case"Home":W=E.getDay(),E.setDate(E.getDate()-W);break;case"End":C=E.getDay(),E.setDate(E.getDate()+(6-C));break;case"PageUp":E=y.shiftKey?Nt(E,12):Nt(E,1);break;case"PageDown":E=y.shiftKey?et(E,12):et(E,1);break;case"Enter":case" ":S(m)&&t&&t(m);break;default:R=!1}R&&(y.preventDefault(),E.getTime()!==m.getTime()&&(h(E),tr(E,c)||d(E)))},M=y=>{d(E=>y==="prev"?Nt(E,1):et(E,1))};return l.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:T,tabIndex:0,role:"grid","aria-label":"Calendar",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(Q,{onClick:()=>M("prev"),size:"iconSm","aria-label":"Previous month",children:l.jsx(_.ChevronLeft,{size:16})}),l.jsx("h2",{className:"text-sm font-medium",children:Ce(c,"MMMM yyyy")}),l.jsx(Q,{onClick:()=>M("next"),size:"iconSm","aria-label":"Next month",children:l.jsx(_.ChevronRight,{size:16})})]}),l.jsx("div",{className:"grid grid-cols-7 gap-1 mt-4",role:"row",children:$.map(y=>l.jsx("div",{className:"text-xs flex items-center w-8 justify-center text-base-11",role:"columnheader",children:y},y))}),l.jsx("div",{className:"grid grid-cols-7 gap-1 mt-4",role:"grid",children:w.map((y,E)=>{const R=tr(y,c),W=e?kt(y,e):!1,C=m&&kt(y,m),g=S(y),j=kt(y,new Date);return l.jsx("button",{onClick:()=>O(y),disabled:!g,tabIndex:C?0:-1,role:"gridcell","aria-label":`${y.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}${W?", selected":""}${g?"":", disabled"}`,"aria-selected":W,"aria-disabled":!g,className:N("h-8 w-8 flex items-center outline-none justify-center rounded-6 hover:bg-base-4 text-sm relative",R?W?"bg-brand text-brand-text hover:bg-brand":j?"text-base-12 ring-1 ring-base-8":"text-base-12":"text-base-9",C&&"ring-1 ring-base-6",(!g||!R)&&"pointer-events-none text-base-9"),children:Ce(y,"d")},E)})})]})},Qs=()=>{const[e,t]=f.useState(new Date(2025,8,21)),r=["2025-09-13T00:00:00Z","2025-09-15T00:00:00Z"],n=[0,6];return l.jsx("div",{className:"p-8 bg-gray-100 min-h-screen",children:l.jsxs("div",{className:"max-w-md mx-auto",children:[l.jsx("h1",{className:"text-2xl font-bold mb-6 text-gray-800",children:"Calendar Date Picker Demo"}),l.jsx("div",{className:"mb-6",children:l.jsx(It,{selectedDate:e,onDateSelect:t,disabledDates:r,disabledDaysOfWeek:n,minDate:new Date(2025,8,1),maxDate:new Date(2025,11,31)})}),e&&l.jsxs("div",{className:"bg-white p-4 rounded-lg shadow",children:[l.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Selected Date:"}),l.jsx("p",{className:"text-gray-600",children:e.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),l.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["ISO: ",e.toISOString()]})]}),l.jsxs("div",{className:"mt-6 bg-white p-4 rounded-lg shadow",children:[l.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Keyboard Navigation:"}),l.jsxs("div",{className:"text-sm text-gray-600 space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Arrow Keys:"})," Navigate between dates"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Enter/Space:"})," Select focused date"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Home/End:"})," Go to start/end of week"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Page Up/Down:"})," Previous/next month"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Shift + Page Up/Down:"})," Previous/next year"]})]})]}),l.jsxs("div",{className:"mt-4 bg-white p-4 rounded-lg shadow",children:[l.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Features:"}),l.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[l.jsx("li",{children:"✅ All dates enabled by default"}),l.jsx("li",{children:"✅ Disable specific dates (PostgreSQL ISO strings)"}),l.jsx("li",{children:"✅ Disable entire days of week (e.g., weekends)"}),l.jsx("li",{children:"✅ Min/max date constraints"}),l.jsx("li",{children:"✅ Full keyboard navigation with arrow keys"}),l.jsx("li",{children:"✅ Focus management and accessibility"})]})]})]})})};function Js({customTrigger:e,scrollerId:t}){const[r,n]=f.useState(new Date);return l.jsx(_r,{className:"p-0",scrollerId:t,customTrigger:({toggle:o,triggerRef:s})=>e?e(o,s):l.jsxs(Q,{ref:s,onClick:o,color:"solid",className:"px-3 mt-1 w-full justify-start",children:[Ce(new Date,"PP",{locale:Be}),l.jsx("span",{className:"grow"}),l.jsx(_.CalendarDays,{size:18,className:"text-base-11"})]}),children:o=>l.jsx(It,{selectedDate:r,onDateSelect:s=>{n(s),o()},className:"border-none",disabledDaysOfWeek:[0,6]})})}const Zs=()=>l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Time"}),l.jsxs(Q,{color:"solid",className:"px-3 mt-1",children:[Ce(new Date,"p",{locale:Be}),l.jsx("span",{className:"grow"}),l.jsx(_.Clock,{size:18,className:"text-base-11"})]})]}),ea=()=>l.jsxs("div",{className:"flex items-center gap-x-4",children:[l.jsxs("div",{className:"grow",children:[l.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Date"}),l.jsxs(Q,{color:"solid",className:"px-3 mt-1 w-full justify-start",children:[Ce(new Date,"PP",{locale:Be}),l.jsx("span",{className:"grow"}),l.jsx(_.CalendarDays,{size:18,className:"text-base-11"})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Time"}),l.jsxs(Q,{color:"solid",className:"px-3 mt-1",children:[Ce(new Date,"p",{locale:Be}),l.jsx("span",{className:"grow"}),l.jsx(_.Clock,{size:18,className:"text-base-11"})]})]})]}),Je={unchecked:"bg-base-3 lg:hover:bg-base-4",checked:"bg-brand lg:hover:bg-brand-hover text-brand-text",uncheckedDisabled:"bg-base-3 border-base-4",checkedDisabled:"bg-base-3 border-base-4 text-base-10"},Yr=f.forwardRef(({checked:e=!1,onCheckedChange:t,disabled:r=!1,required:n=!1,name:o,value:s,id:a,className:i="",size:u="sm",...c},d)=>{const m=()=>{r||t?.(e==="indeterminate"?!0:!e)},h=x=>{(x.key===" "||x.key==="Enter")&&(x.preventDefault(),m())},p={xs:"h-3.5 w-3.5",sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},b={xs:24,sm:12,md:14,lg:16};return l.jsxs(l.Fragment,{children:[l.jsxs("button",{ref:d,type:"button",role:"checkbox","aria-checked":e==="indeterminate"?"mixed":e,"aria-required":n,disabled:r,onClick:m,onKeyDown:h,className: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?Je.checkedDisabled:Je.checked:r?Je.uncheckedDisabled:Je.unchecked,typeof i=="function"?i(e):i),...c,children:[e===!0&&l.jsx(_.Check,{size:b[u],className:"stroke-current"}),e==="indeterminate"&&l.jsx(_.Minus,{size:b[u],className:"stroke-current"})]}),l.jsx("input",{type:"checkbox",name:o,value:s,checked:e===!0,onChange:()=>{},disabled:r,required:n,id:a,className:"sr-only",tabIndex:-1})]})});Yr.displayName="Checkbox";const ta=({scrollY:e,height:t=300,className:r,children:n})=>{const o=A.useTransform(e,a=>a<0?1+Math.abs(a)/t:1),s=A.useTransform(e,a=>a<0?-Math.abs(a)/2:0);return l.jsx(A.motion.div,{style:{scale:o,y:s,height:t},className:r,children:n})};function Ir(e,t,r){function n(i,u){var c;Object.defineProperty(i,"_zod",{value:i._zod??{},enumerable:!1}),(c=i._zod).traits??(c.traits=new Set),i._zod.traits.add(e),t(i,u);for(const d in a.prototype)d in i||Object.defineProperty(i,d,{value:a.prototype[d].bind(i)});i._zod.constr=a,i._zod.def=u}const o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function a(i){var u;const c=r?.Parent?new s:this;n(c,i),(u=c._zod).deferred??(u.deferred=[]);for(const d of c._zod.deferred)d();return c}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:i=>r?.Parent&&i instanceof r.Parent?!0:i?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class ra extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const na={};function zr(e){return na}function oa(e,t){return typeof t=="bigint"?t.toString():t}const Hr=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Ze(e){return typeof e=="string"?e:e?.message}function Br(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Ze(e.inst?._zod.def?.error?.(e))??Ze(t?.error?.(e))??Ze(r.customError?.(e))??Ze(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}const qr=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,oa,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},sa=Ir("$ZodError",qr),Vr=Ir("$ZodError",qr,{Parent:Error}),aa=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 ra;if(a.issues.length){const i=new(o?.Err??e)(a.issues.map(u=>Br(u,s,zr())));throw Hr(i,o?.callee),i}return a.value},ia=aa(Vr),la=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=>Br(u,s,zr())));throw Hr(i,o?.callee),i}return a.value},ca=la(Vr);function cr(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function ua(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,c=u&&u[n.code];r[a]=Z.appendErrors(a,t,r,o,c?[].concat(c,n.message):n.message)}e.shift()}return r}function da(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,c=u&&u[n.code];r[a]=Z.appendErrors(a,t,r,o,c?[].concat(c,n.message):n.message)}e.shift()}return r}function fa(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(cr(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(a){return s.shouldUseNativeValidation&&Ge.validateFieldsNatively({},s),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(i){return Array.isArray(i?.issues)})(a))return{values:{},errors:Ge.toNestErrors(ua(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(cr(function(){return Promise.resolve((r.mode==="sync"?ia:ca)(e,n,t)).then(function(a){return s.shouldUseNativeValidation&&Ge.validateFieldsNatively({},s),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(i){return i instanceof sa})(a))return{values:{},errors:Ge.toNestErrors(da(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 ma({methods:e,onSubmit:t,onError:r,children:n,logErrors:o,className:s}){return l.jsx(Z.FormProvider,{...e,children:l.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 ha(e,t){return Z.useForm({resolver:fa(e),defaultValues:t})}const Xr=({children:e,size:t=24,strokeWidth:r=2,viewBox:n="0 0 24 24",className:o,...s})=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:n,className:o,...s,children:e}),ba={solid:"bg-base-3 border border-base-4 drop-shadow-sm dark-theme:drop-shadow-none",outline:"border border-base-6"},pa={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:c,prefix:d,wrapperClassName:m,containerClassName:h,className:p,type:b="text",value:x,...w},$)=>{const S=f.useRef(null),O=f.useRef(!1),[T,M]=f.useState(!1),[y,E]=f.useState(!1),R=b==="password",W=R&&T?"text":c?"number":b,C=x!==""&&x!==null&&x!==void 0;return f.useEffect(()=>{if(!O.current){O.current=!0;return}S.current&&gr(S.current)},[T,S]),l.jsxs("div",{className:N("relative",m),children:[e&&r==="default"&&l.jsx("label",{className:N("font-medium ml-0.5 text-xs",i&&"text-red-9"),children:e}),l.jsxs("div",{className:N("rounded-6 transition cursor-text relative",ba[n],{"pt-[22px] pb-1.5":r==="floating",[pa[o]]:!i&&y,"bg-red-4 text-red-9":!!i,"ring-1 ring-red-9":!!i&&y},h),children:[e&&r==="floating"&&l.jsx("label",{className:N("absolute transition-all duration-200 pointer-events-none","text-sm top-[18px] font-semibold left-3",{"text-xs top-2.5":y||C||s,"text-red-9":!!i}),children:e}),c&&l.jsx(_.DollarSign,{size:16,className:N("absolute top-1/2 -translate-y-1/2 left-3",i?"text-red-9":"text-base-11")}),d&&l.jsx("p",{className:"text-sm text-base-11 absolute top-1/2 -translate-y-1/2 left-3",children:d}),l.jsx("input",{ref:g=>{$&&(typeof $=="function"?$(g):$.current=g),S.current=g},type:W,className:N("w-full bg-transparent focus-visible:outline-none","placeholder:text-sm text-sm placeholder:text-base-11",c||d?"pl-9":"pl-3",{"py-2.5":r==="default","mt-1.5":r==="floating","pr-10":a,"text-red-9 placeholder:text-red-9":!!i},p),value:x,placeholder:s,onFocus:()=>E(!0),onBlur:()=>E(!1),...w})]}),a?l.jsx(_.CheckIcon,{size:20,className:`absolute top-1/2 -translate-y-1/2 text-green-500 ${R?"right-10":"right-3"}`}):null,R&&l.jsx("button",{type:"button",className:N(r==="floating"?"absolute right-3 top-1/2 -translate-y-1/2":"absolute right-3 top-10"),onClick:()=>{M(!T)},children:T?l.jsx(_.EyeOffIcon,{size:20,className:N(i?"text-red-9":"text-base-11")}):l.jsx(_.Eye,{size:20,className:N(i?"text-red-9":"text-base-11")})}),u?l.jsx("span",{role:"alert",className:"text-red-9 text-sm mt-1 ml-0.5",children:u}):t?l.jsx("p",{className:"text-xs text-base-11 mt-1 ml-0.5",children:t}):null]})});zt.displayName="Input";const ga=({name:e,customRead:t,customSet:r,withNullSet:n=!0,...o})=>{const{control:s}=Z.useFormContext(),a=f.useCallback(u=>t?t(u):u===null?Ot(u):u,[t]),i=f.useCallback(u=>r?n&&u===null?tt(u):r(u):u===null?tt(u):u,[r]);return s?l.jsx(Z.Controller,{name:e,control:s,render:({field:u,fieldState:c})=>l.jsx(zt,{value:a(u.value),onChange:d=>u.onChange(i(d.target.value)),error:!!c.error,errorMessage:c.error?.message,ref:u.ref,...o})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},Kr=f.createContext(null),va=({children:e,value:t})=>l.jsx(Kr.Provider,{value:t,children:e}),xa=()=>{const e=f.useContext(Kr);if(!e)throw new Error("useAliveScope must be wrapped within AliveScopeProvider");return e},wa=({children:e})=>{const[t,r]=f.useState({}),n=f.useRef({}),o=f.useRef({}),s=(i,u,c)=>{if(!t[i]){const d=document.createElement("div");return i&&(d.id=i),c&&(d.className=c),r(m=>({...m,[i]:{children:u,element:d}})),n.current[i]=[],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 c={...u};return delete c[i],c}),o.current&&o.current[i]&&o.current[i].forEach(u=>u(i))};return l.jsxs(va,{value:{getPortalElement:s,dropPortalElement:a},children:[e,Object.entries(t).map(([i,{children:u,element:c}])=>l.jsx(ka,{id:i,onMountCallbacks:n,onDropCallbacks:o,children:u,element:c},i))]})},Ur=f.createContext(null),ya=({children:e,value:t})=>l.jsx(Ur.Provider,{value:t,children:e}),ka=f.memo(({id:e,onMountCallbacks:t,onDropCallbacks:r,children:n,element:o})=>{const s=(i,u={runOnFirstMount:!1})=>{f.useEffect(()=>{const c=()=>{if(document.getElementById(e))i(e);else{const m=new MutationObserver((h,p)=>{document.getElementById(e)&&(i(e),p.disconnect())});return m.observe(document.body,{childList:!0,subtree:!0}),()=>m.disconnect()}};return u?.runOnFirstMount&&c(),t.current[e].push(c),()=>{t.current[e]=t.current[e].filter(d=>d!==c)}},[])},a=i=>{f.useEffect(()=>(r.current[e].push(i),()=>{r.current[e]=r.current[e].filter(u=>u!==i)}),[])};return l.jsx(ya,{value:{keepAliveId:e,onKeepAliveMount:s,onKeepAliveDrop:a},children:hr.createPortal(n,o,e)})}),Na=()=>{const e=f.useContext(Ur);if(!e)throw new Error("useKeepAlive must be used within KeepAliveProvider");return e},Ea=({aliveKey:e,children:t,enabled:r=!0,...n})=>{const o=f.useRef(null),{getPortalElement:s}=xa();return f.useEffect(()=>{const a=s(e,t,n.className);return r&&o.current&&o.current.replaceWith(a),()=>{}},[e,t,r,n]),l.jsx("div",{...n,ref:o,children:t})},$a=({lightSolid:e=!0,className:t,children:r,...n})=>l.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}),Ca=({onClick:e,lightSolid:t=!0,className:r,children:n})=>l.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}),Gr=({label:e,labelPosition:t="default",options:r,selectedValues:n,onChange:o,idExtractor:s,labelExtractor:a,customSetter:i,valid:u,error:c,placeholder:d="Select options...",maxSelections:m,searchable:h=!1,disabled:p=!1,className:b})=>{const[x,w]=f.useState(""),[$,S]=f.useState(!1),[O,T]=f.useState(-1),M=f.useRef(null),y=f.useRef(null),E=f.useRef([]),{triggerRef:R,triggerProps:W,popoverRef:C,getPopoverPosition:g,open:j,toggle:D,close:L}=ut({align:"start",side:"top",avoidCollisions:!1,onOpen:()=>{S(!0),h&&M.current&&setTimeout(()=>M.current?.focus(),10)},onClose:()=>{S(!1),w(""),T(-1)}}),Y=f.useRef(`multiselect-${Math.random().toString(36).substr(2,9)}`).current,q=f.useRef(`label-${Math.random().toString(36).substr(2,9)}`).current,F=f.useRef(`error-${Math.random().toString(36).substr(2,9)}`).current,v=f.useRef(`listbox-${Math.random().toString(36).substr(2,9)}`).current,z=i?n.map(k=>r.find(X=>s(X)===k||s(X)===s(k))).filter(Boolean):n,U=z.length>0,B=h?r.filter(k=>a(k).toLowerCase().includes(x.toLowerCase())):r;f.useEffect(()=>{E.current=E.current.slice(0,B.length)},[B.length]);const te=k=>i?n.some(P=>P===s(k)||s(P)===s(k)):n.some(P=>s(P)===s(k)),he=k=>{if(!p)if(te(k)){let P;if(i){const X=s(k);P=n.filter(ue=>ue!==X&&s(ue)!==X)}else P=n.filter(X=>s(X)!==s(k));o(P),be(`Removed ${a(k)}`)}else{if(m&&z.length>=m){be(`Maximum of ${m} selections allowed`);return}let P;i?P=[...n,i(k)]:P=[...n,k],o(P),be(`Added ${a(k)}`)}},Me=k=>{if(p)return;let P;if(i){const X=s(k);P=n.filter(ue=>ue!==X&&s(ue)!==X)}else P=n.filter(X=>s(X)!==s(k));o(P),be(`Removed ${a(k)}`)},ye=k=>{if(!p)switch(k.key){case"Enter":k.preventDefault(),j?O>=0&&he(B[O]):D();break;case"Escape":k.preventDefault(),L();break;case"ArrowDown":if(k.preventDefault(),!j)D();else{const P=O>=B.length-1?0:O+1;T(P),E.current[P]?.scrollIntoView({block:"nearest"})}break;case"ArrowUp":if(k.preventDefault(),j){const P=O<=0?B.length-1:O-1;T(P),E.current[P]?.scrollIntoView({block:"nearest"})}break;case"Backspace":if(h&&x===""&&z.length>0){const P=z[z.length-1];Me(P)}break}},gt=k=>{w(k.target.value),T(-1)},vt=()=>{p||(h&&M.current&&M.current.focus(),D())},be=k=>{console.log(`Accessibility announcement: ${k}`)};dt(C,k=>{!R.current||!j||!k.target||R.current.contains(k.target)||L()});const ke=g();return l.jsxs("div",{className:N("relative",b),children:[l.jsxs("div",{className:"relative",ref:y,children:[t==="default"&&l.jsx("label",{className:N("top-[18px] font-medium ml-0.5 text-xs",c&&"text-red-9"),children:e}),l.jsxs("div",{ref:R,...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":j||$,"text-red-9":c,"ring-2 ring-red-6":c&&(j||$),"opacity-60 cursor-not-allowed":p}),onClick:vt,role:"combobox","aria-expanded":j,"aria-haspopup":"listbox","aria-owns":v,"aria-labelledby":q,"aria-describedby":c?F:void 0,onKeyDown:ye,tabIndex:p?-1:0,children:[t==="floating"&&l.jsxs("label",{id:q,htmlFor:Y,className:N("absolute transition-all duration-200 pointer-events-none","text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":$||U,"text-red-9":!!c}),children:[e," ",m&&`(${n.length}/${m})`]}),l.jsxs("div",{className:N("flex flex-wrap gap-2 items-center",{"mt-2.5":t==="floating"}),children:[z.map(k=>l.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":c}),children:[l.jsx("span",{className:"line-clamp-1",children:a(k)}),!p&&l.jsx("button",{type:"button",className:"hover:bg-brand/20 rounded-full p-0.5 transition-colors",onClick:P=>{P.stopPropagation(),Me(k)},"aria-label":`Remove ${a(k)}`,children:l.jsx(_.XIcon,{size:12})})]},s(k))),h&&l.jsx("input",{ref:M,id:Y,type:"text",className:"flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm",value:x,onChange:gt,onKeyDown:ye,placeholder:U?"":d,disabled:p,"aria-autocomplete":"list","aria-controls":v,autoComplete:"off"}),!h&&!U&&l.jsx("span",{className:"text-secondarytext text-sm flex-grow",children:d})]}),l.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:[u&&l.jsx(_.CheckIcon,{size:16,className:"text-green-600"}),l.jsx(_.ChevronDownIcon,{size:16,className:N("transition-transform text-base-11",{"rotate-180":j})})]})]})]}),l.jsx(A.AnimatePresence,{children:j&&l.jsx(Ue,{children:l.jsx(A.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},ref:C,style:{position:"fixed",left:ke.x,top:ke.top,bottom:ke.bottom,width:y.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:v,"aria-labelledby":q,children:B.length===0?l.jsx("div",{className:"px-3 py-2 text-sm text-secondarytext",children:x?"No results found":"No options available"}):B.map((k,P)=>{const X=te(k),ue=P===O;return l.jsxs("div",{ref:xt=>{E.current[P]=xt},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":ue,"bg-brandfadedbg text-brand":X}),onClick:()=>he(k),role:"option","aria-selected":X,onMouseEnter:()=>T(P),children:[l.jsx("span",{children:a(k)}),X&&l.jsx(_.CheckIcon,{size:16})]},s(k))})})})}),c&&l.jsx("p",{id:F,className:"text-red-9 text-xs mt-1","aria-live":"assertive",children:c}),l.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:z.length>0?`Selected: ${z.map(a).join(", ")}`:"No selections"})]})},ja=({name:e,...t})=>{const{control:r}=Z.useFormContext();return r?l.jsx(Z.Controller,{name:e,control:r,render:({field:n,fieldState:o})=>l.jsx(Gr,{selectedValues:n.value||[],onChange:s=>n.onChange(s),error:o.error?.message,...t})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},Sa={2:"text-2xl",4:"text-4xl",5:"text-5xl",6:"text-6xl"},Ta=({title:e,description:t,size:r="6",descriptionClassName:n,className:o})=>l.jsxs("div",{className:N("text-center",o),children:[l.jsx("p",{className:`${Sa[r]} font-medium`,children:e}),t?l.jsx("p",{className:N("mt-6 text-base-11",n),children:t}):null]}),Ma=({id:e,tabPage:t,absolute:r=!0,navBar:n,children:o,onRefresh:s,style:a,className:i,contentClassName:u,bounceBackDuration:c=300,showScrollbar:d=!0,onScroll:m})=>{const h=f.useRef(null),p=f.useRef(null),b=f.useRef(null),x=f.useRef(null),w=f.useRef(null),[$,S]=f.useState(!1),O=f.useRef(null),T=f.useRef({startY:0,currentY:0,maxScroll:0,lastTimestamp:0,frameCallback:null,isScrolling:!1,pullDistance:0,refreshThreshold:50,isPullingToRefresh:!1}),M=Xe(),y=f.useCallback(Ae(()=>{h.current&&p.current&&(T.current.maxScroll=Math.max(0,p.current.offsetHeight-h.current.offsetHeight))}),[]),E=f.useCallback(F=>{const{maxScroll:v}=T.current;return F>0?Math.pow(F,.8):F<-v?-v-Math.pow(-(F+v),.8):F},[]),R=f.useCallback(()=>{if(!d||!h.current||!x.current)return;const{currentY:F,maxScroll:v}=T.current,V=h.current.offsetHeight,z=Math.max(30,V/(V+v)*V),U=V-z;let B=-F/v*U,te=1;F>0?(B=0,te=1-F/V,x.current.style.transformOrigin="top"):F<-v?(B=U,te=1-Math.abs(F+v)/V,x.current.style.transformOrigin="bottom"):x.current.style.transformOrigin="top",x.current.style.transform=`translate3d(0, ${B}px, 0) scaleY(${te})`,x.current.style.height=`${z}px`},[d]),W=f.useCallback(F=>{if(T.current.currentY=F,p.current&&(p.current.style.transform=`translate3d(0, ${F}px, 0)`),b.current){const v=Math.max(F-T.current.refreshThreshold,-T.current.refreshThreshold);b.current.style.transform=`translate3d(0, ${v}px, 0)`}m&&m(F),R()},[R]),C=f.useCallback(F=>{const v=T.current;v.frameCallback&&(A.cancelFrame(v.frameCallback),v.frameCallback=null);const V=performance.now(),z=v.currentY,U=F-z,B=()=>{const te=performance.now()-V,he=Math.min(te/c,1),Me=1-Math.pow(1-he,3),ye=z+U*Me;W(ye),he>=1&&(v.frameCallback&&(A.cancelFrame(v.frameCallback),v.frameCallback=null),W(F),F===0&&b.current&&(b.current.textContent="Pull to refresh"))};v.frameCallback=A.frame.render(B,!0)},[W,c]),g=f.useCallback(F=>{const v=T.current;v.frameCallback&&(A.cancelFrame(v.frameCallback),v.frameCallback=null);let V=F,z=Date.now();const U=()=>{const B=Date.now(),te=B-z;if(z=B,V*=Math.pow(.95,te/16),v.currentY+=V*te,v.currentY>0||v.currentY<-v.maxScroll){v.frameCallback&&(A.cancelFrame(v.frameCallback),v.frameCallback=null),C(v.currentY>0?0:-v.maxScroll);return}W(v.currentY),Math.abs(V)<.01&&v.frameCallback&&(A.cancelFrame(v.frameCallback),v.frameCallback=null)};v.frameCallback=A.frame.render(U,!0)},[W,C]),j=f.useCallback(()=>{if(!d||!x.current)return;w.current!==null&&clearTimeout(w.current),requestAnimationFrame(()=>{x.current&&(x.current.style.opacity="1")});const F=window.requestIdleCallback||(v=>setTimeout(v,1e3));w.current=window.setTimeout(()=>{F(()=>{x.current&&(x.current.style.opacity="0"),w.current=null})},1e3)},[d]),D=f.useCallback(F=>{if(O.current!==null&&Date.now()-O.current<50)return;O.current=Date.now();const v=T.current;v.isScrolling=!0,v.startY=v.currentY,v.lastTimestamp=Date.now(),v.isPullingToRefresh=v.currentY===0,v.pullDistance=0,v.frameCallback&&(A.cancelFrame(v.frameCallback),v.frameCallback=null),j()},[j]),L=f.useCallback(F=>{const v=T.current;if(!v.isScrolling)return;const V=E(v.startY+F.deltaY);v.isPullingToRefresh&&V<v.startY&&(v.isPullingToRefresh=!1),W(V),s&&v.isPullingToRefresh&&!$&&V>0&&(v.pullDistance=V,b.current&&(b.current.textContent=v.pullDistance>v.refreshThreshold?"Release to refresh":"Pull to refresh")),j()},[s,W,$,j,E]),Y=f.useCallback(F=>{const v=T.current;v.isScrolling&&(v.isScrolling=!1,s&&v.isPullingToRefresh&&!$&&v.pullDistance>v.refreshThreshold?q():v.currentY>0||v.currentY<-v.maxScroll?C(v.currentY>0?0:-v.maxScroll):g(F.velocityY),v.isPullingToRefresh=!1)},[s,g,C,$]),q=f.useCallback(()=>{S(!0),C(T.current.refreshThreshold),b.current&&(b.current.textContent="Refreshing..."),s&&s().then(()=>{S(!1),C(0)})},[s,C]);return f.useEffect(()=>{if(!h.current)return;const F=br.createGesture(h.current,{name:"page-scroller-gesture",priority:10,passive:!0,direction:"y",onStart:D,onMove:L,onEnd:Y});return F.init(),()=>F.destroy()},[D,L,Y]),f.useEffect(()=>{if(h.current)return y(),R(),window.addEventListener("resize",y),()=>{window.removeEventListener("resize",y),w.current!==null&&clearTimeout(w.current)}},[y,R]),l.jsxs(A.motion.div,{id:e,ref:h,initial:{x:t||M?0:window.innerWidth,y:M?20:void 0,opacity:M&&!t?0:1},animate:{x:M||t?void 0:0,y:M?0:void 0,opacity:1,transition:{ease:[.32,.72,0,1],duration:M?.34:.44,delay:.2}},exit:{x:M||t?void 0:window.innerWidth+80,y:M?20:0,opacity:M?0:1,transition:{duration:M?.34:.6,ease:[.32,.72,0,1]}},style:{overflow:"hidden",position:r?"absolute":"relative",...a},className:N("top-0 right-0 h-full w-full bg-base-1 isolate will-change-transform",i),children:[s&&l.jsx("div",{ref:b,style:{position:"absolute",top:n?48:0,left:0,width:"100%",textAlign:"center",height:"50px",lineHeight:"50px",transform:"translateY(-50px)"},children:"Pull to refresh"}),l.jsx("div",{ref:p,style:{position:"absolute",top:0,left:0,width:"100%",willChange:"transform"},className:u,children:o}),n,d&&l.jsx("div",{ref:x,style:{position:"absolute",top:2,right:2,width:6,borderRadius:3,opacity:0,transition:"opacity 0.2s",willChange:"transform"},className:"bg-base-3"})]},`scroller${e}`)};function Da({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),c=f.useRef(null),d=f.useRef(null),[m,h]=f.useState(!1),p=f.useRef(null),b=f.useRef({startY:0,currentY:0,maxScroll:0,lastTimestamp:0,frameCallback:null,isScrolling:!1,pullDistance:0,refreshThreshold:50,isPullingToRefresh:!1}),x=f.useCallback(Ae(()=>{a.current&&i.current&&(b.current.maxScroll=Math.max(0,i.current.offsetHeight-a.current.offsetHeight))}),[]),w=f.useCallback(C=>{const{maxScroll:g}=b.current;return C>0?Math.pow(C,.8):C<-g?-g-Math.pow(-(C+g),.8):C},[]),$=f.useCallback(()=>{if(!t||!a.current||!c.current)return;const{currentY:C,maxScroll:g}=b.current,j=a.current.offsetHeight,D=Math.max(30,j/(j+g)*j),L=j-D;let Y=-C/g*L,q=1;C>0?(Y=0,q=1-C/j,c.current.style.transformOrigin="top"):C<-g?(Y=L,q=1-Math.abs(C+g)/j,c.current.style.transformOrigin="bottom"):c.current.style.transformOrigin="top",c.current.style.transform=`translate3d(0, ${Y}px, 0) scaleY(${q})`,c.current.style.height=`${D}px`},[t]),S=f.useCallback(C=>{if(b.current.currentY=C,i.current&&(i.current.style.transform=`translate3d(0, ${C}px, 0)`),u.current){const g=Math.max(C-b.current.refreshThreshold,-b.current.refreshThreshold);u.current.style.transform=`translate3d(0, ${g}px, 0)`}s&&s(C),$()},[$]),O=f.useCallback(C=>{const g=b.current;g.frameCallback&&(A.cancelFrame(g.frameCallback),g.frameCallback=null);const j=performance.now(),D=g.currentY,L=C-D,Y=()=>{const q=performance.now()-j,F=Math.min(q/n,1),v=1-Math.pow(1-F,3),V=D+L*v;S(V),F>=1&&(g.frameCallback&&(A.cancelFrame(g.frameCallback),g.frameCallback=null),S(C))};g.frameCallback=A.frame.render(Y,!0)},[S,n]),T=f.useCallback(C=>{const g=b.current;g.frameCallback&&(A.cancelFrame(g.frameCallback),g.frameCallback=null);let j=C,D=Date.now();const L=()=>{const Y=Date.now(),q=Y-D;if(D=Y,j*=Math.pow(.95,q/16),g.currentY+=j*q,g.currentY>0||g.currentY<-g.maxScroll){g.frameCallback&&(A.cancelFrame(g.frameCallback),g.frameCallback=null),O(g.currentY>0?0:-g.maxScroll);return}S(g.currentY),Math.abs(j)<.01&&g.frameCallback&&(A.cancelFrame(g.frameCallback),g.frameCallback=null)};g.frameCallback=A.frame.render(L,!0)},[S,O]),M=f.useCallback(()=>{if(!t||!c.current)return;d.current!==null&&clearTimeout(d.current),requestAnimationFrame(()=>{c.current&&(c.current.style.opacity="1")});const C=window.requestIdleCallback||(g=>setTimeout(g,1e3));d.current=window.setTimeout(()=>{C(()=>{c.current&&(c.current.style.opacity="0"),d.current=null})},1e3)},[t]),y=f.useCallback(C=>{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&&(A.cancelFrame(g.frameCallback),g.frameCallback=null),M()},[M]),E=f.useCallback(C=>{const g=b.current;if(!g.isScrolling)return;const j=w(g.startY+C.deltaY);g.isPullingToRefresh&&j<g.startY&&(g.isPullingToRefresh=!1),S(j),r&&g.isPullingToRefresh&&!m&&j>0&&(g.pullDistance=j),M()},[r,S,m,M,w]),R=f.useCallback(()=>{h(!0),O(b.current.refreshThreshold),r&&r().then(()=>{h(!1),O(0)})},[r,O]),W=f.useCallback(C=>{const g=b.current;g.isScrolling&&(g.isScrolling=!1,r&&g.isPullingToRefresh&&!m&&g.pullDistance>g.refreshThreshold?R():g.currentY>0||g.currentY<-g.maxScroll?O(g.currentY>0?0:-g.maxScroll):T(C.velocityY),g.isPullingToRefresh=!1)},[r,T,O,m,R]);return f.useEffect(()=>{if(!a.current)return;const C=br.createGesture(a.current,{name:"page-scroller-gesture",priority:10,passive:!0,direction:"y",onStart:y,onMove:E,onEnd:W});return C.init(),()=>C.destroy()},[y,E,W]),f.useEffect(()=>{if(a.current)return x(),$(),window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x),d.current!==null&&clearTimeout(d.current)}},[x,$]),{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:c}},refreshing:m,updateMaxScroll:x,rubberBandEffect:w,updateScrollbarPosition:$,setPosition:S}}const Pa=f.forwardRef(({placeholder:e="Buscar",value:t,exposedRef:r,autoFocus:n,onClear:o,onChange:s,className:a,onMount:i,error:u},c)=>{const d=f.useRef(null),m=Xe(),h=Ft(d,c),p=f.useCallback(()=>r&&r(d),[]);return f.useEffect(()=>{const b=async()=>{i&&await i(d,m)};p(),b()},[]),l.jsxs("div",{className: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:[l.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")}),l.jsx(_.Search,{size:20,className:N("absolute left-3 text-base-11 pointer-events-none",{"text-red-9":u})}),o&&t&&t.length>0?l.jsx("button",{onClick:()=>{o(),d.current?.focus()},className:N("absolute right-2.5 rounded-full",u?"text-red-9":"text-base-11"),children:l.jsx(_.X,{size:20})}):null]})}),Oa=({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 l.jsxs("div",{children:[l.jsx("p",{className:N("text-base-12",r==="sm"&&"text-sm",n),children:u}),i?l.jsx("button",{onClick:()=>a(c=>!c),className:N("text-xs text-base-11",o),children:s?"Ver menos":"Ver más"}):null]})},ur=({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 c;if(t==="right"||t==="down"?c=Math.min(a+u,i):c=Math.max(a-u,0),c===a)return;const d={fast:.15,normal:.4,slow:.8};A.animate(0,1,{duration:d[o],ease:"easeOut",onUpdate:m=>{if(!e)return;const h=a+(c-a)*m;s?e.scrollTop=h:e.scrollLeft=h}})},Fa={default:[.32,.72,0,1]},dr={initial:{opacity:0},animate:{opacity:1,transition:{ease:Fa.default,duration:.3}},exit:{opacity:0,transition:{ease:[.32,.72,0,1],duration:.3}}},Qr=new Set,J=new WeakMap,Fe=new WeakMap,Se=new WeakMap,Dt=new WeakMap,Ra=new WeakMap,Re=new WeakMap,it=new WeakMap,Ye=new WeakSet;let we,Ht=0,Bt=0;const fe="__aa_tgt",qe="__aa_del",lt="__aa_new",La=e=>{const t=za(e);t&&t.forEach(r=>Ha(r))},Aa=e=>{e.forEach(t=>{t.target===we&&_a(),J.has(t.target)&&Te(t.target)})};function Wa(e){Dt.get(e)?.disconnect();let r=J.get(e),n=0;const o=5;r||(r=Le(e),J.set(e,r));const{offsetWidth:s,offsetHeight:a}=we,u=[r.top-o,s-(r.left+o+r.width),a-(r.top+o+r.height),r.left-o].map(d=>`${-1*Math.floor(d)}px`).join(" "),c=new IntersectionObserver(()=>{++n>1&&Te(e)},{root:we,threshold:1,rootMargin:u});c.observe(e),Dt.set(e,c)}function Te(e){clearTimeout(it.get(e));const t=pt(e),r=Ve(t)?500:t.duration;it.set(e,setTimeout(async()=>{const n=Se.get(e);try{await n?.finished,J.set(e,Le(e)),Wa(e)}catch{}},r))}function _a(){clearTimeout(it.get(we)),it.set(we,setTimeout(()=>{Qr.forEach(e=>tn(e,t=>Jr(()=>Te(t))))},100))}function Ya(e){setTimeout(()=>{Ra.set(e,setInterval(()=>Jr(Te.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function Jr(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let Pt,ct;const Ia=typeof window<"u"&&"ResizeObserver"in window;Ia&&(we=document.documentElement,Pt=new MutationObserver(La),ct=new ResizeObserver(Aa),window.addEventListener("scroll",()=>{Bt=window.scrollY,Ht=window.scrollX}),ct.observe(we));function za(e){return e.reduce((n,o)=>[...n,...Array.from(o.addedNodes),...Array.from(o.removedNodes)],[]).every(n=>n.nodeName==="#comment")?!1:e.reduce((n,o)=>{if(n===!1)return!1;if(o.target instanceof Element){if(Et(o.target),!n.has(o.target)){n.add(o.target);for(let s=0;s<o.target.children.length;s++){const a=o.target.children.item(s);if(a){if(qe in a)return!1;Et(o.target,a),n.add(a)}}}if(o.removedNodes.length)for(let s=0;s<o.removedNodes.length;s++){const a=o.removedNodes[s];if(qe in a)return!1;a instanceof Element&&(n.add(a),Et(o.target,a),Fe.set(a,[o.previousSibling,o.nextSibling]))}}return n},new Set)}function Et(e,t){!t&&!(fe in e)?Object.defineProperty(e,fe,{value:e}):t&&!(fe in t)&&Object.defineProperty(t,fe,{value:e})}function Ha(e){const t=e.isConnected,r=J.has(e);t&&Fe.has(e)&&Fe.delete(e),Se.has(e)&&Se.get(e)?.cancel(),lt in e?fr(e):r&&t?qa(e):r&&!t?Va(e):fr(e)}function ae(e){return Number(e.replace(/[^0-9.\-]/g,""))}function Ba(e){let t=e.parentElement;for(;t;){if(t.scrollLeft||t.scrollTop)return{x:t.scrollLeft,y:t.scrollTop};t=t.parentElement}return{x:0,y:0}}function Le(e){const t=e.getBoundingClientRect(),{x:r,y:n}=Ba(e);return{top:t.top+n,left:t.left+r,width:t.width,height:t.height}}function Zr(e,t,r){let n=t.width,o=t.height,s=r.width,a=r.height;const i=getComputedStyle(e);if(i.getPropertyValue("box-sizing")==="content-box"){const c=ae(i.paddingTop)+ae(i.paddingBottom)+ae(i.borderTopWidth)+ae(i.borderBottomWidth),d=ae(i.paddingLeft)+ae(i.paddingRight)+ae(i.borderRightWidth)+ae(i.borderLeftWidth);n-=d,s-=d,o-=c,a-=c}return[n,s,o,a].map(Math.round)}function pt(e){return fe in e&&Re.has(e[fe])?Re.get(e[fe]):{duration:250,easing:"ease-in-out"}}function en(e){if(fe in e)return e[fe]}function qt(e){const t=en(e);return t?Ye.has(t):!1}function tn(e,...t){t.forEach(r=>r(e,Re.has(e)));for(let r=0;r<e.children.length;r++){const n=e.children.item(r);n&&t.forEach(o=>o(n,Re.has(n)))}}function Vt(e){return Array.isArray(e)?e:[e]}function Ve(e){return typeof e=="function"}function qa(e){const t=J.get(e),r=Le(e);if(!qt(e))return J.set(e,r);let n;if(!t)return;const o=pt(e);if(typeof o!="function"){const s=t.left-r.left,a=t.top-r.top,[i,u,c,d]=Zr(e,t,r),m={transform:`translate(${s}px, ${a}px)`},h={transform:"translate(0, 0)"};o.fromBorderRadius!==void 0&&o.toBorderRadius!==void 0&&(m.borderRadius=`${o.fromBorderRadius}px`,h.borderRadius=`${o.toBorderRadius}px`),i!==u&&(m.width=`${i}px`,h.width=`${u}px`),c!==d&&(m.height=`${c}px`,h.height=`${d}px`),n=e.animate([m,h],{duration:o.duration,easing:o.easing})}else{const[s]=Vt(o(e,"remain",t,r));n=new Animation(s),n.play()}Se.set(e,n),J.set(e,r),n.addEventListener("finish",Te.bind(null,e))}function fr(e){lt in e&&delete e[lt];const t=Le(e);J.set(e,t);const r=pt(e);if(!qt(e))return;let n;if(typeof r!="function")n=e.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:r.duration*1.5,easing:"ease-in"});else{const[o]=Vt(r(e,"add",t));n=new Animation(o),n.play()}Se.set(e,n),n.addEventListener("finish",Te.bind(null,e))}function mr(e,t){e.remove(),J.delete(e),Fe.delete(e),Se.delete(e),Dt.get(e)?.disconnect(),setTimeout(()=>{if(qe in e&&delete e[qe],Object.defineProperty(e,lt,{value:!0,configurable:!0}),t&&e instanceof HTMLElement)for(const r in t)e.style[r]=""},0)}function Va(e){if(!Fe.has(e)||!J.has(e))return;const[t,r]=Fe.get(e);Object.defineProperty(e,qe,{value:!0,configurable:!0});const n=window.scrollX,o=window.scrollY;if(r&&r.parentNode&&r.parentNode instanceof Element?r.parentNode.insertBefore(e,r):t&&t.parentNode?t.parentNode.appendChild(e):en(e)?.appendChild(e),!qt(e))return mr(e);const[s,a,i,u]=Ka(e),c=pt(e),d=J.get(e);(n!==Ht||o!==Bt)&&Xa(e,n,o,c);let m,h={position:"absolute",top:`${s}px`,left:`${a}px`,width:`${i}px`,height:`${u}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!Ve(c))Object.assign(e.style,h),m=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:c.duration,easing:"ease-out"});else{const[p,b]=Vt(c(e,"remove",d));b?.styleReset!==!1&&(h=b?.styleReset||h,Object.assign(e.style,h)),m=new Animation(p),m.play()}Se.set(e,m),m.addEventListener("finish",mr.bind(null,e,h))}function Xa(e,t,r,n){const o=Ht-t,s=Bt-r,a=document.documentElement.style.scrollBehavior;if(getComputedStyle(we).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+o,window.scrollY+s),!e.parentElement)return;const u=e.parentElement;let c=u.clientHeight,d=u.clientWidth;const m=performance.now();function h(){requestAnimationFrame(()=>{if(!Ve(n)){const p=c-u.clientHeight,b=d-u.clientWidth;m+n.duration>performance.now()?(window.scrollTo({left:window.scrollX-b,top:window.scrollY-p}),c=u.clientHeight,d=u.clientWidth,h()):document.documentElement.style.scrollBehavior=a}})}h()}function Ka(e){const t=J.get(e),[r,,n]=Zr(e,t,Le(e));let o=e.parentElement;for(;o&&(getComputedStyle(o).position==="static"||o instanceof HTMLBodyElement);)o=o.parentElement;o||(o=document.body);const s=getComputedStyle(o),a=J.get(o)||Le(o),i=Math.round(t.top-a.top)-ae(s.borderTopWidth),u=Math.round(t.left-a.left)-ae(s.borderLeftWidth);return[i,u,r,n]}function rn(e,t={}){return Pt&&ct&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!Ve(t)&&!t.disrespectUserMotionPreference||(Ye.add(e),getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),tn(e,Te,Ya,o=>ct?.observe(o)),Ve(t)?Re.set(e,t):Re.set(e,{duration:250,easing:"ease-in-out",...t}),Pt.observe(e,{childList:!0}),Qr.add(e))),Object.freeze({parent:e,enable:()=>{Ye.add(e)},disable:()=>{Ye.delete(e)},isEnabled:()=>Ye.has(e)})}const ge={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"}}},Ua=({options:e,selected:t,onChange:r,keyExtractor:n,labelExtractor:o,itemColor:s,itemClassName:a,color:i="contrast",unselectedColor:u="none",width:c="fit",border:d="solid",rounded:m=6,trackScroll:h=!0,className:p})=>{const[b,x]=f.useState({left:!1,right:!1}),{ref:w}=xr({onOverflow:$=>{x({left:$.canScrollLeft,right:$.canScrollRight})},trackScroll:h});return l.jsxs("div",{className:N("relative overflow-hidden",ge.widths[c].container,ge.rounded[m],p),children:[l.jsx("div",{ref:w,className:N("flex items-center border overflow-x-scroll scrollbar-hide",ge.rounded[m],ge.border[d]),children:e.map($=>{const S=n(t)===n($);return l.jsx("button",{onClick:()=>r?.($),className:N("border-r px-3 py-1 last:border-none text-nowrap shrink-0",ge.widths[c].item,!S&&"lg:hover:bg-overlay-3",s?s(S):S?ge.colors[i]:ge.unselectedColors[u],ge.border[d],a),children:o($)},n($))})}),l.jsxs(A.AnimatePresence,{children:[b.left?l.jsx(A.motion.button,{variants:dr,initial:"initial",animate:"animate",exit:"exit",onClick:()=>{w.current&&ur({el:w.current,direction:"left"})},className:"absolute shrink-0 left-0 px-1 h-full bg-gradient-to-r from-base-2 top-0",children:l.jsx(_.ChevronLeft,{className:"text-base-13"})},"leftarrow"):null,b.right?l.jsx(A.motion.button,{variants:dr,initial:"initial",animate:"animate",exit:"exit",onClick:()=>{w.current&&ur({el:w.current,direction:"right"})},className:"absolute shrink-0 right-0 px-1 h-full bg-gradient-to-l from-base-2 top-0",children:l.jsx(_.ChevronRight,{className:"text-base-13"})},"rightarrow"):null]})]})},nn=({label:e,labelPosition:t="default",options:r,selectedValue:n,onChange:o,idExtractor:s,labelExtractor:a,customSetter:i,valid:u,error:c,placeholder:d="Select option...",searchable:m=!1,disabled:h=!1,clearable:p=!1,className:b})=>{const[x,w]=f.useState(""),[$,S]=f.useState(!1),[O,T]=f.useState(-1),M=f.useRef(null),y=f.useRef(null),E=f.useRef([]),{triggerRef:R,triggerProps:W,popoverRef:C,getPopoverPosition:g,open:j,toggle:D,close:L}=ut({align:"start",side:"top",avoidCollisions:!1,onOpen:()=>{S(!0),m&&M.current&&setTimeout(()=>M.current?.focus(),10)},onClose:()=>{S(!1),w(""),T(-1)}}),Y=f.useRef(`select-${Math.random().toString(36).substr(2,9)}`).current,q=f.useRef(`label-${Math.random().toString(36).substr(2,9)}`).current,F=f.useRef(`error-${Math.random().toString(36).substr(2,9)}`).current,v=f.useRef(`listbox-${Math.random().toString(36).substr(2,9)}`).current,z=n?i?r.find(P=>s(P)===n||s(P)===s(n))||null:n:null,U=z!==null,B=m?r.filter(k=>a(k).toLowerCase().includes(x.toLowerCase())):r;f.useEffect(()=>{E.current=E.current.slice(0,B.length)},[B.length]);const te=k=>z?i?n===s(k)||s(n)===s(k):s(z)===s(k):!1,he=k=>{if(h)return;const P=i?i(k):k;o(P),be(`Selected ${a(k)}`),L()},Me=k=>{k.stopPropagation(),!h&&(o(null),be("Cleared selection"))},ye=k=>{if(!h)switch(k.key){case"Enter":k.preventDefault(),j?O>=0&&he(B[O]):D();break;case"Escape":k.preventDefault(),L();break;case"ArrowDown":if(k.preventDefault(),!j)D();else{const P=O>=B.length-1?0:O+1;T(P),E.current[P]?.scrollIntoView({block:"nearest"})}break;case"ArrowUp":if(k.preventDefault(),j){const P=O<=0?B.length-1:O-1;T(P),E.current[P]?.scrollIntoView({block:"nearest"})}break;case"Backspace":case"Delete":p&&U&&(!m||x==="")&&(k.preventDefault(),o(null),be("Cleared selection"));break}},gt=k=>{w(k.target.value),T(-1)},vt=()=>{h||(m&&M.current&&M.current.focus(),D())},be=k=>{console.log(`Accessibility announcement: ${k}`)};dt(C,k=>{!R.current||!j||!k.target||R.current.contains(k.target)||L()});const ke=g();return l.jsxs("div",{className:N("relative",b),children:[l.jsxs("div",{className:"relative",ref:y,children:[t==="default"&&l.jsx("label",{className:N("top-[18px] font-medium ml-0.5 text-xs",c&&"text-red-9"),children:e}),l.jsxs("div",{ref:R,...W,className:N("relative rounded-6 px-3 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":j||$,"text-red-9":c,"ring-2 ring-red-6":c&&(j||$),"opacity-60 cursor-not-allowed":h}),onClick:vt,role:"combobox","aria-expanded":j,"aria-haspopup":"listbox","aria-owns":v,"aria-labelledby":q,"aria-describedby":c?F:void 0,onKeyDown:ye,tabIndex:h?-1:0,children:[t==="floating"&&l.jsx("label",{id:q,htmlFor:Y,className:N("absolute transition-all duration-200 pointer-events-none","text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":$||U,"text-red-9":!!c}),children:e}),l.jsx("div",{className:N("flex items-center",{"mt-2.5":t==="floating"}),children:m?l.jsx("input",{ref:M,id:Y,type:"text",className:"flex-grow bg-transparent outline-none placeholder:text-sm",value:j?x:z?a(z):"",onChange:gt,onKeyDown:ye,placeholder:U?"":d,disabled:h,"aria-autocomplete":"list","aria-controls":v,autoComplete:"off",readOnly:!j}):l.jsx("span",{className:N("flex-grow text-sm",{"text-secondarytext":!U}),children:U?a(z):d})}),l.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:[u&&l.jsx(_.CheckIcon,{size:16,className:"text-green-600"}),p&&U&&!h&&l.jsx("button",{type:"button",className:"hover:bg-brand/20 rounded-full p-0.5 transition-colors",onClick:Me,"aria-label":"Clear selection",children:l.jsx(_.CheckIcon,{size:14,className:"rotate-45"})}),l.jsx(_.ChevronDownIcon,{size:16,className:N("transition-transform text-base-11",{"rotate-180":j})})]})]})]}),l.jsx(A.AnimatePresence,{children:j&&l.jsx(Ue,{children:l.jsx(A.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},ref:C,style:{position:"fixed",left:ke.x,top:ke.top,bottom:ke.bottom,width:y.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:v,"aria-labelledby":q,children:B.length===0?l.jsx("div",{className:"px-3 py-2 text-sm text-secondarytext",children:x?"No results found":"No options available"}):B.map((k,P)=>{const X=te(k),ue=P===O;return l.jsxs("div",{ref:xt=>{E.current[P]=xt},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":ue,"bg-brandfadedbg text-brand":X}),onClick:()=>he(k),role:"option","aria-selected":X,onMouseEnter:()=>T(P),children:[l.jsx("span",{children:a(k)}),X&&l.jsx(_.CheckIcon,{size:16})]},s(k))})})})}),c&&l.jsx("p",{id:F,className:"text-red-9 text-xs mt-1","aria-live":"assertive",children:c}),l.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:U?`Selected: ${a(z)}`:"No selection"})]})},Ga=({name:e,...t})=>{const{control:r}=Z.useFormContext();return r?l.jsx(Z.Controller,{name:e,control:r,render:({field:n,fieldState:o})=>l.jsx(nn,{selectedValue:n.value||null,onChange:s=>n.onChange(s),error:o.error?.message,...t})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},Qa=({className:e})=>l.jsx("div",{className:N("w-full h-px bg-base-4",e)}),on=({loading:e=!0,wrapperClassName:t,spinnerClassName:r})=>l.jsx("div",{className:N("flex justify-center",t),children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",className:N({"animate-spin":e},r),children:l.jsx("path",{fill:"currentColor",d:"M10 3a7 7 0 0 0-7 7a.5.5 0 0 1-1 0a8 8 0 1 1 8 8a.5.5 0 0 1 0-1a7 7 0 1 0 0-14Z"})})}),Ja=({isEditable:e,isDeletable:t=!0,createUpdateLoading:r,deleteLoading:n,onDelete:o,onDeleteConfirm:s,addText:a="Añadir",updateText:i="Actualizar",deleteText:u="Eliminar",className:c})=>{const[d,m]=f.useState(!1);return l.jsxs("div",{className:`w-full grid grid-cols-2 gap-4 col-span-full ${c}`,children:[e&&t?l.jsxs(Q,{color:"dangersolid",state:n?"loading":r?"disabled":"enabled",onClick:()=>{s?d?o?.():m(!0):o?.()},children:[l.jsx(_.X,{size:18}),s&&d?"Confirmar":u]}):null,l.jsxs(Q,{color:"brand",className:N(e&&t?"":"col-span-2"),state:r?"loading":n?"disabled":"enabled",type:"submit",children:[r?l.jsx(on,{}):e?l.jsx(_.Check,{size:18}):l.jsx(_.Plus,{size:18}),e?i:a]})]})},sn=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)=>{A.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=>{A.animate(d,{y:0,scale:1},{ease:[.32,.72,0,1],duration:.2})},[]),u=f.useCallback(()=>r.current,[]),c={add:n,remove:o,getPrevId:s,animateParentModal:a,restoreParentModal:i,getModals:u};return l.jsx(sn.Provider,{value:c,children:e})},an=()=>{const e=f.useContext(sn);if(e===void 0)throw new Error("useModals must be used within a ModalsProvider");return e},ei=({withPortal:e,children:t})=>e?l.jsx(Ue,{children:t}):l.jsx(l.Fragment,{children:t}),ti=({id:e,prevPath:t,withDelay:r,withPortal:n=!0,title:o,description:s,showHeader:a=!0,mode:i,onReplace:u,className:c,contentClassName:d,children:m})=>{const h=We.useInitialChangeEvent(),p=Xe(),b=f.useRef(null),x=an(),w=f.useMemo(()=>i==="modal"||p,[i,p]);return f.useEffect(()=>{x.add(e);const $=x.getPrevId();if(!$||(b.current=document.getElementById($),!b.current))return;$&&x.animateParentModal(b.current,w?"modal":"sheet");//! cleanups not running on new router system
11
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),f=require("react"),dr=require("react-dom"),un=require("clsx"),dn=require("tailwind-merge"),fn=require("@mateosuarezdev/atoms"),Y=require("lucide-react"),A=require("framer-motion"),J=require("react-hook-form"),Ue=require("@hookform/resolvers"),fr=require("@mateosuarezdev/gestures"),Fe=require("@mateosuarezdev/react-router"),k=(...e)=>dn.twMerge(un.clsx(e));function Pe(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 mn(e,t=500){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{e.apply(this,n),r=null},t)}}function mr(e){if(!e)return"";const r=e.trim().replace(/\s+/g," ").split(" ");return r.length===0||r[0]===""?"":r.length===1?r[0].charAt(0).toUpperCase():(r[0].charAt(0)+r[1].charAt(0)).toUpperCase()}function hr(e){e.focus();const t=e.value.length;e.setSelectionRange(t,t)}function br(e){return e.replace(/\s/g,"")}function hn(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 Mt(e){return e===null?"":e}function et(e){return br(e)===""?null:e}function bn(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 pn{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 We=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}},pr=({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=Pe(()=>{if(s.current){const h=We(s.current);e?.(h)}}),c=We(s.current);a=c.horizontal||c.vertical,e?.(c),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}},gn=({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 c=Pe(()=>{if(o.current){const p=We(o.current);a(p)}}),d=We(o.current);i=d.horizontal||d.vertical,a(d),window.addEventListener("resize",c);let m=null;t&&(m=new ResizeObserver(c),o.current&&m.observe(o.current));let h=null;return e&&i&&(h=o.current,h.addEventListener("scroll",c)),()=>{window.removeEventListener("resize",c),m&&m.disconnect(),h&&i&&h.removeEventListener("scroll",c)}},[r,...n]),{ref:o,overflowInfo:s}},gt={xs:"w-8 h-8",sm:"w-10 h-10 text-lg",md:"w-14 h-14 text-xl",lg:"h-20 w-20 text-2xl",xl:"h-24 w-24 text-2xl"},vn=({src:e,name:t,size:r="md",className:n})=>e?l.jsx("img",{alt:"avatar",src:e,className:k("rounded-full bg-base-3",gt[r])}):t?l.jsx("p",{className:k("rounded-full font-medium dark-theme:bg-base-3 border border-base-6 dark-theme:border-base-4 flex items-center justify-center",gt[r],n),children:mr(t)}):l.jsx("div",{className:k("rounded-full text-2xl font-medium flex items-center justify-center","bg-base-2 dark-theme:bg-base-3 border border-base-4","lg:hover:bg-base-3 max-lg:active:bg-base-4 transition-colors",gt[r],n),children:l.jsxs(Br,{size:r==="xs"?16:r==="sm"?20:24,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),l.jsx("circle",{cx:"12",cy:"7",r:"4"})]})});function xn({className:e,children:t,animate:r=!1,...n}){return l.jsx("div",{className:k("flex -space-x-3 rtl:space-x-reverse",e),...n,children:t})}function wn(e){return f.useSyncExternalStore(t=>e.subscribe(t),()=>e.get(),()=>e.get())}const kt=fn.atom(typeof window<"u"?window.innerWidth>1024:!0);let vt=!1;const qt=Pe(()=>{kt.set(window.innerWidth>1024)});typeof window<"u"&&(vt&&(window.removeEventListener("resize",qt),vt=!1),window.addEventListener("resize",qt),vt=!0);const He=()=>(f.useLayoutEffect(()=>{kt.set(window.innerWidth>1024)},[]),wn(kt));function Dt(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}const gr=(e=!0,t)=>{const r=He(),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),c=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=`${c}px`,h.style.top=`${d}px`,m.appendChild(h);const p=a.getElementsByClassName("ripple-wrapper");if(p?.length)for(const b of p)b.remove();a.appendChild(m),setTimeout(()=>{m.remove()},700)},[e,r,t]);return{ref:n,ripple:o,styles:{position:"relative"}}},ct=({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[c,d]=f.useState(!1),[m,h]=f.useState({width:192,height:300}),p=f.useRef(null),b=f.useRef(null),x=f.useRef({left:0,right:0,top:0,bottom:0,x:0,y:0,width:0,height:0}),v=f.useRef(null),$=f.useId(),C=f.useCallback(y=>{const N=y??x.current;if(!N)return{x:0,top:0,bottom:void 0};const P=m.width,O=m.height;return vr({triggerRect:N,popoverWidth:P,popoverHeight:O,align:t,side:r,offset:n,collisionPadding:o,avoidCollisions:s})},[x.current,m,t,r]);f.useEffect(()=>{if(!c||!e||(v.current=document.getElementById(e),!v.current))return;c&&R();const y=()=>{v.current&&(d(!1),i?.(),v.current.removeEventListener("scroll",y))};return a&&v.current.addEventListener("scroll",y,{passive:!0}),()=>{v.current&&v.current.removeEventListener("scroll",y)}},[c,e]);const R=()=>{b.current&&h({width:b.current.offsetWidth,height:b.current.offsetHeight})},j=f.useCallback(()=>{if(!p.current)return;const y=p.current.getBoundingClientRect();x.current={left:y.left,right:y.right,top:y.top,bottom:y.bottom,x:y.x,y:y.y,width:y.width,height:y.height},d(N=>(N?u?.():i?.(),!N))},[]),T=f.useCallback(()=>{d(!1),u?.()},[]);return{triggerRef:p,triggerProps:{id:$,"aria-expanded":c,"aria-haspopup":!0},popoverRef:b,getPopoverPosition:C,open:c,toggle:j,close:T}},vr=({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 c=0,d=0;if(i){if(o==="right"){const p=e.right+s,b=e.left-t-s,x=Math.max(0,p+t-(u.width-a)),v=Math.max(0,a-b);x<=v?(c=p,x>0&&(c=u.width-t-a)):(c=b,v>0&&(c=a)),d=e.top,d+r>u.height-a&&(d=u.height-r-a),d<a&&(d=a)}else if(o==="left"){const p=e.left-t-s,b=e.right+s,x=Math.max(0,a-p),v=Math.max(0,b+t-(u.width-a));x<=v?(c=p,x>0&&(c=a)):(c=b,v>0&&(c=u.width-t-a)),d=e.top,d+r>u.height-a&&(d=u.height-r-a),d<a&&(d=a)}else if(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 x=u.width-e.left,v=e.right;if(n==="start")c=e.left,c+t>u.width-a&&(v>=t?c=e.right-t:c=u.width-t-a);else if(n==="end")c=e.right-t,c<a&&(x>=t?c=e.left:c=a);else{const $=e.left+e.width/2-t/2;$>=a&&$+t<=u.width-a?c=$:$<a?c=a:c=u.width-t-a}}else{const p=e.top,b=u.height-e.bottom;p>=r+s?d=e.top-r-s:b>=r+s?d=e.bottom+s:(d=e.top-r-s,d=Math.max(a,d));const x=u.width-e.left,v=e.right;if(n==="start")c=e.left,c+t>u.width-a&&(v>=t?c=e.right-t:c=u.width-t-a);else if(n==="end")c=e.right-t,c<a&&(x>=t?c=e.left:c=a);else{const $=e.left+e.width/2-t/2;$>=a&&$+t<=u.width-a?c=$:$<a?c=a:c=u.width-t-a}}c=Math.max(a,Math.min(c,u.width-t-a)),d=Math.max(a,Math.min(d,u.height-r-a))}else o==="right"?(c=e.right+s,d=e.top):o==="left"?(c=e.left-t-s,d=e.top):o==="bottom"?d=e.bottom+s:d=e.top-r-s,(o==="top"||o==="bottom")&&(n==="start"?c=e.left:n==="end"?c=e.right-t:c=e.left+e.width/2-t/2);let m,h;return d+r<=e.top?h=window.innerHeight-(d+r):m=d,{x:c,top:m,bottom:h}};function yn(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 kn(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 ut(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 xr(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 Nn="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",En={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"},$n={all:"focus-visible:ring-1",desktop:"lg:focus-visible:ring-1",mobile:"focus-visible:ring-1 lg:focus-ring-0",none:""},Cn={light:"font-light",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},jn={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"},Sn={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"},Tn={enabled:"",disabled:"opacity-75",loading:""},G=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:c,showFocus:d="desktop",withDisabledDelay:m=!1,type:h="button",...p},b)=>{const[x,v]=f.useState(!1),$=T=>{o==="enabled"&&(m?(v(!0),s&&s(T),setTimeout(()=>v(!1),1e3)):s&&s(T))},{ref:C,ripple:R}=gr(u,e==="contrast"||c),j=Dt(C,b);return l.jsx("button",{ref:j,type:h,disabled:p.disabled?p.disabled:o==="disabled"||o==="loading",onMouseDown:R,onClick:T=>x?null:$(T),className:k(Nn,En[t],Cn[r],jn[n],$n[d],Sn[e],Tn[o],p.disabled&&"opacity-50",a),...p,children:i})});G.displayName="Button";const wr=6048e5,Mn=864e5,Xt=Symbol.for("constructDateFrom");function oe(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Xt in e?e[Xt](t):e instanceof Date?new e.constructor(t):new Date(t)}function Z(e,t){return oe(t||e,e)}function Ze(e,t,r){const n=Z(e,r?.in);if(isNaN(t))return oe(e,NaN);if(!t)return n;const o=n.getDate(),s=oe(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 Dn={};function dt(){return Dn}function _e(e,t){const r=dt(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,o=Z(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 tt(e,t){return _e(e,{...t,weekStartsOn:1})}function yr(e,t){const r=Z(e,t?.in),n=r.getFullYear(),o=oe(r,0);o.setFullYear(n+1,0,4),o.setHours(0,0,0,0);const s=tt(o),a=oe(r,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);const i=tt(a);return r.getTime()>=s.getTime()?n+1:r.getTime()>=i.getTime()?n:n-1}function Vt(e){const t=Z(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function ft(e,...t){const r=oe.bind(null,t.find(n=>typeof n=="object"));return t.map(r)}function rt(e,t){const r=Z(e,t?.in);return r.setHours(0,0,0,0),r}function Pn(e,t,r){const[n,o]=ft(r?.in,e,t),s=rt(n),a=rt(o),i=+s-Vt(s),u=+a-Vt(a);return Math.round((i-u)/Mn)}function On(e,t){const r=yr(e,t),n=oe(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),tt(n)}function xt(e,t,r){const[n,o]=ft(r?.in,e,t);return+rt(n)==+rt(o)}function Fn(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Ln(e){return!(!Fn(e)&&typeof e!="number"||isNaN(+Z(e)))}function Rn(e,t){const r=Z(e,t?.in),n=r.getMonth();return r.setFullYear(r.getFullYear(),n+1,0),r.setHours(23,59,59,999),r}function An(e,t){const[r,n]=ft(e,t.start,t.end);return{start:r,end:n}}function Wn(e,t){const{start:r,end:n}=An(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(oe(r,a)),a.setDate(a.getDate()+i),a.setHours(0,0,0,0);return o?u.reverse():u}function _n(e,t){const r=Z(e,t?.in);return r.setDate(1),r.setHours(0,0,0,0),r}function Yn(e,t){const r=Z(e,t?.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}const In={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"}},zn=(e,t,r)=>{let n;const o=In[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 Se(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const Hn={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Bn={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},qn={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Xn={date:Se({formats:Hn,defaultWidth:"full"}),time:Se({formats:Bn,defaultWidth:"full"}),dateTime:Se({formats:qn,defaultWidth:"full"})},Vn={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Kn=(e,t,r,n)=>Vn[e];function ie(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 Un={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Gn={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Qn={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"]},Jn={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"]},Zn={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"}},eo={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"}},to=(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"},ro={ordinalNumber:to,era:ie({values:Un,defaultWidth:"wide"}),quarter:ie({values:Gn,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ie({values:Qn,defaultWidth:"wide"}),day:ie({values:Jn,defaultWidth:"wide"}),dayPeriod:ie({values:Zn,defaultWidth:"wide",formattingValues:eo,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)?oo(i,m=>m.test(a)):no(i,m=>m.test(a));let c;c=e.valueCallback?e.valueCallback(u):u,c=r.valueCallback?r.valueCallback(c):c;const d=t.slice(a.length);return{value:c,rest:d}}}function no(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function oo(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function kr(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const 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 so=/^(\d+)(th|st|nd|rd)?/i,ao=/\d+/i,io={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},lo={any:[/^b/i,/^(a|c)/i]},co={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},uo={any:[/1/i,/2/i,/3/i,/4/i]},fo={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},mo={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]},ho={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},bo={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]},po={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},go={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}},vo={ordinalNumber:kr({matchPattern:so,parsePattern:ao,valueCallback:e=>parseInt(e,10)}),era:le({matchPatterns:io,defaultMatchWidth:"wide",parsePatterns:lo,defaultParseWidth:"any"}),quarter:le({matchPatterns:co,defaultMatchWidth:"wide",parsePatterns:uo,defaultParseWidth:"any",valueCallback:e=>e+1}),month:le({matchPatterns:fo,defaultMatchWidth:"wide",parsePatterns:mo,defaultParseWidth:"any"}),day:le({matchPatterns:ho,defaultMatchWidth:"wide",parsePatterns:bo,defaultParseWidth:"any"}),dayPeriod:le({matchPatterns:po,defaultMatchWidth:"any",parsePatterns:go,defaultParseWidth:"any"})},Nr={code:"en-US",formatDistance:zn,formatLong:Xn,formatRelative:Kn,localize:ro,match:vo,options:{weekStartsOn:0,firstWeekContainsDate:1}};function xo(e,t){const r=Z(e,t?.in);return Pn(r,Yn(r))+1}function wo(e,t){const r=Z(e,t?.in),n=+tt(r)-+On(r);return Math.round(n/wr)+1}function Er(e,t){const r=Z(e,t?.in),n=r.getFullYear(),o=dt(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,a=oe(t?.in||e,0);a.setFullYear(n+1,0,s),a.setHours(0,0,0,0);const i=_e(a,t),u=oe(t?.in||e,0);u.setFullYear(n,0,s),u.setHours(0,0,0,0);const c=_e(u,t);return+r>=+i?n+1:+r>=+c?n:n-1}function yo(e,t){const r=dt(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=Er(e,t),s=oe(t?.in||e,0);return s.setFullYear(o,0,n),s.setHours(0,0,0,0),_e(s,t)}function ko(e,t){const r=Z(e,t?.in),n=+_e(r,t)-+yo(r,t);return Math.round(n/wr)+1}function _(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const me={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)}},Ce={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Kt={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),o=n>0?n:1-n;return r.ordinalNumber(o,{unit:"year"})}return me.y(e,t)},Y:function(e,t,r,n){const o=Er(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=yr(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 me.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=ko(e,n);return t==="wo"?r.ordinalNumber(o,{unit:"week"}):_(o,t.length)},I:function(e,t,r){const n=wo(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"}):me.d(e,t)},D:function(e,t,r){const n=xo(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=Ce.noon:n===0?o=Ce.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=Ce.evening:n>=12?o=Ce.afternoon:n>=4?o=Ce.morning:o=Ce.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 me.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):me.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"}):me.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):me.s(e,t)},S:function(e,t){return me.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return Gt(n);case"XXXX":case"XX":return xe(n);case"XXXXX":case"XXX":default:return xe(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return Gt(n);case"xxxx":case"xx":return xe(n);case"xxxxx":case"xxx":default:return xe(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Ut(n,":");case"OOOO":default:return"GMT"+xe(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Ut(n,":");case"zzzz":default:return"GMT"+xe(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 Ut(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 Gt(e,t){return e%60===0?(e>0?"-":"+")+_(Math.abs(e)/60,2):xe(e,t)}function xe(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 Qt=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},$r=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},No=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],o=r[2];if(!o)return Qt(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}}",Qt(n,t)).replace("{{time}}",$r(o,t))},Eo={p:$r,P:No},$o=/^D+$/,Co=/^Y+$/,jo=["D","DD","YY","YYYY"];function So(e){return $o.test(e)}function To(e){return Co.test(e)}function Mo(e,t,r){const n=Do(e,t,r);if(console.warn(n),jo.includes(e))throw new RangeError(n)}function Do(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 Po=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Oo=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Fo=/^'([^]*?)'?$/,Lo=/''/g,Ro=/[a-zA-Z]/;function ke(e,t,r){const n=dt(),o=r?.locale??n.locale??Nr,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=Z(e,r?.in);if(!Ln(i))throw new RangeError("Invalid time value");let u=t.match(Oo).map(d=>{const m=d[0];if(m==="p"||m==="P"){const h=Eo[m];return h(d,o.formatLong)}return d}).join("").match(Po).map(d=>{if(d==="''")return{isToken:!1,value:"'"};const m=d[0];if(m==="'")return{isToken:!1,value:Ao(d)};if(Kt[m])return{isToken:!0,value:d};if(m.match(Ro))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 c={firstWeekContainsDate:s,weekStartsOn:a,locale:o};return u.map(d=>{if(!d.isToken)return d.value;const m=d.value;(!r?.useAdditionalWeekYearTokens&&To(m)||!r?.useAdditionalDayOfYearTokens&&So(m))&&Mo(m,t,String(e));const h=Kt[m[0]];return h(i,m,o.localize,c)}).join("")}function Ao(e){const t=e.match(Fo);return t?t[1].replace(Lo,"'"):e}function Jt(e,t,r){const[n,o]=ft(r?.in,e,t);return n.getFullYear()===o.getFullYear()&&n.getMonth()===o.getMonth()}function wt(e,t,r){return Ze(e,-t,r)}const Wo={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"}},_o=(e,t,r)=>{let n;const o=Wo[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},Yo={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},Io={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},zo={full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Ho={date:Se({formats:Yo,defaultWidth:"full"}),time:Se({formats:Io,defaultWidth:"full"}),dateTime:Se({formats:zo,defaultWidth:"full"})},Bo={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"},qo={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"},Xo=(e,t,r,n)=>t.getHours()!==1?qo[e]:Bo[e],Vo={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},Ko={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},Uo={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"]},Go={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"]},Qo={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"}},Jo={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"}},Zo=(e,t)=>Number(e)+"º",es={ordinalNumber:Zo,era:ie({values:Vo,defaultWidth:"wide"}),quarter:ie({values:Ko,defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:ie({values:Uo,defaultWidth:"wide"}),day:ie({values:Go,defaultWidth:"wide"}),dayPeriod:ie({values:Qo,defaultWidth:"wide",formattingValues:Jo,defaultFormattingWidth:"wide"})},ts=/^(\d+)(º)?/i,rs=/\d+/i,ns={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},os={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]},ss={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},as={any:[/1/i,/2/i,/3/i,/4/i]},is={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},ls={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]},cs={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},us={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]},ds={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},fs={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}},ms={ordinalNumber:kr({matchPattern:ts,parsePattern:rs,valueCallback:function(e){return parseInt(e,10)}}),era:le({matchPatterns:ns,defaultMatchWidth:"wide",parsePatterns:os,defaultParseWidth:"any"}),quarter:le({matchPatterns:ss,defaultMatchWidth:"wide",parsePatterns:as,defaultParseWidth:"any",valueCallback:e=>e+1}),month:le({matchPatterns:is,defaultMatchWidth:"wide",parsePatterns:ls,defaultParseWidth:"any"}),day:le({matchPatterns:cs,defaultMatchWidth:"wide",parsePatterns:us,defaultParseWidth:"any"}),dayPeriod:le({matchPatterns:ds,defaultMatchWidth:"any",parsePatterns:fs,defaultParseWidth:"any"})},Ye={code:"es",formatDistance:_o,formatLong:Ho,formatRelative:Xo,localize:es,match:ms,options:{weekStartsOn:1,firstWeekContainsDate:1}},ce=typeof document<"u"?f.useLayoutEffect:()=>{},V=e=>{var t;return(t=e?.ownerDocument)!==null&&t!==void 0?t:document},nt=e=>e&&"window"in e&&e.window===e?e:V(e).defaultView||window;function hs(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function bs(e){return hs(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let ps=!1;function mt(){return ps}function Zt(e,t){if(!mt())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let r=t;for(;r!==null;){if(r===e)return!0;r.tagName==="SLOT"&&r.assignedSlot?r=r.assignedSlot.parentNode:bs(r)?r=r.host:r=r.parentNode}return!1}const ne=(e=document)=>{var t;if(!mt())return e.activeElement;let r=e.activeElement;for(;r&&"shadowRoot"in r&&(!((t=r.shadowRoot)===null||t===void 0)&&t.activeElement);)r=r.shadowRoot.activeElement;return r};function je(e){return mt()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}class gs{get currentNode(){return this._currentNode}set currentNode(t){if(!Zt(this.root,t))throw new Error("Cannot set currentNode to a node that is not contained by the root node.");const r=[];let n=t,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 Zt(t,r)?(r&&(this.currentNode=r),r):(this.currentNode=t,null)}lastChild(){let r=this._walkerStack[0].lastChild();return r&&(this.currentNode=r),r}nextNode(){const t=this._walkerStack[0].nextNode();if(t){if(t.shadowRoot){var r;let 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 c=this._doc.createTreeWalker(u,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(c),NodeFilter.FILTER_ACCEPT}else{var i;if(typeof this.filter=="function")return this.filter(a);if(!((i=this.filter)===null||i===void 0)&&i.acceptNode)return this.filter.acceptNode(a);if(this.filter===null)return NodeFilter.FILTER_ACCEPT}}return NodeFilter.FILTER_SKIP},this._doc=t,this.root=r,this.filter=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 vs(e,t,r,n){return mt()?new gs(e,t,r,n):e.createTreeWalker(t,r,n)}function er(e){if(xs())e.focus({preventScroll:!0});else{let t=ws(e);e.focus(),ys(t)}}let Ge=null;function xs(){if(Ge==null){Ge=!1;try{document.createElement("div").focus({get preventScroll(){return Ge=!0,!0}})}catch{}}return Ge}function ws(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 ys(e){for(let{element:t,scrollTop:r,scrollLeft:n}of e)t.scrollTop=r,t.scrollLeft=n}function ht(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let r=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(r)&&r.some(n=>e.test(n.brand))||e.test(window.navigator.userAgent)}function Pt(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function fe(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Ot=fe(function(){return Pt(/^Mac/i)}),ks=fe(function(){return Pt(/^iPhone/i)}),Ns=fe(function(){return Pt(/^iPad/i)||Ot()&&navigator.maxTouchPoints>1}),Es=fe(function(){return ks()||Ns()});fe(function(){return Ot()||Es()});fe(function(){return ht(/AppleWebKit/i)&&!Cr()});const Cr=fe(function(){return ht(/Chrome/i)}),jr=fe(function(){return ht(/Android/i)});fe(function(){return ht(/Firefox/i)});let be=new Map,Nt=new Set;function tr(){if(typeof window>"u")return;function e(n){return"propertyName"in n}let t=n=>{if(!e(n)||!n.target)return;let o=be.get(n.target);o||(o=new Set,be.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=be.get(n.target);if(o&&(o.delete(n.propertyName),o.size===0&&(n.target.removeEventListener("transitioncancel",r),be.delete(n.target)),be.size===0)){for(let s of Nt)s();Nt.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",r)}typeof document<"u"&&(document.readyState!=="loading"?tr():document.addEventListener("DOMContentLoaded",tr));function $s(){for(const[e]of be)"isConnected"in e&&!e.isConnected&&be.delete(e)}function Cs(e){requestAnimationFrame(()=>{$s(),be.size===0?e():Nt.add(e)})}function js(e){return e.pointerType===""&&e.isTrusted?!0:jr()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}const Ss=typeof Element<"u"&&"checkVisibility"in Element.prototype;function Ts(e){const t=nt(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 Ms(e,t){return!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&(e.nodeName==="DETAILS"&&t&&t.nodeName!=="SUMMARY"?e.hasAttribute("open"):!0)}function Ft(e,t){return Ss?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&Ts(e)&&Ms(e,t)&&(!e.parentElement||Ft(e.parentElement,e))}const Lt=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable^="false"])',"permission"],Ds=Lt.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Lt.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const Ps=Lt.join(':not([hidden]):not([tabindex="-1"]),');function Os(e){return e.matches(Ds)&&Ft(e)&&!Sr(e)}function Fs(e){return e.matches(Ps)&&Ft(e)&&!Sr(e)}function Sr(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}let Ls=!1,Be=null,Rs=new Set,Ae=new Map,Ne=!1,Et=!1;function Rt(e,t){for(let r of Rs)r(e,t)}function As(e){return!(e.metaKey||!Ot()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function ot(e){Ne=!0,As(e)&&(Be="keyboard",Rt("keyboard",e))}function ee(e){Be="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(Ne=!0,Rt("pointer",e))}function Tr(e){js(e)&&(Ne=!0,Be="virtual")}function Mr(e){e.target===window||e.target===document||Ls||!e.isTrusted||(!Ne&&!Et&&(Be="virtual",Rt("virtual",e)),Ne=!1,Et=!1)}function Dr(){Ne=!1,Et=!0}function rr(e){if(typeof window>"u"||typeof document>"u"||Ae.get(nt(e)))return;const t=nt(e),r=V(e);let n=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Ne=!0,n.apply(this,arguments)},r.addEventListener("keydown",ot,!0),r.addEventListener("keyup",ot,!0),r.addEventListener("click",Tr,!0),t.addEventListener("focus",Mr,!0),t.addEventListener("blur",Dr,!1),typeof PointerEvent<"u"?(r.addEventListener("pointerdown",ee,!0),r.addEventListener("pointermove",ee,!0),r.addEventListener("pointerup",ee,!0)):process.env.NODE_ENV==="test"&&(r.addEventListener("mousedown",ee,!0),r.addEventListener("mousemove",ee,!0),r.addEventListener("mouseup",ee,!0)),t.addEventListener("beforeunload",()=>{Pr(e)},{once:!0}),Ae.set(t,{focus:n})}const Pr=(e,t)=>{const r=nt(e),n=V(e);t&&n.removeEventListener("DOMContentLoaded",t),Ae.has(r)&&(r.HTMLElement.prototype.focus=Ae.get(r).focus,n.removeEventListener("keydown",ot,!0),n.removeEventListener("keyup",ot,!0),n.removeEventListener("click",Tr,!0),r.removeEventListener("focus",Mr,!0),r.removeEventListener("blur",Dr,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",ee,!0),n.removeEventListener("pointermove",ee,!0),n.removeEventListener("pointerup",ee,!0)):process.env.NODE_ENV==="test"&&(n.removeEventListener("mousedown",ee,!0),n.removeEventListener("mousemove",ee,!0),n.removeEventListener("mouseup",ee,!0)),Ae.delete(r))};function Ws(e){const t=V(e);let r;return t.readyState!=="loading"?rr(e):(r=()=>{rr(e)},t.addEventListener("DOMContentLoaded",r)),()=>Pr(e,r)}typeof document<"u"&&Ws();function Or(){return Be}function _s(e){const t=V(e),r=ne(t);if(Or()==="virtual"){let n=r;Cs(()=>{ne(t)===n&&e.isConnected&&er(e)})}else er(e)}const nr=f.createContext(null),$t="react-aria-focus-scope-restore";let z=null;function Ys(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(nr)||{},c=f.useMemo(()=>new jt({scopeRef:i}),[i]);ce(()=>{let h=u||B.root;if(B.getTreeNode(h.scopeRef)&&z&&!st(z,h.scopeRef)){let p=B.getTreeNode(z);p&&(h=p)}h.addChild(c),B.addNode(c)},[c,u]),ce(()=>{let h=B.getTreeNode(i);h&&(h.contain=!!r)},[r]),ce(()=>{var h;let p=(h=s.current)===null||h===void 0?void 0:h.nextSibling,b=[],x=v=>v.stopPropagation();for(;p&&p!==a.current;)b.push(p),p.addEventListener($t,x),p=p.nextSibling;return i.current=b,()=>{for(let v of b)v.removeEventListener($t,x)}},[t]),qs(i,n,r),Hs(i,r),Xs(i,n,r),Bs(i,o),f.useEffect(()=>{const h=ne(V(i.current?i.current[0]:void 0));let p=null;if(te(h,i.current)){for(let b of B.traverse())b.scopeRef&&te(h,b.scopeRef.current)&&(p=b);p===B.getTreeNode(i)&&(z=p.scopeRef)}},[i]),ce(()=>()=>{var h,p,b;let x=(b=(p=B.getTreeNode(i))===null||p===void 0||(h=p.parent)===null||h===void 0?void 0:h.scopeRef)!==null&&b!==void 0?b:null;(i===z||st(i,z))&&(!x||B.getTreeNode(x))&&(z=x),B.removeTreeNode(i)},[i]);let d=f.useMemo(()=>Is(i),[]),m=f.useMemo(()=>({focusManager:d,parentNode:c}),[c,d]);return f.createElement(nr.Provider,{value:m},f.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:s}),t,f.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:a}))}function Is(e){return{focusNext(t={}){let r=e.current,{from:n,tabbable:o,wrap:s,accept:a}=t;var i;let u=n||ne(V((i=r[0])!==null&&i!==void 0?i:void 0)),c=r[0].previousElementSibling,d=we(r),m=pe(d,{tabbable:o,accept:a},r);m.currentNode=te(u,r)?u:c;let h=m.nextNode();return!h&&s&&(m.currentNode=c,h=m.nextNode()),h&&ue(h,!0),h},focusPrevious(t={}){let r=e.current,{from:n,tabbable:o,wrap:s,accept:a}=t;var i;let u=n||ne(V((i=r[0])!==null&&i!==void 0?i:void 0)),c=r[r.length-1].nextElementSibling,d=we(r),m=pe(d,{tabbable:o,accept:a},r);m.currentNode=te(u,r)?u:c;let h=m.previousNode();return!h&&s&&(m.currentNode=c,h=m.previousNode()),h&&ue(h,!0),h},focusFirst(t={}){let r=e.current,{tabbable:n,accept:o}=t,s=we(r),a=pe(s,{tabbable:n,accept:o},r);a.currentNode=r[0].previousElementSibling;let i=a.nextNode();return i&&ue(i,!0),i},focusLast(t={}){let r=e.current,{tabbable:n,accept:o}=t,s=we(r),a=pe(s,{tabbable:n,accept:o},r);a.currentNode=r[r.length-1].nextElementSibling;let i=a.previousNode();return i&&ue(i,!0),i}}}function we(e){return e[0].parentElement}function Le(e){let t=B.getTreeNode(z);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function zs(e){if(e.checked)return!0;let t=[];if(!e.form)t=[...V(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 Hs(e,t){let r=f.useRef(void 0),n=f.useRef(void 0);ce(()=>{let o=e.current;if(!t){n.current&&(cancelAnimationFrame(n.current),n.current=void 0);return}const s=V(o?o[0]:void 0);let a=c=>{if(c.key!=="Tab"||c.altKey||c.ctrlKey||c.metaKey||!Le(e)||c.isComposing)return;let d=ne(s),m=e.current;if(!m||!te(d,m))return;let h=we(m),p=pe(h,{tabbable:!0},m);if(!d)return;p.currentNode=d;let b=c.shiftKey?p.previousNode():p.nextNode();b||(p.currentNode=c.shiftKey?m[m.length-1].nextElementSibling:m[0].previousElementSibling,b=c.shiftKey?p.previousNode():p.nextNode()),c.preventDefault(),b&&ue(b,!0)},i=c=>{(!z||st(z,e))&&te(je(c),e.current)?(z=e,r.current=je(c)):Le(e)&&!ye(je(c),e)?r.current?r.current.focus():z&&z.current&&Ct(z.current):Le(e)&&(r.current=je(c))},u=c=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{let d=Or(),m=(d==="virtual"||d===null)&&jr()&&Cr(),h=ne(s);if(!m&&h&&Le(e)&&!ye(h,e)){z=e;let b=je(c);if(b&&b.isConnected){var p;r.current=b,(p=r.current)===null||p===void 0||p.focus()}else z.current&&Ct(z.current)}})};return s.addEventListener("keydown",a,!1),s.addEventListener("focusin",i,!1),o?.forEach(c=>c.addEventListener("focusin",i,!1)),o?.forEach(c=>c.addEventListener("focusout",u,!1)),()=>{s.removeEventListener("keydown",a,!1),s.removeEventListener("focusin",i,!1),o?.forEach(c=>c.removeEventListener("focusin",i,!1)),o?.forEach(c=>c.removeEventListener("focusout",u,!1))}},[e,t]),ce(()=>()=>{n.current&&cancelAnimationFrame(n.current)},[n])}function Fr(e){return ye(e)}function te(e,t){return!e||!t?!1:t.some(r=>r.contains(e))}function ye(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:r}of B.traverse(B.getTreeNode(t)))if(r&&te(e,r.current))return!0;return!1}function st(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 ue(e,t=!1){if(e!=null&&!t)try{_s(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function Lr(e,t=!0){let r=e[0].previousElementSibling,n=we(e),o=pe(n,{tabbable:t},e);o.currentNode=r;let s=o.nextNode();return t&&!s&&(n=we(e),o=pe(n,{tabbable:!1},e),o.currentNode=r,s=o.nextNode()),s}function Ct(e,t=!0){ue(Lr(e,t))}function Bs(e,t){const r=f.useRef(t);f.useEffect(()=>{if(r.current){z=e;const n=V(e.current?e.current[0]:void 0);!te(ne(n),z.current)&&e.current&&Ct(e.current)}r.current=!1},[e])}function qs(e,t,r){ce(()=>{if(t||r)return;let n=e.current;const o=V(n?n[0]:void 0);let s=a=>{let i=je(a);te(i,e.current)?z=e:Fr(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 or(e){let t=B.getTreeNode(z);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Xs(e,t,r){const n=f.useRef(typeof document<"u"?ne(V(e.current?e.current[0]:void 0)):null);ce(()=>{let o=e.current;const s=V(o?o[0]:void 0);if(!t||r)return;let a=()=>{(!z||st(z,e))&&te(ne(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]),ce(()=>{const o=V(e.current?e.current[0]:void 0);if(!t)return;let s=a=>{if(a.key!=="Tab"||a.altKey||a.ctrlKey||a.metaKey||!Le(e)||a.isComposing)return;let i=o.activeElement;if(!ye(i,e)||!or(e))return;let u=B.getTreeNode(e);if(!u)return;let c=u.nodeToRestore,d=pe(o.body,{tabbable:!0});d.currentNode=i;let m=a.shiftKey?d.previousNode():d.nextNode();if((!c||!c.isConnected||c===o.body)&&(c=void 0,u.nodeToRestore=void 0),(!m||!ye(m,e))&&c){d.currentNode=c;do m=a.shiftKey?d.previousNode():d.nextNode();while(ye(m,e));a.preventDefault(),a.stopPropagation(),m?ue(m,!0):Fr(c)?ue(c,!0):i.blur()}};return r||o.addEventListener("keydown",s,!0),()=>{r||o.removeEventListener("keydown",s,!0)}},[e,t,r]),ce(()=>{const o=V(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,c=ne(o);if(t&&u&&(c&&ye(c,e)||c===o.body&&or(e))){let d=B.clone();requestAnimationFrame(()=>{if(o.activeElement===o.body){let m=d.getTreeNode(e);for(;m;){if(m.nodeToRestore&&m.nodeToRestore.isConnected){sr(m.nodeToRestore);return}m=m.parent}for(m=d.getTreeNode(e);m;){if(m.scopeRef&&m.scopeRef.current&&B.getTreeNode(m.scopeRef)){let h=Lr(m.scopeRef.current,!0);sr(h);return}m=m.parent}}})}}}},[e,t])}function sr(e){e.dispatchEvent(new CustomEvent($t,{bubbles:!0,cancelable:!0}))&&ue(e)}function pe(e,t,r){let n=t?.tabbable?Fs:Os,o=e?.nodeType===Node.ELEMENT_NODE?e:null,s=V(o),a=vs(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"&&(!zs(i)||a.currentNode.tagName==="INPUT"&&a.currentNode.type==="radio"&&a.currentNode.name===i.name)?NodeFilter.FILTER_REJECT:n(i)&&(!r||te(i,r))&&(!t?.accept||t.accept(i))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(a.currentNode=t.from),a}class At{get size(){return this.fastMap.size}getTreeNode(t){return this.fastMap.get(t)}addTreeNode(t,r,n){let o=this.fastMap.get(r??null);if(!o)return;let s=new jt({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&&te(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 At;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 jt({scopeRef:null}),this.fastMap.set(null,this.root)}}class jt{addChild(t){this.children.add(t),t.parent=this}removeChild(t){this.children.delete(t),t.parent=void 0}constructor(t){this.children=new Set,this.contain=!1,this.scopeRef=t.scopeRef}}let B=new At;const qe=({children:e,node:t})=>dr.createPortal(e,t??document.body),Rr=({children:e,customTrigger:t,triggerContent:r,align:n="start",side:o="bottom",offset:s=8,className:a,triggerClassName:i,closeOnEscape:u=!0,closeOnClickAway:c=!0,scrollerId:d,onOpen:m,onClose:h,maxHeight:p="400px",minWidth:b="200px",maxWidth:x="500px"})=>{const{triggerRef:v,triggerProps:$,popoverRef:C,getPopoverPosition:R,open:j,toggle:T,close:y}=ct({align:n,side:o,offset:s,scrollerId:d,onOpen:()=>{m?.()},onClose:()=>{h?.()}});xr({Escape:P=>{u&&(P.preventDefault(),y(),v.current?.focus())}},{enabled:j}),ut(C,P=>{!c||!v.current||!j||!P.target||v.current.contains(P.target)||y()});const N=R();return l.jsxs(l.Fragment,{children:[t?t({triggerRef:v,triggerProps:$,toggle:T,open:j,close:y}):l.jsx("button",{ref:v,...$,onClick:T,className:k("outline-none p-2 rounded-md transition-colors","hover:bg-base-3 focus-visible:bg-base-3 focus-visible:ring-2 focus-visible:ring-brand",i),children:r}),l.jsx(A.AnimatePresence,{children:j&&l.jsx(qe,{children:l.jsx(Ys,{contain:!0,restoreFocus:!0,autoFocus:!0,children:l.jsx(A.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:N.x,top:N.top,bottom:N.bottom,maxHeight:typeof p=="number"?`${p}px`:p,minWidth:typeof b=="number"?`${b}px`:b,maxWidth:typeof x=="number"?`${x}px`:x,zIndex:1e3},className:k("bg-base-1 dark-theme:bg-base-2","border border-base-4 rounded-6","customscrollbar overflow-auto",a),children:typeof e=="function"?e(T):e})})})})]})},Vs=({title:e,subtitle:t,onClose:r,className:n})=>l.jsx("div",{className:k("p-4 border-b border-base-4",n),children:l.jsxs("div",{className:"flex items-start justify-between",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"font-semibold text-base-12",children:e}),t&&l.jsx("p",{className:"text-sm text-base-11 mt-1",children:t})]}),r&&l.jsx("button",{onClick:r,className:"ml-4 text-base-11 hover:text-base-12 transition-colors",children:"×"})]})}),Ks=({children:e,className:t})=>l.jsx("div",{className:k("p-4",t),children:e}),Us=({children:e,className:t})=>l.jsx("div",{className:k("p-4 border-t border-base-4",t),children:e}),Gs=(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(ke(s,"EEE",{locale:e??Nr}))}return t?[...n.slice(1),n[0]]:n},Wt=({selectedDate:e,onDateSelect:t,disabledDates:r,disabledDaysOfWeek:n,minDate:o,maxDate:s,locale:a,weekStartsOnMonday:i=!0,className:u=""})=>{const[c,d]=f.useState(e||new Date),[m,h]=f.useState(e||new Date),p=f.useRef(null),b=f.useMemo(()=>r?new Set(r.map(y=>new Date(y).toDateString())):new Set,[r]),x=f.useMemo(()=>new Set(n||[]),[n]),v=f.useMemo(()=>{const y=_n(c),N=Rn(c),P=new Date(y),O=new Date(N);if(i){const E=y.getDay(),g=E===0?6:E-1;P.setDate(y.getDate()-g);const S=N.getDay(),M=S===0?0:7-S;O.setDate(N.getDate()+M)}else P.setDate(y.getDate()-y.getDay()),O.setDate(N.getDate()+(6-N.getDay()));return Wn({start:P,end:O})},[c,i]),$=f.useMemo(()=>Gs(a??Ye,i),[a,i]),C=y=>{const N=y.toDateString(),P=y.getDay();return!(b.has(N)||x.has(P)||o&&y<o||s&&y>s)},R=y=>{C(y)&&t&&t(y),h(y)},j=y=>{if(!m)return;let N=new Date(m),P=!0,O,E;switch(y.key){case"ArrowUp":N.setDate(N.getDate()-7);break;case"ArrowDown":N.setDate(N.getDate()+7);break;case"ArrowLeft":N.setDate(N.getDate()-1);break;case"ArrowRight":N.setDate(N.getDate()+1);break;case"Home":O=N.getDay(),N.setDate(N.getDate()-O);break;case"End":E=N.getDay(),N.setDate(N.getDate()+(6-E));break;case"PageUp":N=y.shiftKey?wt(N,12):wt(N,1);break;case"PageDown":N=y.shiftKey?Ze(N,12):Ze(N,1);break;case"Enter":case" ":C(m)&&t&&t(m);break;default:P=!1}P&&(y.preventDefault(),N.getTime()!==m.getTime()&&(h(N),Jt(N,c)||d(N)))},T=y=>{d(N=>y==="prev"?wt(N,1):Ze(N,1))};return l.jsxs("div",{ref:p,className:k("dark-theme:bg-base-3 border border-base-5 dark-theme:border-base-4 rounded-6 px-4 pt-3 pb-4 w-full lg:w-80",u),onKeyDown:j,tabIndex:0,role:"grid","aria-label":"Calendar",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(G,{onClick:()=>T("prev"),size:"iconSm","aria-label":"Previous month",children:l.jsx(Y.ChevronLeft,{size:16})}),l.jsx("h2",{className:"text-sm font-medium",children:ke(c,"MMMM yyyy")}),l.jsx(G,{onClick:()=>T("next"),size:"iconSm","aria-label":"Next month",children:l.jsx(Y.ChevronRight,{size:16})})]}),l.jsx("div",{className:"grid grid-cols-7 gap-1 mt-4",role:"row",children:$.map(y=>l.jsx("div",{className:"text-xs flex items-center w-8 justify-center text-base-11",role:"columnheader",children:y},y))}),l.jsx("div",{className:"grid grid-cols-7 gap-1 mt-4",role:"grid",children:v.map((y,N)=>{const P=Jt(y,c),O=e?xt(y,e):!1,E=m&&xt(y,m),g=C(y),S=xt(y,new Date);return l.jsx("button",{onClick:()=>R(y),disabled:!g,tabIndex:E?0:-1,role:"gridcell","aria-label":`${y.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}${O?", selected":""}${g?"":", disabled"}`,"aria-selected":O,"aria-disabled":!g,className:k("h-8 w-8 flex items-center outline-none justify-center rounded-6 hover:bg-base-4 text-sm relative",P?O?"bg-brand text-brand-text hover:bg-brand":S?"text-base-12 ring-1 ring-base-8":"text-base-12":"text-base-9",E&&"ring-1 ring-base-6",(!g||!P)&&"pointer-events-none text-base-9"),children:ke(y,"d")},N)})})]})},Qs=()=>{const[e,t]=f.useState(new Date(2025,8,21)),r=["2025-09-13T00:00:00Z","2025-09-15T00:00:00Z"],n=[0,6];return l.jsx("div",{className:"p-8 bg-gray-100 min-h-screen",children:l.jsxs("div",{className:"max-w-md mx-auto",children:[l.jsx("h1",{className:"text-2xl font-bold mb-6 text-gray-800",children:"Calendar Date Picker Demo"}),l.jsx("div",{className:"mb-6",children:l.jsx(Wt,{selectedDate:e,onDateSelect:t,disabledDates:r,disabledDaysOfWeek:n,minDate:new Date(2025,8,1),maxDate:new Date(2025,11,31)})}),e&&l.jsxs("div",{className:"bg-white p-4 rounded-lg shadow",children:[l.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Selected Date:"}),l.jsx("p",{className:"text-gray-600",children:e.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),l.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["ISO: ",e.toISOString()]})]}),l.jsxs("div",{className:"mt-6 bg-white p-4 rounded-lg shadow",children:[l.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Keyboard Navigation:"}),l.jsxs("div",{className:"text-sm text-gray-600 space-y-1",children:[l.jsxs("p",{children:[l.jsx("strong",{children:"Arrow Keys:"})," Navigate between dates"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Enter/Space:"})," Select focused date"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Home/End:"})," Go to start/end of week"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Page Up/Down:"})," Previous/next month"]}),l.jsxs("p",{children:[l.jsx("strong",{children:"Shift + Page Up/Down:"})," Previous/next year"]})]})]}),l.jsxs("div",{className:"mt-4 bg-white p-4 rounded-lg shadow",children:[l.jsx("h3",{className:"font-semibold text-gray-800 mb-2",children:"Features:"}),l.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[l.jsx("li",{children:"✅ All dates enabled by default"}),l.jsx("li",{children:"✅ Disable specific dates (PostgreSQL ISO strings)"}),l.jsx("li",{children:"✅ Disable entire days of week (e.g., weekends)"}),l.jsx("li",{children:"✅ Min/max date constraints"}),l.jsx("li",{children:"✅ Full keyboard navigation with arrow keys"}),l.jsx("li",{children:"✅ Focus management and accessibility"})]})]})]})})};function Js({customTrigger:e,scrollerId:t}){const[r,n]=f.useState(new Date);return l.jsx(Rr,{className:"p-0",scrollerId:t,customTrigger:({toggle:o,triggerRef:s})=>e?e(o,s):l.jsxs(G,{ref:s,onClick:o,color:"solid",className:"px-3 mt-1 w-full justify-start",children:[ke(new Date,"PP",{locale:Ye}),l.jsx("span",{className:"grow"}),l.jsx(Y.CalendarDays,{size:18,className:"text-base-11"})]}),children:o=>l.jsx(Wt,{selectedDate:r,onDateSelect:s=>{n(s),o()},className:"border-none",disabledDaysOfWeek:[0,6]})})}const Zs=()=>l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Time"}),l.jsxs(G,{color:"solid",className:"px-3 mt-1",children:[ke(new Date,"p",{locale:Ye}),l.jsx("span",{className:"grow"}),l.jsx(Y.Clock,{size:18,className:"text-base-11"})]})]}),ea=()=>l.jsxs("div",{className:"flex items-center gap-x-4",children:[l.jsxs("div",{className:"grow",children:[l.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Date"}),l.jsxs(G,{color:"solid",className:"px-3 mt-1 w-full justify-start",children:[ke(new Date,"PP",{locale:Ye}),l.jsx("span",{className:"grow"}),l.jsx(Y.CalendarDays,{size:18,className:"text-base-11"})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium ml-0.5",children:"Start Time"}),l.jsxs(G,{color:"solid",className:"px-3 mt-1",children:[ke(new Date,"p",{locale:Ye}),l.jsx("span",{className:"grow"}),l.jsx(Y.Clock,{size:18,className:"text-base-11"})]})]})]}),Qe={unchecked:"bg-base-3 lg:hover:bg-base-4",checked:"bg-brand lg:hover:bg-brand-hover text-brand-text",uncheckedDisabled:"bg-base-3 border-base-4",checkedDisabled:"bg-base-3 border-base-4 text-base-10"},Ar=f.forwardRef(({checked:e=!1,onCheckedChange:t,disabled:r=!1,required:n=!1,name:o,value:s,id:a,className:i="",size:u="sm",...c},d)=>{const m=()=>{r||t?.(e==="indeterminate"?!0:!e)},h=x=>{(x.key===" "||x.key==="Enter")&&(x.preventDefault(),m())},p={xs:"h-3.5 w-3.5",sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},b={xs:24,sm:12,md:14,lg:16};return l.jsxs(l.Fragment,{children:[l.jsxs("button",{ref:d,type:"button",role:"checkbox","aria-checked":e==="indeterminate"?"mixed":e,"aria-required":n,disabled:r,onClick:m,onKeyDown:h,className:k("inline-flex items-center justify-center rounded-2 border border-base-4 transition-all duration-200 ease-in-out","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-base-5",p[u],r&&"cursor-not-allowed opacity-75",!r&&"cursor-pointer",e?r?Qe.checkedDisabled:Qe.checked:r?Qe.uncheckedDisabled:Qe.unchecked,typeof i=="function"?i(e):i),...c,children:[e===!0&&l.jsx(Y.Check,{size:b[u],className:"stroke-current"}),e==="indeterminate"&&l.jsx(Y.Minus,{size:b[u],className:"stroke-current"})]}),l.jsx("input",{type:"checkbox",name:o,value:s,checked:e===!0,onChange:()=>{},disabled:r,required:n,id:a,className:"sr-only",tabIndex:-1})]})});Ar.displayName="Checkbox";const ta=({scrollY:e,height:t=300,className:r,children:n})=>{const o=A.useTransform(e,a=>a<0?1+Math.abs(a)/t:1),s=A.useTransform(e,a=>a<0?-Math.abs(a)/2:0);return l.jsx(A.motion.div,{style:{scale:o,y:s,height:t},className:r,children:n})};function Wr(e,t,r){function n(i,u){var c;Object.defineProperty(i,"_zod",{value:i._zod??{},enumerable:!1}),(c=i._zod).traits??(c.traits=new Set),i._zod.traits.add(e),t(i,u);for(const d in a.prototype)d in i||Object.defineProperty(i,d,{value:a.prototype[d].bind(i)});i._zod.constr=a,i._zod.def=u}const o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function a(i){var u;const c=r?.Parent?new s:this;n(c,i),(u=c._zod).deferred??(u.deferred=[]);for(const d of c._zod.deferred)d();return c}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:i=>r?.Parent&&i instanceof r.Parent?!0:i?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class ra extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const na={};function _r(e){return na}function oa(e,t){return typeof t=="bigint"?t.toString():t}const Yr=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Je(e){return typeof e=="string"?e:e?.message}function Ir(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Je(e.inst?._zod.def?.error?.(e))??Je(t?.error?.(e))??Je(r.customError?.(e))??Je(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}const zr=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,oa,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},sa=Wr("$ZodError",zr),Hr=Wr("$ZodError",zr,{Parent:Error}),aa=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 ra;if(a.issues.length){const i=new(o?.Err??e)(a.issues.map(u=>Ir(u,s,_r())));throw Yr(i,o?.callee),i}return a.value},ia=aa(Hr),la=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=>Ir(u,s,_r())));throw Yr(i,o?.callee),i}return a.value},ca=la(Hr);function ar(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function ua(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,c=u&&u[n.code];r[a]=J.appendErrors(a,t,r,o,c?[].concat(c,n.message):n.message)}e.shift()}return r}function da(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,c=u&&u[n.code];r[a]=J.appendErrors(a,t,r,o,c?[].concat(c,n.message):n.message)}e.shift()}return r}function fa(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(ar(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(a){return s.shouldUseNativeValidation&&Ue.validateFieldsNatively({},s),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(i){return Array.isArray(i?.issues)})(a))return{values:{},errors:Ue.toNestErrors(ua(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(ar(function(){return Promise.resolve((r.mode==="sync"?ia:ca)(e,n,t)).then(function(a){return s.shouldUseNativeValidation&&Ue.validateFieldsNatively({},s),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(i){return i instanceof sa})(a))return{values:{},errors:Ue.toNestErrors(da(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 ma({methods:e,onSubmit:t,onError:r,children:n,logErrors:o,className:s}){return l.jsx(J.FormProvider,{...e,children:l.jsx("form",{className:k("mt-4 lg:mt-8 grid grid-cols-1 lg:grid-cols-2 gap-4 lg:gap-8 relative",s),onSubmit:e.handleSubmit((a,i)=>t(a,i),a=>{o&&console.log(a),r?.(a)}),children:n})})}function ha(e,t){return J.useForm({resolver:fa(e),defaultValues:t})}const Br=({children:e,size:t=24,strokeWidth:r=2,viewBox:n="0 0 24 24",className:o,...s})=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:n,className:o,...s,children:e}),ba={solid:"bg-base-3 border border-base-4 drop-shadow-sm dark-theme:drop-shadow-none",outline:"border border-base-6"},pa={brand:"ring-1 ring-brand",solid:"ring-1 ring-base-6"},_t=f.forwardRef(({label:e,description:t,labelPosition:r="default",color:n="solid",focusColor:o="brand",placeholder:s,valid:a,error:i,errorMessage:u,isPrice:c,prefix:d,wrapperClassName:m,containerClassName:h,className:p,type:b="text",value:x,...v},$)=>{const C=f.useRef(null),R=f.useRef(!1),[j,T]=f.useState(!1),[y,N]=f.useState(!1),P=b==="password",O=P&&j?"text":c?"number":b,E=x!==""&&x!==null&&x!==void 0;return f.useEffect(()=>{if(!R.current){R.current=!0;return}C.current&&hr(C.current)},[j,C]),l.jsxs("div",{className:k("relative",m),children:[e&&r==="default"&&l.jsx("label",{className:k("font-medium ml-0.5 text-xs",i&&"text-red-9"),children:e}),l.jsxs("div",{className:k("rounded-6 transition cursor-text relative",ba[n],{"pt-[22px] pb-1.5":r==="floating",[pa[o]]:!i&&y,"bg-red-4 text-red-9":!!i,"ring-1 ring-red-9":!!i&&y},h),children:[e&&r==="floating"&&l.jsx("label",{className:k("absolute transition-all duration-200 pointer-events-none","text-sm top-[18px] font-semibold left-3",{"text-xs top-2.5":y||E||s,"text-red-9":!!i}),children:e}),c&&l.jsx(Y.DollarSign,{size:16,className:k("absolute top-1/2 -translate-y-1/2 left-3",i?"text-red-9":"text-base-11")}),d&&l.jsx("p",{className:"text-sm text-base-11 absolute top-1/2 -translate-y-1/2 left-3",children:d}),l.jsx("input",{ref:g=>{$&&(typeof $=="function"?$(g):$.current=g),C.current=g},type:O,className:k("w-full bg-transparent focus-visible:outline-none","placeholder:text-sm text-sm placeholder:text-base-11",c||d?"pl-9":"pl-3",{"py-2.5":r==="default","mt-1.5":r==="floating","pr-10":a,"text-red-9 placeholder:text-red-9":!!i},p),value:x,placeholder:s,onFocus:()=>N(!0),onBlur:()=>N(!1),...v})]}),a?l.jsx(Y.CheckIcon,{size:20,className:`absolute top-1/2 -translate-y-1/2 text-green-500 ${P?"right-10":"right-3"}`}):null,P&&l.jsx("button",{type:"button",className:k(r==="floating"?"absolute right-3 top-1/2 -translate-y-1/2":"absolute right-3 top-10"),onClick:()=>{T(!j)},children:j?l.jsx(Y.EyeOffIcon,{size:20,className:k(i?"text-red-9":"text-base-11")}):l.jsx(Y.Eye,{size:20,className:k(i?"text-red-9":"text-base-11")})}),u?l.jsx("span",{role:"alert",className:"text-red-9 text-sm mt-1 ml-0.5",children:u}):t?l.jsx("p",{className:"text-xs text-base-11 mt-1 ml-0.5",children:t}):null]})});_t.displayName="Input";const ga=({name:e,customRead:t,customSet:r,withNullSet:n=!0,...o})=>{const{control:s}=J.useFormContext(),a=f.useCallback(u=>t?t(u):u===null?Mt(u):u,[t]),i=f.useCallback(u=>r?n&&u===null?et(u):r(u):u===null?et(u):u,[r]);return s?l.jsx(J.Controller,{name:e,control:s,render:({field:u,fieldState:c})=>l.jsx(_t,{value:a(u.value),onChange:d=>u.onChange(i(d.target.value)),error:!!c.error,errorMessage:c.error?.message,ref:u.ref,...o})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},qr=f.createContext(null),va=({children:e,value:t})=>l.jsx(qr.Provider,{value:t,children:e}),xa=()=>{const e=f.useContext(qr);if(!e)throw new Error("useAliveScope must be wrapped within AliveScopeProvider");return e},wa=({children:e})=>{const[t,r]=f.useState({}),n=f.useRef({}),o=f.useRef({}),s=(i,u,c)=>{if(!t[i]){const d=document.createElement("div");return i&&(d.id=i),c&&(d.className=c),r(m=>({...m,[i]:{children:u,element:d}})),n.current[i]=[],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 c={...u};return delete c[i],c}),o.current&&o.current[i]&&o.current[i].forEach(u=>u(i))};return l.jsxs(va,{value:{getPortalElement:s,dropPortalElement:a},children:[e,Object.entries(t).map(([i,{children:u,element:c}])=>l.jsx(ka,{id:i,onMountCallbacks:n,onDropCallbacks:o,children:u,element:c},i))]})},Xr=f.createContext(null),ya=({children:e,value:t})=>l.jsx(Xr.Provider,{value:t,children:e}),ka=f.memo(({id:e,onMountCallbacks:t,onDropCallbacks:r,children:n,element:o})=>{const s=(i,u={runOnFirstMount:!1})=>{f.useEffect(()=>{const c=()=>{if(document.getElementById(e))i(e);else{const m=new MutationObserver((h,p)=>{document.getElementById(e)&&(i(e),p.disconnect())});return m.observe(document.body,{childList:!0,subtree:!0}),()=>m.disconnect()}};return u?.runOnFirstMount&&c(),t.current[e].push(c),()=>{t.current[e]=t.current[e].filter(d=>d!==c)}},[])},a=i=>{f.useEffect(()=>(r.current[e].push(i),()=>{r.current[e]=r.current[e].filter(u=>u!==i)}),[])};return l.jsx(ya,{value:{keepAliveId:e,onKeepAliveMount:s,onKeepAliveDrop:a},children:dr.createPortal(n,o,e)})}),Na=()=>{const e=f.useContext(Xr);if(!e)throw new Error("useKeepAlive must be used within KeepAliveProvider");return e},Ea=({aliveKey:e,children:t,enabled:r=!0,...n})=>{const o=f.useRef(null),{getPortalElement:s}=xa();return f.useEffect(()=>{const a=s(e,t,n.className);return r&&o.current&&o.current.replaceWith(a),()=>{}},[e,t,r,n]),l.jsx("div",{...n,ref:o,children:t})},$a=({lightSolid:e=!0,className:t,children:r,...n})=>l.jsx("div",{className:k("rounded-7 dark-theme:bg-base-3",e?"border-none bg-base-3":"border border-base-6 dark-theme:border-base-4",t),...n,children:r}),Ca=({onClick:e,lightSolid:t=!0,className:r,children:n})=>l.jsx("button",{onClick:e,className:k("w-full text-start first:rounded-t-7 last:rounded-b-7 border-b dark-theme:border-base-4","last:border-none px-3 pr-2.5 py-3 dark-theme:bg-base-3 lg:hover:bg-base-4 max-lg:active:bg-base-4","transition-colors hover:cursor-pointer flex items-center justify-between outline-none lg:focus-visible:ring-2 focus-visible:ring-base-6",t?"bg-base-3 border-base-4":"border-base-6",r),children:n}),Vr=({label:e,labelPosition:t="default",options:r,selectedValues:n,onChange:o,idExtractor:s,labelExtractor:a,customSetter:i,valid:u,error:c,placeholder:d="Select options...",maxSelections:m,searchable:h=!1,disabled:p=!1,className:b})=>{const[x,v]=f.useState(""),[$,C]=f.useState(!1),[R,j]=f.useState(-1),T=f.useRef(null),y=f.useRef(null),N=f.useRef([]),{triggerRef:P,triggerProps:O,popoverRef:E,getPopoverPosition:g,open:S,toggle:M,close:L}=ct({align:"start",side:"top",avoidCollisions:!1,onOpen:()=>{C(!0),h&&T.current&&setTimeout(()=>T.current?.focus(),10)},onClose:()=>{C(!1),v(""),j(-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,F=f.useRef(`error-${Math.random().toString(36).substr(2,9)}`).current,w=f.useRef(`listbox-${Math.random().toString(36).substr(2,9)}`).current,X=i?n.map(D=>r.find(U=>s(U)===D||s(U)===s(D))).filter(Boolean):n,se=X.length>0,K=h?r.filter(D=>a(D).toLowerCase().includes(x.toLowerCase())):r;f.useEffect(()=>{N.current=N.current.slice(0,K.length)},[K.length]);const re=D=>i?n.some(W=>W===s(D)||s(W)===s(D)):n.some(W=>s(W)===s(D)),Oe=D=>{if(!p)if(re(D)){let W;if(i){const U=s(D);W=n.filter(ve=>ve!==U&&s(ve)!==U)}else W=n.filter(U=>s(U)!==s(D));o(W),Ke(`Removed ${a(D)}`)}else{if(m&&X.length>=m){Ke(`Maximum of ${m} selections allowed`);return}let W;i?W=[...n,i(D)]:W=[...n,D],o(W),Ke(`Added ${a(D)}`)}},Xe=D=>{if(p)return;let W;if(i){const U=s(D);W=n.filter(ve=>ve!==U&&s(ve)!==U)}else W=n.filter(U=>s(U)!==s(D));o(W),Ke(`Removed ${a(D)}`)},Ve=D=>{if(!p)switch(D.key){case"Enter":D.preventDefault(),S?R>=0&&Oe(K[R]):M();break;case"Escape":D.preventDefault(),L();break;case"ArrowDown":if(D.preventDefault(),!S)M();else{const W=R>=K.length-1?0:R+1;j(W),N.current[W]?.scrollIntoView({block:"nearest"})}break;case"ArrowUp":if(D.preventDefault(),S){const W=R<=0?K.length-1:R-1;j(W),N.current[W]?.scrollIntoView({block:"nearest"})}break;case"Backspace":if(h&&x===""&&X.length>0){const W=X[X.length-1];Xe(W)}break}},an=D=>{v(D.target.value),j(-1)},ln=()=>{p||(h&&T.current&&T.current.focus(),M())},Ke=D=>{console.log(`Accessibility announcement: ${D}`)};ut(E,D=>{!P.current||!S||!D.target||P.current.contains(D.target)||L()});const pt=g();return l.jsxs("div",{className:k("relative",b),children:[l.jsxs("div",{className:"relative",ref:y,children:[t==="default"&&l.jsx("label",{className:k("top-[18px] font-medium ml-0.5 text-xs",c&&"text-red-9"),children:e}),l.jsxs("div",{ref:P,...O,className:k("relative rounded-6 px-2 transition cursor-pointer pr-10 min-h-[48px]","border border-base-4 light-theme:drop-shadow-sm dark-theme:bg-base-3",{"py-3":t==="default","pt-5 pb-2":t==="floating","ring-1 ring-brand":S||$,"text-red-9":c,"ring-2 ring-red-6":c&&(S||$),"opacity-60 cursor-not-allowed":p}),onClick:ln,role:"combobox","aria-expanded":S,"aria-haspopup":"listbox","aria-owns":w,"aria-labelledby":q,"aria-describedby":c?F:void 0,onKeyDown:Ve,tabIndex:p?-1:0,children:[t==="floating"&&l.jsxs("label",{id:q,htmlFor:I,className:k("absolute transition-all duration-200 pointer-events-none","text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":$||se,"text-red-9":!!c}),children:[e," ",m&&`(${n.length}/${m})`]}),l.jsxs("div",{className:k("flex flex-wrap gap-2 items-center",{"mt-2.5":t==="floating"}),children:[X.map(D=>l.jsxs("div",{className:k("border border-base-4 dark-theme:border-base-5 dark-theme:bg-base-4 rounded-full px-2 py-1 text-sm flex items-center gap-1",{"bg-red-4 text-red-9":c}),children:[l.jsx("span",{className:"line-clamp-1",children:a(D)}),!p&&l.jsx("button",{type:"button",className:"hover:bg-brand/20 rounded-full p-0.5 transition-colors",onClick:W=>{W.stopPropagation(),Xe(D)},"aria-label":`Remove ${a(D)}`,children:l.jsx(Y.XIcon,{size:12})})]},s(D))),h&&l.jsx("input",{ref:T,id:I,type:"text",className:"flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm",value:x,onChange:an,onKeyDown:Ve,placeholder:se?"":d,disabled:p,"aria-autocomplete":"list","aria-controls":w,autoComplete:"off"}),!h&&!se&&l.jsx("span",{className:"text-secondarytext text-sm flex-grow",children:d})]}),l.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:[u&&l.jsx(Y.CheckIcon,{size:16,className:"text-green-600"}),l.jsx(Y.ChevronDownIcon,{size:16,className:k("transition-transform text-base-11",{"rotate-180":S})})]})]})]}),l.jsx(A.AnimatePresence,{children:S&&l.jsx(qe,{children:l.jsx(A.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},ref:E,style:{position:"fixed",left:pt.x,top:pt.top,bottom:pt.bottom,width:y.current?.offsetWidth??200},className:k("bg-base-1 dark-theme:bg-base-3 border border-base-4","rounded-6 shadow-lg max-h-[300px] overflow-y-auto z-50","customscrollbarnohide"),role:"listbox",id:w,"aria-labelledby":q,children:K.length===0?l.jsx("div",{className:"px-3 py-2 text-sm text-secondarytext",children:x?"No results found":"No options available"}):K.map((D,W)=>{const U=re(D),ve=W===R;return l.jsxs("div",{ref:cn=>{N.current[W]=cn},className:k("px-3 py-2 text-sm cursor-pointer flex items-center justify-between","first:rounded-t-6 last:rounded-b-6",{"bg-base-3 dark-theme:bg-base-4":ve,"bg-brandfadedbg text-brand":U}),onClick:()=>Oe(D),role:"option","aria-selected":U,onMouseEnter:()=>j(W),children:[l.jsx("span",{children:a(D)}),U&&l.jsx(Y.CheckIcon,{size:16})]},s(D))})})})}),c&&l.jsx("p",{id:F,className:"text-red-9 text-xs mt-1","aria-live":"assertive",children:c}),l.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:X.length>0?`Selected: ${X.map(a).join(", ")}`:"No selections"})]})},ja=({name:e,...t})=>{const{control:r}=J.useFormContext();return r?l.jsx(J.Controller,{name:e,control:r,render:({field:n,fieldState:o})=>l.jsx(Vr,{selectedValues:n.value||[],onChange:s=>n.onChange(s),error:o.error?.message,...t})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},Sa={2:"text-2xl",4:"text-4xl",5:"text-5xl",6:"text-6xl"},Ta=({title:e,description:t,size:r="6",descriptionClassName:n,className:o})=>l.jsxs("div",{className:k("text-center",o),children:[l.jsx("p",{className:`${Sa[r]} font-medium`,children:e}),t?l.jsx("p",{className:k("mt-6 text-base-11",n),children:t}):null]}),Ma=({id:e,tabPage:t,absolute:r=!0,navBar:n,children:o,onRefresh:s,style:a,className:i,contentClassName:u,bounceBackDuration:c=300,showScrollbar:d=!0,onScroll:m})=>{const h=f.useRef(null),p=f.useRef(null),b=f.useRef(null),x=f.useRef(null),v=f.useRef(null),[$,C]=f.useState(!1),R=f.useRef(null),j=f.useRef({startY:0,currentY:0,maxScroll:0,lastTimestamp:0,frameCallback:null,isScrolling:!1,pullDistance:0,refreshThreshold:50,isPullingToRefresh:!1}),T=He(),y=f.useCallback(Pe(()=>{h.current&&p.current&&(j.current.maxScroll=Math.max(0,p.current.offsetHeight-h.current.offsetHeight))}),[]),N=f.useCallback(F=>{const{maxScroll:w}=j.current;return F>0?Math.pow(F,.8):F<-w?-w-Math.pow(-(F+w),.8):F},[]),P=f.useCallback(()=>{if(!d||!h.current||!x.current)return;const{currentY:F,maxScroll:w}=j.current,H=h.current.offsetHeight,X=Math.max(30,H/(H+w)*H),se=H-X;let K=-F/w*se,re=1;F>0?(K=0,re=1-F/H,x.current.style.transformOrigin="top"):F<-w?(K=se,re=1-Math.abs(F+w)/H,x.current.style.transformOrigin="bottom"):x.current.style.transformOrigin="top",x.current.style.transform=`translate3d(0, ${K}px, 0) scaleY(${re})`,x.current.style.height=`${X}px`},[d]),O=f.useCallback(F=>{if(j.current.currentY=F,p.current&&(p.current.style.transform=`translate3d(0, ${F}px, 0)`),b.current){const w=Math.max(F-j.current.refreshThreshold,-j.current.refreshThreshold);b.current.style.transform=`translate3d(0, ${w}px, 0)`}m&&m(F),P()},[P]),E=f.useCallback(F=>{const w=j.current;w.frameCallback&&(A.cancelFrame(w.frameCallback),w.frameCallback=null);const H=performance.now(),X=w.currentY,se=F-X,K=()=>{const re=performance.now()-H,Oe=Math.min(re/c,1),Xe=1-Math.pow(1-Oe,3),Ve=X+se*Xe;O(Ve),Oe>=1&&(w.frameCallback&&(A.cancelFrame(w.frameCallback),w.frameCallback=null),O(F),F===0&&b.current&&(b.current.textContent="Pull to refresh"))};w.frameCallback=A.frame.render(K,!0)},[O,c]),g=f.useCallback(F=>{const w=j.current;w.frameCallback&&(A.cancelFrame(w.frameCallback),w.frameCallback=null);let H=F,X=Date.now();const se=()=>{const K=Date.now(),re=K-X;if(X=K,H*=Math.pow(.95,re/16),w.currentY+=H*re,w.currentY>0||w.currentY<-w.maxScroll){w.frameCallback&&(A.cancelFrame(w.frameCallback),w.frameCallback=null),E(w.currentY>0?0:-w.maxScroll);return}O(w.currentY),Math.abs(H)<.01&&w.frameCallback&&(A.cancelFrame(w.frameCallback),w.frameCallback=null)};w.frameCallback=A.frame.render(se,!0)},[O,E]),S=f.useCallback(()=>{if(!d||!x.current)return;v.current!==null&&clearTimeout(v.current),requestAnimationFrame(()=>{x.current&&(x.current.style.opacity="1")});const F=window.requestIdleCallback||(w=>setTimeout(w,1e3));v.current=window.setTimeout(()=>{F(()=>{x.current&&(x.current.style.opacity="0"),v.current=null})},1e3)},[d]),M=f.useCallback(F=>{if(R.current!==null&&Date.now()-R.current<50)return;R.current=Date.now();const w=j.current;w.isScrolling=!0,w.startY=w.currentY,w.lastTimestamp=Date.now(),w.isPullingToRefresh=w.currentY===0,w.pullDistance=0,w.frameCallback&&(A.cancelFrame(w.frameCallback),w.frameCallback=null),S()},[S]),L=f.useCallback(F=>{const w=j.current;if(!w.isScrolling)return;const H=N(w.startY+F.deltaY);w.isPullingToRefresh&&H<w.startY&&(w.isPullingToRefresh=!1),O(H),s&&w.isPullingToRefresh&&!$&&H>0&&(w.pullDistance=H,b.current&&(b.current.textContent=w.pullDistance>w.refreshThreshold?"Release to refresh":"Pull to refresh")),S()},[s,O,$,S,N]),I=f.useCallback(F=>{const w=j.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(F.velocityY),w.isPullingToRefresh=!1)},[s,g,E,$]),q=f.useCallback(()=>{C(!0),E(j.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 F=fr.createGesture(h.current,{name:"page-scroller-gesture",priority:10,passive:!0,direction:"y",onStart:M,onMove:L,onEnd:I});return F.init(),()=>F.destroy()},[M,L,I]),f.useEffect(()=>{if(h.current)return y(),P(),window.addEventListener("resize",y),()=>{window.removeEventListener("resize",y),v.current!==null&&clearTimeout(v.current)}},[y,P]),l.jsxs(A.motion.div,{id:e,ref:h,initial:{x:t||T?0:window.innerWidth,y:T?20:void 0,opacity:T&&!t?0:1},animate:{x:T||t?void 0:0,y:T?0:void 0,opacity:1,transition:{ease:[.32,.72,0,1],duration:T?.34:.44,delay:.2}},exit:{x:T||t?void 0:window.innerWidth+80,y:T?20:0,opacity:T?0:1,transition:{duration:T?.34:.6,ease:[.32,.72,0,1]}},style:{overflow:"hidden",position:r?"absolute":"relative",...a},className:k("top-0 right-0 h-full w-full bg-base-1 isolate will-change-transform",i),children:[s&&l.jsx("div",{ref:b,style:{position:"absolute",top:n?48:0,left:0,width:"100%",textAlign:"center",height:"50px",lineHeight:"50px",transform:"translateY(-50px)"},children:"Pull to refresh"}),l.jsx("div",{ref:p,style:{position:"absolute",top:0,left:0,width:"100%",willChange:"transform"},className:u,children:o}),n,d&&l.jsx("div",{ref:x,style:{position:"absolute",top:2,right:2,width:6,borderRadius:3,opacity:0,transition:"opacity 0.2s",willChange:"transform"},className:"bg-base-3"})]},`scroller${e}`)};function Da({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),c=f.useRef(null),d=f.useRef(null),[m,h]=f.useState(!1),p=f.useRef(null),b=f.useRef({startY:0,currentY:0,maxScroll:0,lastTimestamp:0,frameCallback:null,isScrolling:!1,pullDistance:0,refreshThreshold:50,isPullingToRefresh:!1}),x=f.useCallback(Pe(()=>{a.current&&i.current&&(b.current.maxScroll=Math.max(0,i.current.offsetHeight-a.current.offsetHeight))}),[]),v=f.useCallback(E=>{const{maxScroll:g}=b.current;return E>0?Math.pow(E,.8):E<-g?-g-Math.pow(-(E+g),.8):E},[]),$=f.useCallback(()=>{if(!t||!a.current||!c.current)return;const{currentY:E,maxScroll:g}=b.current,S=a.current.offsetHeight,M=Math.max(30,S/(S+g)*S),L=S-M;let I=-E/g*L,q=1;E>0?(I=0,q=1-E/S,c.current.style.transformOrigin="top"):E<-g?(I=L,q=1-Math.abs(E+g)/S,c.current.style.transformOrigin="bottom"):c.current.style.transformOrigin="top",c.current.style.transform=`translate3d(0, ${I}px, 0) scaleY(${q})`,c.current.style.height=`${M}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),$()},[$]),R=f.useCallback(E=>{const g=b.current;g.frameCallback&&(A.cancelFrame(g.frameCallback),g.frameCallback=null);const S=performance.now(),M=g.currentY,L=E-M,I=()=>{const q=performance.now()-S,F=Math.min(q/n,1),w=1-Math.pow(1-F,3),H=M+L*w;C(H),F>=1&&(g.frameCallback&&(A.cancelFrame(g.frameCallback),g.frameCallback=null),C(E))};g.frameCallback=A.frame.render(I,!0)},[C,n]),j=f.useCallback(E=>{const g=b.current;g.frameCallback&&(A.cancelFrame(g.frameCallback),g.frameCallback=null);let S=E,M=Date.now();const L=()=>{const I=Date.now(),q=I-M;if(M=I,S*=Math.pow(.95,q/16),g.currentY+=S*q,g.currentY>0||g.currentY<-g.maxScroll){g.frameCallback&&(A.cancelFrame(g.frameCallback),g.frameCallback=null),R(g.currentY>0?0:-g.maxScroll);return}C(g.currentY),Math.abs(S)<.01&&g.frameCallback&&(A.cancelFrame(g.frameCallback),g.frameCallback=null)};g.frameCallback=A.frame.render(L,!0)},[C,R]),T=f.useCallback(()=>{if(!t||!c.current)return;d.current!==null&&clearTimeout(d.current),requestAnimationFrame(()=>{c.current&&(c.current.style.opacity="1")});const E=window.requestIdleCallback||(g=>setTimeout(g,1e3));d.current=window.setTimeout(()=>{E(()=>{c.current&&(c.current.style.opacity="0"),d.current=null})},1e3)},[t]),y=f.useCallback(E=>{if(p.current!==null&&Date.now()-p.current<50)return;p.current=Date.now();const g=b.current;g.isScrolling=!0,g.startY=g.currentY,g.lastTimestamp=Date.now(),g.isPullingToRefresh=g.currentY===0,g.pullDistance=0,g.frameCallback&&(A.cancelFrame(g.frameCallback),g.frameCallback=null),T()},[T]),N=f.useCallback(E=>{const g=b.current;if(!g.isScrolling)return;const S=v(g.startY+E.deltaY);g.isPullingToRefresh&&S<g.startY&&(g.isPullingToRefresh=!1),C(S),r&&g.isPullingToRefresh&&!m&&S>0&&(g.pullDistance=S),T()},[r,C,m,T,v]),P=f.useCallback(()=>{h(!0),R(b.current.refreshThreshold),r&&r().then(()=>{h(!1),R(0)})},[r,R]),O=f.useCallback(E=>{const g=b.current;g.isScrolling&&(g.isScrolling=!1,r&&g.isPullingToRefresh&&!m&&g.pullDistance>g.refreshThreshold?P():g.currentY>0||g.currentY<-g.maxScroll?R(g.currentY>0?0:-g.maxScroll):j(E.velocityY),g.isPullingToRefresh=!1)},[r,j,R,m,P]);return f.useEffect(()=>{if(!a.current)return;const E=fr.createGesture(a.current,{name:"page-scroller-gesture",priority:10,passive:!0,direction:"y",onStart:y,onMove:N,onEnd:O});return E.init(),()=>E.destroy()},[y,N,O]),f.useEffect(()=>{if(a.current)return x(),$(),window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x),d.current!==null&&clearTimeout(d.current)}},[x,$]),{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:c}},refreshing:m,updateMaxScroll:x,rubberBandEffect:v,updateScrollbarPosition:$,setPosition:C}}const Pa=f.forwardRef(({placeholder:e="Buscar",value:t,exposedRef:r,autoFocus:n,onClear:o,onChange:s,className:a,onMount:i,error:u},c)=>{const d=f.useRef(null),m=He(),h=Dt(d,c),p=f.useCallback(()=>r&&r(d),[]);return f.useEffect(()=>{const b=async()=>{i&&await i(d,m)};p(),b()},[]),l.jsxs("div",{className:k("rounded-6 relative flex items-center bg-base-3 border-base-5",{"dark-theme:bg-red-4 light-theme:border-red-9":u,"dark-theme:bg-base-3":!u},a),children:[l.jsx("input",{ref:h,placeholder:e,value:t,onChange:s,autoComplete:"off",autoCorrect:"off",type:"search",autoFocus:n?n(m):void 0,className:k("w-full py-1.5 pl-10 pr-3 bg-transparent outline-none text-base-12 placeholder:text-base-11 [&::-webkit-search-cancel-button]:appearance-none",u&&"text-red-9 placeholder:text-red-9")}),l.jsx(Y.Search,{size:20,className:k("absolute left-3 text-base-11 pointer-events-none",{"text-red-9":u})}),o&&t&&t.length>0?l.jsx("button",{onClick:()=>{o(),d.current?.focus()},className:k("absolute right-2.5 rounded-full",u?"text-red-9":"text-base-11"),children:l.jsx(Y.X,{size:20})}):null]})}),Oa=({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 l.jsxs("div",{children:[l.jsx("p",{className:k("text-base-12",r==="sm"&&"text-sm",n),children:u}),i?l.jsx("button",{onClick:()=>a(c=>!c),className:k("text-xs text-base-11",o),children:s?"Ver menos":"Ver más"}):null]})},ir=({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 c;if(t==="right"||t==="down"?c=Math.min(a+u,i):c=Math.max(a-u,0),c===a)return;const d={fast:.15,normal:.4,slow:.8};A.animate(0,1,{duration:d[o],ease:"easeOut",onUpdate:m=>{if(!e)return;const h=a+(c-a)*m;s?e.scrollTop=h:e.scrollLeft=h}})},Fa={default:[.32,.72,0,1]},lr={initial:{opacity:0},animate:{opacity:1,transition:{ease:Fa.default,duration:.3}},exit:{opacity:0,transition:{ease:[.32,.72,0,1],duration:.3}}},Kr=new Set,Q=new WeakMap,Te=new WeakMap,Ee=new WeakMap,St=new WeakMap,La=new WeakMap,Me=new WeakMap,at=new WeakMap,Re=new WeakSet;let ge,Yt=0,It=0;const de="__aa_tgt",Ie="__aa_del",it="__aa_new",Ra=e=>{const t=za(e);t&&t.forEach(r=>Ha(r))},Aa=e=>{e.forEach(t=>{t.target===ge&&_a(),Q.has(t.target)&&$e(t.target)})};function Wa(e){St.get(e)?.disconnect();let r=Q.get(e),n=0;const o=5;r||(r=De(e),Q.set(e,r));const{offsetWidth:s,offsetHeight:a}=ge,u=[r.top-o,s-(r.left+o+r.width),a-(r.top+o+r.height),r.left-o].map(d=>`${-1*Math.floor(d)}px`).join(" "),c=new IntersectionObserver(()=>{++n>1&&$e(e)},{root:ge,threshold:1,rootMargin:u});c.observe(e),St.set(e,c)}function $e(e){clearTimeout(at.get(e));const t=bt(e),r=ze(t)?500:t.duration;at.set(e,setTimeout(async()=>{const n=Ee.get(e);try{await n?.finished,Q.set(e,De(e)),Wa(e)}catch{}},r))}function _a(){clearTimeout(at.get(ge)),at.set(ge,setTimeout(()=>{Kr.forEach(e=>Jr(e,t=>Ur(()=>$e(t))))},100))}function Ya(e){setTimeout(()=>{La.set(e,setInterval(()=>Ur($e.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function Ur(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let Tt,lt;const Ia=typeof window<"u"&&"ResizeObserver"in window;Ia&&(ge=document.documentElement,Tt=new MutationObserver(Ra),lt=new ResizeObserver(Aa),window.addEventListener("scroll",()=>{It=window.scrollY,Yt=window.scrollX}),lt.observe(ge));function za(e){return e.reduce((n,o)=>[...n,...Array.from(o.addedNodes),...Array.from(o.removedNodes)],[]).every(n=>n.nodeName==="#comment")?!1:e.reduce((n,o)=>{if(n===!1)return!1;if(o.target instanceof Element){if(yt(o.target),!n.has(o.target)){n.add(o.target);for(let s=0;s<o.target.children.length;s++){const a=o.target.children.item(s);if(a){if(Ie in a)return!1;yt(o.target,a),n.add(a)}}}if(o.removedNodes.length)for(let s=0;s<o.removedNodes.length;s++){const a=o.removedNodes[s];if(Ie in a)return!1;a instanceof Element&&(n.add(a),yt(o.target,a),Te.set(a,[o.previousSibling,o.nextSibling]))}}return n},new Set)}function yt(e,t){!t&&!(de in e)?Object.defineProperty(e,de,{value:e}):t&&!(de in t)&&Object.defineProperty(t,de,{value:e})}function Ha(e){const t=e.isConnected,r=Q.has(e);t&&Te.has(e)&&Te.delete(e),Ee.has(e)&&Ee.get(e)?.cancel(),it in e?cr(e):r&&t?qa(e):r&&!t?Xa(e):cr(e)}function ae(e){return Number(e.replace(/[^0-9.\-]/g,""))}function Ba(e){let t=e.parentElement;for(;t;){if(t.scrollLeft||t.scrollTop)return{x:t.scrollLeft,y:t.scrollTop};t=t.parentElement}return{x:0,y:0}}function De(e){const t=e.getBoundingClientRect(),{x:r,y:n}=Ba(e);return{top:t.top+n,left:t.left+r,width:t.width,height:t.height}}function Gr(e,t,r){let n=t.width,o=t.height,s=r.width,a=r.height;const i=getComputedStyle(e);if(i.getPropertyValue("box-sizing")==="content-box"){const c=ae(i.paddingTop)+ae(i.paddingBottom)+ae(i.borderTopWidth)+ae(i.borderBottomWidth),d=ae(i.paddingLeft)+ae(i.paddingRight)+ae(i.borderRightWidth)+ae(i.borderLeftWidth);n-=d,s-=d,o-=c,a-=c}return[n,s,o,a].map(Math.round)}function bt(e){return de in e&&Me.has(e[de])?Me.get(e[de]):{duration:250,easing:"ease-in-out"}}function Qr(e){if(de in e)return e[de]}function zt(e){const t=Qr(e);return t?Re.has(t):!1}function Jr(e,...t){t.forEach(r=>r(e,Me.has(e)));for(let r=0;r<e.children.length;r++){const n=e.children.item(r);n&&t.forEach(o=>o(n,Me.has(n)))}}function Ht(e){return Array.isArray(e)?e:[e]}function ze(e){return typeof e=="function"}function qa(e){const t=Q.get(e),r=De(e);if(!zt(e))return Q.set(e,r);let n;if(!t)return;const o=bt(e);if(typeof o!="function"){const s=t.left-r.left,a=t.top-r.top,[i,u,c,d]=Gr(e,t,r),m={transform:`translate(${s}px, ${a}px)`},h={transform:"translate(0, 0)"};o.fromBorderRadius!==void 0&&o.toBorderRadius!==void 0&&(m.borderRadius=`${o.fromBorderRadius}px`,h.borderRadius=`${o.toBorderRadius}px`),i!==u&&(m.width=`${i}px`,h.width=`${u}px`),c!==d&&(m.height=`${c}px`,h.height=`${d}px`),n=e.animate([m,h],{duration:o.duration,easing:o.easing})}else{const[s]=Ht(o(e,"remain",t,r));n=new Animation(s),n.play()}Ee.set(e,n),Q.set(e,r),n.addEventListener("finish",$e.bind(null,e))}function cr(e){it in e&&delete e[it];const t=De(e);Q.set(e,t);const r=bt(e);if(!zt(e))return;let n;if(typeof r!="function")n=e.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:r.duration*1.5,easing:"ease-in"});else{const[o]=Ht(r(e,"add",t));n=new Animation(o),n.play()}Ee.set(e,n),n.addEventListener("finish",$e.bind(null,e))}function ur(e,t){e.remove(),Q.delete(e),Te.delete(e),Ee.delete(e),St.get(e)?.disconnect(),setTimeout(()=>{if(Ie in e&&delete e[Ie],Object.defineProperty(e,it,{value:!0,configurable:!0}),t&&e instanceof HTMLElement)for(const r in t)e.style[r]=""},0)}function Xa(e){if(!Te.has(e)||!Q.has(e))return;const[t,r]=Te.get(e);Object.defineProperty(e,Ie,{value:!0,configurable:!0});const n=window.scrollX,o=window.scrollY;if(r&&r.parentNode&&r.parentNode instanceof Element?r.parentNode.insertBefore(e,r):t&&t.parentNode?t.parentNode.appendChild(e):Qr(e)?.appendChild(e),!zt(e))return ur(e);const[s,a,i,u]=Ka(e),c=bt(e),d=Q.get(e);(n!==Yt||o!==It)&&Va(e,n,o,c);let m,h={position:"absolute",top:`${s}px`,left:`${a}px`,width:`${i}px`,height:`${u}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!ze(c))Object.assign(e.style,h),m=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:c.duration,easing:"ease-out"});else{const[p,b]=Ht(c(e,"remove",d));b?.styleReset!==!1&&(h=b?.styleReset||h,Object.assign(e.style,h)),m=new Animation(p),m.play()}Ee.set(e,m),m.addEventListener("finish",ur.bind(null,e,h))}function Va(e,t,r,n){const o=Yt-t,s=It-r,a=document.documentElement.style.scrollBehavior;if(getComputedStyle(ge).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+o,window.scrollY+s),!e.parentElement)return;const u=e.parentElement;let c=u.clientHeight,d=u.clientWidth;const m=performance.now();function h(){requestAnimationFrame(()=>{if(!ze(n)){const p=c-u.clientHeight,b=d-u.clientWidth;m+n.duration>performance.now()?(window.scrollTo({left:window.scrollX-b,top:window.scrollY-p}),c=u.clientHeight,d=u.clientWidth,h()):document.documentElement.style.scrollBehavior=a}})}h()}function Ka(e){const t=Q.get(e),[r,,n]=Gr(e,t,De(e));let o=e.parentElement;for(;o&&(getComputedStyle(o).position==="static"||o instanceof HTMLBodyElement);)o=o.parentElement;o||(o=document.body);const s=getComputedStyle(o),a=Q.get(o)||De(o),i=Math.round(t.top-a.top)-ae(s.borderTopWidth),u=Math.round(t.left-a.left)-ae(s.borderLeftWidth);return[i,u,r,n]}function Zr(e,t={}){return Tt&&lt&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!ze(t)&&!t.disrespectUserMotionPreference||(Re.add(e),getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),Jr(e,$e,Ya,o=>lt?.observe(o)),ze(t)?Me.set(e,t):Me.set(e,{duration:250,easing:"ease-in-out",...t}),Tt.observe(e,{childList:!0}),Kr.add(e))),Object.freeze({parent:e,enable:()=>{Re.add(e)},disable:()=>{Re.delete(e)},isEnabled:()=>Re.has(e)})}const he={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"}}},Ua=({options:e,selected:t,onChange:r,keyExtractor:n,labelExtractor:o,itemColor:s,itemClassName:a,color:i="contrast",unselectedColor:u="none",width:c="fit",border:d="solid",rounded:m=6,trackScroll:h=!0,className:p})=>{const[b,x]=f.useState({left:!1,right:!1}),{ref:v}=pr({onOverflow:$=>{x({left:$.canScrollLeft,right:$.canScrollRight})},trackScroll:h});return l.jsxs("div",{className:k("relative overflow-hidden",he.widths[c].container,he.rounded[m],p),children:[l.jsx("div",{ref:v,className:k("flex items-center border overflow-x-scroll scrollbar-hide",he.rounded[m],he.border[d]),children:e.map($=>{const C=n(t)===n($);return l.jsx("button",{onClick:()=>r?.($),className:k("border-r px-3 py-1 last:border-none text-nowrap shrink-0",he.widths[c].item,!C&&"lg:hover:bg-overlay-3",s?s(C):C?he.colors[i]:he.unselectedColors[u],he.border[d],a),children:o($)},n($))})}),l.jsxs(A.AnimatePresence,{children:[b.left?l.jsx(A.motion.button,{variants:lr,initial:"initial",animate:"animate",exit:"exit",onClick:()=>{v.current&&ir({el:v.current,direction:"left"})},className:"absolute shrink-0 left-0 px-1 h-full bg-gradient-to-r from-base-2 top-0",children:l.jsx(Y.ChevronLeft,{className:"text-base-13"})},"leftarrow"):null,b.right?l.jsx(A.motion.button,{variants:lr,initial:"initial",animate:"animate",exit:"exit",onClick:()=>{v.current&&ir({el:v.current,direction:"right"})},className:"absolute shrink-0 right-0 px-1 h-full bg-gradient-to-l from-base-2 top-0",children:l.jsx(Y.ChevronRight,{className:"text-base-13"})},"rightarrow"):null]})]})};function en({label:e,labelPosition:t="default",options:r,selected:n,onChange:o,idExtractor:s,labelExtractor:a,customGetter:i,customSetter:u,error:c,placeholder:d="Selecciona una opción",searchable:m,className:h}){const[p,b]=f.useState(-1),x=f.useRef(null),{triggerRef:v,triggerProps:$,popoverRef:C,getPopoverPosition:R,open:j,toggle:T,close:y}=ct({align:"start",side:"bottom",avoidCollisions:!0,onOpen:()=>{m&&x.current&&setTimeout(()=>x.current?.focus(),10)},onClose:()=>{b(-1)}});ut(C,O=>{!v.current||!j||!O.target||v.current.contains(O.target)||y()});const N=R(),P=i&&n?i(n,r):n;return l.jsxs("div",{className:k("relative",h),children:[t==="default"&&l.jsx("label",{className:k("top-[18px] font-medium ml-0.5 text-xs",c&&"text-red-9"),children:e}),l.jsxs(G,{ref:v,color:"solidhybrid",className:"w-full justify-between",onClick:T,...$,children:[P?a(P):d,l.jsx(Y.ChevronDown,{size:18,className:k("transition",j&&"rotate-180")})]}),l.jsx(A.AnimatePresence,{children:j&&l.jsx(qe,{children:l.jsx(A.motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},ref:C,style:{position:"fixed",left:N.x,top:N.top,bottom:N.bottom,width:v.current?.offsetWidth??200},className:k("bg-base-1 dark-theme:bg-base-3 border border-base-4","rounded-6 shadow-lg max-h-[300px] overflow-y-auto z-50","customscrollbarnohide"),role:"listbox",children:r.map((O,E)=>{const g=P&&s(O)===s(P),S=E===p;return l.jsxs("div",{className:k("px-3 py-2 text-sm cursor-pointer flex items-center justify-between","first:rounded-t-6 last:rounded-b-6",{"bg-base-3 dark-theme:bg-base-4":S,"bg-brandfadedbg text-brand":g}),onClick:()=>{o(u?u(O):O),y()},role:"option",onMouseEnter:()=>b(E),children:[l.jsx("span",{children:a(O)}),g&&l.jsx(Y.CheckIcon,{size:16})]},s(O))})})})})]})}const Ga=({name:e,...t})=>{const{control:r}=J.useFormContext();return r?l.jsx(J.Controller,{name:e,control:r,render:({field:n,fieldState:o})=>l.jsx(en,{selected:n.value??null,onChange:s=>n.onChange(s),error:o.error?.message,...t})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},Qa=({className:e})=>l.jsx("div",{className:k("w-full h-px bg-base-4",e)}),tn=({loading:e=!0,wrapperClassName:t,spinnerClassName:r})=>l.jsx("div",{className:k("flex justify-center",t),children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",className:k({"animate-spin":e},r),children:l.jsx("path",{fill:"currentColor",d:"M10 3a7 7 0 0 0-7 7a.5.5 0 0 1-1 0a8 8 0 1 1 8 8a.5.5 0 0 1 0-1a7 7 0 1 0 0-14Z"})})}),Ja=({isEditable:e,isDeletable:t=!0,createUpdateLoading:r,deleteLoading:n,onDelete:o,onDeleteConfirm:s,addText:a="Añadir",updateText:i="Actualizar",deleteText:u="Eliminar",className:c})=>{const[d,m]=f.useState(!1);return l.jsxs("div",{className:`w-full grid grid-cols-2 gap-4 col-span-full ${c}`,children:[e&&t?l.jsxs(G,{color:"dangersolid",state:n?"loading":r?"disabled":"enabled",onClick:()=>{s?d?o?.():m(!0):o?.()},children:[l.jsx(Y.X,{size:18}),s&&d?"Confirmar":u]}):null,l.jsxs(G,{color:"brand",className:k(e&&t?"":"col-span-2"),state:r?"loading":n?"disabled":"enabled",type:"submit",children:[r?l.jsx(tn,{}):e?l.jsx(Y.Check,{size:18}):l.jsx(Y.Plus,{size:18}),e?i:a]})]})},rn=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)=>{A.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=>{A.animate(d,{y:0,scale:1},{ease:[.32,.72,0,1],duration:.2})},[]),u=f.useCallback(()=>r.current,[]),c={add:n,remove:o,getPrevId:s,animateParentModal:a,restoreParentModal:i,getModals:u};return l.jsx(rn.Provider,{value:c,children:e})},nn=()=>{const e=f.useContext(rn);if(e===void 0)throw new Error("useModals must be used within a ModalsProvider");return e},ei=({withPortal:e,children:t})=>e?l.jsx(qe,{children:t}):l.jsx(l.Fragment,{children:t}),ti=({id:e,prevPath:t,withDelay:r,withPortal:n=!0,title:o,description:s,showHeader:a=!0,mode:i,onReplace:u,className:c,contentClassName:d,children:m})=>{const h=Fe.useInitialChangeEvent(),p=He(),b=f.useRef(null),x=nn(),v=f.useMemo(()=>i==="modal"||p,[i,p]);return f.useEffect(()=>{x.add(e);const $=x.getPrevId();if(!$||(b.current=document.getElementById($),!b.current))return;$&&x.animateParentModal(b.current,v?"modal":"sheet");//! cleanups not running on new router system
12
12
  //! IDK WHY
13
13
  return()=>{console.log("IS THIS CLEANUP RUNNING?")};//! NOT RUNNING...
14
- },[p]),f.useLayoutEffect(()=>()=>x.remove(e),[]),l.jsxs(ei,{withPortal:n,children:[l.jsx(A.motion.div,{initial:{opacity:0},animate:{opacity:1,transition:{ease:[.32,.72,0,1],duration:.3,delay:r?.2:void 0}},exit:{opacity:0,transition:{ease:[.32,.72,0,1],duration:.3}},onClick:()=>{h?We.navigate.back():We.navigate.replace(u??t)},className:"bg-black/40 absolute w-full h-full left-0 top-0 z-[500]"}),l.jsxs(A.motion.div,{id:e,initial:{opacity:w?0:1,scale:w?.8:void 0,y:w?void 0:window.innerHeight},animate:{opacity:1,scale:1,y:w?void 0:0,transition:{ease:[.32,.72,0,1],duration:.3,delay:r?.2:void 0}},exit:{scale:w?.8:void 0,opacity:w?0:void 0,y:w?void 0:window.innerHeight,transition:{ease:[.32,.72,0,1],duration:.3}},style:{left:"50%",translateX:"-50%",bottom:w?"50%":0,translateY:w?"50%":0,height:w?"65%":"95%"},onAnimationStart:$=>{($?.scale===.8||$?.y>50)&&b.current&&x.restoreParentModal(b.current)},className:N("bg-base-1 absolute w-full lg:max-w-[600px] h-full rounded-6 overflow-hidden z-[500] flex flex-col",!w&&"rounded-b-none",c),children:[a&&l.jsxs("div",{className:"flex items-start justify-between p-4 border-b border-base-3",children:[l.jsxs("div",{children:[o&&l.jsx("p",{className:"font-medium text-lg",children:o}),s&&l.jsx("p",{className:"text-base-11 text-xs",children:s})]}),l.jsx(Q,{size:"xs",onClick:()=>{h?We.navigate.back():We.navigate.replace(u??t)},children:l.jsx(_.X,{size:20})})]}),l.jsx("div",{id:`${e}-content`,className:N("grow customscrollbar p-4 pb-6",d),children:m})]})]})};function ln({checked:e,onCheckedChange:t,disabled:r=!1,name:n,required:o,className:s=""}){const a=f.useId(),i=()=>{r||t(!e)};return l.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
+ },[p]),f.useLayoutEffect(()=>()=>x.remove(e),[]),l.jsxs(ei,{withPortal:n,children:[l.jsx(A.motion.div,{initial:{opacity:0},animate:{opacity:1,transition:{ease:[.32,.72,0,1],duration:.3,delay:r?.2:void 0}},exit:{opacity:0,transition:{ease:[.32,.72,0,1],duration:.3}},onClick:()=>{h?Fe.navigate.back():Fe.navigate.replace(u??t)},className:"bg-black/40 absolute w-full h-full left-0 top-0 z-[500]"}),l.jsxs(A.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:$=>{($?.scale===.8||$?.y>50)&&b.current&&x.restoreParentModal(b.current)},className:k("bg-base-1 absolute w-full lg:max-w-[600px] h-full rounded-6 overflow-hidden z-[500] flex flex-col",!v&&"rounded-b-none",c),children:[a&&l.jsxs("div",{className:"flex items-start justify-between p-4 border-b border-base-3",children:[l.jsxs("div",{children:[o&&l.jsx("p",{className:"font-medium text-lg",children:o}),s&&l.jsx("p",{className:"text-base-11 text-xs",children:s})]}),l.jsx(G,{size:"xs",onClick:()=>{h?Fe.navigate.back():Fe.navigate.replace(u??t)},children:l.jsx(Y.X,{size:20})})]}),l.jsx("div",{id:`${e}-content`,className:k("grow customscrollbar p-4 pb-6",d),children:m})]})]})};function on({checked:e,onCheckedChange:t,disabled:r=!1,name:n,required:o,className:s=""}){const a=f.useId(),i=()=>{r||t(!e)};return l.jsxs("button",{id:a,type:"button",role:"switch","aria-checked":e,"aria-required":o,"data-state":e?"checked":"unchecked",disabled:r,onClick:i,className:k(`relative inline-flex h-[28px] w-[48px] items-center rounded-full
15
15
  transition-colors duration-200 ease-in-out
16
16
  focus-visible:outline-none focus-visible:ring-1
17
- focus-visible:ring-base-6`,e?"bg-brand":"bg-base-3",r?"opacity-50 cursor-not-allowed":"cursor-pointer",s),children:[l.jsx("span",{className:N(`inline-block h-6 w-6 transform rounded-full
17
+ focus-visible:ring-base-6`,e?"bg-brand":"bg-base-3",r?"opacity-50 cursor-not-allowed":"cursor-pointer",s),children:[l.jsx("span",{className:k(`inline-block h-6 w-6 transform rounded-full
18
18
  transition-transform duration-200 ease-in-out
19
- shadow`,e?"bg-brand-text translate-x-[22px]":"bg-base-1 dark-theme:bg-base-12 translate-x-[2px]")}),n&&l.jsx("input",{type:"checkbox",name:n,checked:e,required:o,disabled:r,onChange:()=>{},tabIndex:-1,"aria-hidden":"true",className:"sr-only"})]})}const cn=({label:e,variant:t="default",color:r="solid",tags:n,onChange:o,valid:s,error:a,placeholder:i="Add a tag...",maxTags:u,validateTag:c})=>{const[d,m]=f.useState(""),[h,p]=f.useState(!1),[b,x]=f.useState(null),w=f.useRef(null),$=f.useRef(null),S=f.useRef([]),O=n.length>0,T=f.useRef(`taginput-${Math.random().toString(36).substr(2,9)}`).current,M=f.useRef(`label-${Math.random().toString(36).substr(2,9)}`).current,y=f.useRef(`error-${Math.random().toString(36).substr(2,9)}`).current;f.useEffect(()=>{S.current=S.current.slice(0,n.length)},[n.length]);const E=D=>{if(D.key==="Enter"&&d.trim()){D.preventDefault();const L=d.trim();if(u&&n.length>=u){x(`Maximum of ${u} tags allowed`);return}if(n.includes(L)){x("Tag already exists");return}if(c){const Y=c(L);if(typeof Y=="string"){x(Y);return}else if(Y===!1){x("Invalid tag");return}}o([...n,L]),m(""),x(null),j(`Added tag ${L}`)}else if(D.key==="Backspace"&&!d&&n.length>0){const L=n[n.length-1];o(n.slice(0,-1)),j(`Removed tag ${L}`)}else D.key==="ArrowLeft"&&d===""&&n.length>0&&S.current[n.length-1]&&S.current[n.length-1]?.focus()},R=(D,L)=>{if(D.key==="Backspace"||D.key==="Delete"){D.preventDefault();const Y=n[L],q=[...n];q.splice(L,1),o(q),setTimeout(()=>{w.current&&w.current.focus()},0),j(`Removed tag ${Y}`)}else D.key==="ArrowRight"?(D.preventDefault(),L<n.length-1?S.current[L+1]?.focus():w.current?.focus()):D.key==="ArrowLeft"&&(D.preventDefault(),L>0&&S.current[L-1]?.focus())},W=(D,L)=>{o(n.filter(Y=>Y!==D)),setTimeout(()=>{L<n.length-1?S.current[L]?.focus():L>0?S.current[L-1]?.focus():w.current?.focus()},0),j(`Removed tag ${D}`)},C=D=>{m(D.target.value),x(null)},g=()=>{w.current&&w.current.focus()},j=D=>{console.log(`Accessibility announcement: ${D}`)};return l.jsxs("div",{children:[l.jsxs("div",{className:"relative",ref:$,children:[t==="default"?l.jsxs("label",{id:M,htmlFor:T,className:N("text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":h||O||i,"text-red-9":!!a}),children:[e," ",u&&`(${n.length}/${u})`]}):null,l.jsxs("div",{className:N("rounded-6 px-2 transition cursor-text pr-10",{"bg-base-3":r==="solid","border border-uielborder focus-visible:border-transparent":r==="outline","py-3":t==="default","pt-5 pb-2":t==="floating","ring-2 ring-branduielborder":h,"text-red-9":a||b,"ring-2 ring-red-6":(a||b)&&h}),onClick:g,role:"group","aria-labelledby":M,"aria-describedby":a||b?y:void 0,children:[t==="floating"?l.jsxs("label",{id:M,htmlFor:T,className:N("absolute transition-all duration-200 pointer-events-none","text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":h||O||i,"text-red-9":!!a}),children:[e," ",u&&`(${n.length}/${u})`]}):null,l.jsxs("div",{className:N("flex flex-wrap gap-1 items-center",{"mt-2.5":t==="floating"}),children:[n.map((D,L)=>l.jsxs("div",{ref:Y=>{S.current[L]=Y},className:N("line-clamp-1 text-brand rounded-full px-2 text-sm flex items-center",{"bg-brandfadedbg text-brand":!a&&!b,"bg-red-4 text-red-9":a||b}),tabIndex:0,role:"button","aria-label":`${D}, press delete or backspace to remove`,onKeyDown:Y=>R(Y,L),children:[D,l.jsx("button",{type:"button",className:"ml-1 text-brand hover:text-brandhover shrink-0",onClick:()=>W(D,L),"aria-label":`Remove ${D} tag`,children:"x"})]},`${D}-${L}`)),l.jsx("input",{id:T,ref:w,type:"text",className:"flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm placeholder:text-secondarytext",value:d,onChange:C,onKeyDown:E,onFocus:()=>p(!0),onBlur:()=>p(!1),enterKeyHint:"enter",autoComplete:"off",placeholder:n.length>0?"":i,style:{width:`${Math.max(60,d.length*8)}px`},"aria-describedby":a||b?y:void 0,"aria-invalid":!!(a||b)})]})]}),s&&l.jsx("span",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:l.jsx(_.CheckIcon,{})})]}),(a||b)&&l.jsx("p",{id:y,className:"text-red-500 text-xs mt-1","aria-live":"assertive",children:a||b}),l.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:n.length>0?`Current tags: ${n.join(", ")}`:"No tags added yet"})]})},ri=({name:e,...t})=>{const{control:r}=Z.useFormContext();return r?l.jsx(Z.Controller,{name:e,control:r,render:({field:n,fieldState:o})=>l.jsx(cn,{tags:n.value,onChange:s=>n.onChange(s),error:o.error?.message,...t})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},ni={brand:"ring-1 ring-brand",solid:"ring-1 ring-base-6"},Xt=f.forwardRef(({label:e,labelPosition:t="default",placeholder:r,error:n,focusColor:o="brand",className:s,value:a,rows:i=3,...u},c)=>{const[d,m]=f.useState(!1),h=a!==""&&a!==null&&a!==void 0;return l.jsxs("div",{className:"relative",children:[t==="default"?l.jsx("label",{className:N("top-[18px] font-medium ml-0.5 text-xs",n&&"text-red-9"),children:e}):null,l.jsxs("div",{className:N(t==="default"?"p-0":"pt-5 pb-2",{"bg-red-4 text-red-9":!!n}),children:[t==="floating"&&l.jsx("label",{className:N("absolute transition-all duration-200 pointer-events-none","text-sm top-2.5 font-semibold left-2.5",{"text-xs top-2.5":d||h||r,"text-red-9":!!n}),children:e}),l.jsx("textarea",{ref:c,className:N(!n&&d&&ni[o],"bg-base-3 border border-base-4 light-theme:drop-shadow-sm rounded-6 w-full focus-visible:outline-none customscrollbarnohide","placeholder:text-base-11 text-sm","resize-none",t==="default"?"p-3":"mt-1",{"text-red-9 placeholder:text-red-9":!!n},s),value:a,placeholder:r,onFocus:()=>m(!0),onBlur:()=>m(!1),rows:i,...u})]})]})});Xt.displayName="TextArea";const oi=({name:e,customRead:t,customSet:r,...n})=>{const{control:o}=Z.useFormContext(),s=f.useCallback(i=>t?t(i):i===null?Ot(i):i,[t]),a=f.useCallback(i=>r?r(i):i===null?tt(i):i,[r]);return o?l.jsx(Z.Controller,{name:e,control:o,render:({field:i,fieldState:u})=>l.jsxs("div",{children:[l.jsx(Xt,{value:s(i.value),onChange:c=>i.onChange(a(c.target.value)),error:!!u.error,ref:i.ref,...n}),u.error?l.jsx("span",{role:"alert",className:"text-red-9 text-sm mt-1 ml-0.5",children:u.error.message}):null]})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},si=["Lunes","Martes","Miercoles","Jueves","Viernes","Sábado","Domingo"],ai=()=>l.jsx(ii,{}),ii=()=>l.jsx("div",{children:si.map(e=>l.jsx(li,{day:e},e))}),li=({day:e})=>{const[t,r]=f.useState(!1),n=f.useRef(null);return f.useEffect(()=>{n.current&&rn(n.current)},[]),l.jsxs("div",{ref:n,className:N("p-2 rounded-xl mt-2",{"border border-uielborder":t,"bg-uielbg border border-transparent":!t}),children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{children:e}),l.jsx(ln,{className:"mt-0",checked:t,onCheckedChange:o=>r(o)})]}),t?l.jsx(ci,{}):null]},e)},ci=()=>{const[e,t]=f.useState([{from:"08:00",to:"12:00"},{from:"14:00",to:"18:00"}]),r=f.useRef(null);return f.useEffect(()=>{r.current&&rn(r.current)},[]),l.jsxs("div",{ref:r,children:[e.map((n,o)=>l.jsxs("div",{className:"flex items-center justify-between mt-2",children:[l.jsx("p",{className:"text-sm text-secondarytext",children:"De"}),l.jsx(Q,{color:"solid",className:"w-24",children:n.from}),l.jsx("p",{className:"text-sm text-secondarytext mx-1",children:"a"}),l.jsx(Q,{color:"solid",className:"w-24",children:n.to}),l.jsx(Q,{className:"rounded-full",children:l.jsx(_.X,{className:"text-secondarytext",size:20})})]},`${n.from}${o}`)),l.jsxs(Q,{onClick:()=>t(n=>[...n,{from:"19:00",to:"21:00"}]),className:"w-full mt-4",color:"contrast",children:[l.jsx(_.Plus,{className:"stroke-1"}),"Añadir hora"]})]})};exports.AliveScope=wa;exports.Avatar=vn;exports.AvatarsGroup=xn;exports.Button=Q;exports.Calendar=It;exports.Checkbox=Yr;exports.DatePickerDemo=Qs;exports.DatePickerPopover=Js;exports.DateTimePicker=ea;exports.ElasticHeader=ta;exports.FocusTrap=pn;exports.Form=ma;exports.FormInput=ga;exports.FormMultiSelect=ja;exports.FormSelect=Ga;exports.FormSubmit=Ja;exports.FormTags=ri;exports.FormTextArea=oi;exports.FormWorkingHours=ai;exports.Icon=Xr;exports.Input=zt;exports.KeepAlive=Ea;exports.List=$a;exports.ListItem=Ca;exports.ModalsProvider=Za;exports.MultiSelect=Gr;exports.PageScroller=Ma;exports.PageTitle=Ta;exports.PopoverCard=_r;exports.PopoverCardContent=Ks;exports.PopoverCardFooter=Us;exports.PopoverCardHeader=Xs;exports.Portal=Ue;exports.SearchInput=Pa;exports.SeeMoreText=Oa;exports.SegmentedControl=Ua;exports.Select=nn;exports.Separator=Qa;exports.Spinner=on;exports.SuperModal=ti;exports.Switch=ln;exports.Tags=cn;exports.TextArea=Xt;exports.TimePicker=Zs;exports.calculatePopoverPosition=yr;exports.checkOverflow=ze;exports.cn=N;exports.debounce=mn;exports.extractDirtyData=bn;exports.generateInitials=pr;exports.nullRead=Ot;exports.nullSet=tt;exports.removeWhitespaces=vr;exports.setFocusEnd=gr;exports.throttle=Ae;exports.toTitleCase=hn;exports.useClickAway=yn;exports.useClickAwayAdvanced=kn;exports.useClickAwayWithRef=dt;exports.useKeepAlive=Na;exports.useKeyListener=kr;exports.useLargeScreen=Xe;exports.useMergedRef=Ft;exports.useMethods=ha;exports.useModals=an;exports.useOverflow=xr;exports.useOverflowState=gn;exports.usePopover=ut;exports.useRipple=wr;exports.useScroller=Da;
19
+ shadow`,e?"bg-brand-text translate-x-[22px]":"bg-base-1 dark-theme:bg-base-12 translate-x-[2px]")}),n&&l.jsx("input",{type:"checkbox",name:n,checked:e,required:o,disabled:r,onChange:()=>{},tabIndex:-1,"aria-hidden":"true",className:"sr-only"})]})}const sn=({label:e,variant:t="default",color:r="solid",tags:n,onChange:o,valid:s,error:a,placeholder:i="Add a tag...",maxTags:u,validateTag:c})=>{const[d,m]=f.useState(""),[h,p]=f.useState(!1),[b,x]=f.useState(null),v=f.useRef(null),$=f.useRef(null),C=f.useRef([]),R=n.length>0,j=f.useRef(`taginput-${Math.random().toString(36).substr(2,9)}`).current,T=f.useRef(`label-${Math.random().toString(36).substr(2,9)}`).current,y=f.useRef(`error-${Math.random().toString(36).substr(2,9)}`).current;f.useEffect(()=>{C.current=C.current.slice(0,n.length)},[n.length]);const N=M=>{if(M.key==="Enter"&&d.trim()){M.preventDefault();const L=d.trim();if(u&&n.length>=u){x(`Maximum of ${u} tags allowed`);return}if(n.includes(L)){x("Tag already exists");return}if(c){const I=c(L);if(typeof I=="string"){x(I);return}else if(I===!1){x("Invalid tag");return}}o([...n,L]),m(""),x(null),S(`Added tag ${L}`)}else if(M.key==="Backspace"&&!d&&n.length>0){const L=n[n.length-1];o(n.slice(0,-1)),S(`Removed tag ${L}`)}else M.key==="ArrowLeft"&&d===""&&n.length>0&&C.current[n.length-1]&&C.current[n.length-1]?.focus()},P=(M,L)=>{if(M.key==="Backspace"||M.key==="Delete"){M.preventDefault();const I=n[L],q=[...n];q.splice(L,1),o(q),setTimeout(()=>{v.current&&v.current.focus()},0),S(`Removed tag ${I}`)}else M.key==="ArrowRight"?(M.preventDefault(),L<n.length-1?C.current[L+1]?.focus():v.current?.focus()):M.key==="ArrowLeft"&&(M.preventDefault(),L>0&&C.current[L-1]?.focus())},O=(M,L)=>{o(n.filter(I=>I!==M)),setTimeout(()=>{L<n.length-1?C.current[L]?.focus():L>0?C.current[L-1]?.focus():v.current?.focus()},0),S(`Removed tag ${M}`)},E=M=>{m(M.target.value),x(null)},g=()=>{v.current&&v.current.focus()},S=M=>{console.log(`Accessibility announcement: ${M}`)};return l.jsxs("div",{children:[l.jsxs("div",{className:"relative",ref:$,children:[t==="default"?l.jsxs("label",{id:T,htmlFor:j,className:k("text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":h||R||i,"text-red-9":!!a}),children:[e," ",u&&`(${n.length}/${u})`]}):null,l.jsxs("div",{className:k("rounded-6 px-2 transition cursor-text pr-10",{"bg-base-3":r==="solid","border border-uielborder focus-visible:border-transparent":r==="outline","py-3":t==="default","pt-5 pb-2":t==="floating","ring-2 ring-branduielborder":h,"text-red-9":a||b,"ring-2 ring-red-6":(a||b)&&h}),onClick:g,role:"group","aria-labelledby":T,"aria-describedby":a||b?y:void 0,children:[t==="floating"?l.jsxs("label",{id:T,htmlFor:j,className:k("absolute transition-all duration-200 pointer-events-none","text-base top-4 font-semibold left-3",{"text-sm top-2 left-2":h||R||i,"text-red-9":!!a}),children:[e," ",u&&`(${n.length}/${u})`]}):null,l.jsxs("div",{className:k("flex flex-wrap gap-1 items-center",{"mt-2.5":t==="floating"}),children:[n.map((M,L)=>l.jsxs("div",{ref:I=>{C.current[L]=I},className:k("line-clamp-1 text-brand rounded-full px-2 text-sm flex items-center",{"bg-brandfadedbg text-brand":!a&&!b,"bg-red-4 text-red-9":a||b}),tabIndex:0,role:"button","aria-label":`${M}, press delete or backspace to remove`,onKeyDown:I=>P(I,L),children:[M,l.jsx("button",{type:"button",className:"ml-1 text-brand hover:text-brandhover shrink-0",onClick:()=>O(M,L),"aria-label":`Remove ${M} tag`,children:"x"})]},`${M}-${L}`)),l.jsx("input",{id:j,ref:v,type:"text",className:"flex-grow min-w-[60px] bg-transparent outline-none placeholder:text-sm placeholder:text-secondarytext",value:d,onChange:E,onKeyDown:N,onFocus:()=>p(!0),onBlur:()=>p(!1),enterKeyHint:"enter",autoComplete:"off",placeholder:n.length>0?"":i,style:{width:`${Math.max(60,d.length*8)}px`},"aria-describedby":a||b?y:void 0,"aria-invalid":!!(a||b)})]})]}),s&&l.jsx("span",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:l.jsx(Y.CheckIcon,{})})]}),(a||b)&&l.jsx("p",{id:y,className:"text-red-500 text-xs mt-1","aria-live":"assertive",children:a||b}),l.jsx("div",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:n.length>0?`Current tags: ${n.join(", ")}`:"No tags added yet"})]})},ri=({name:e,...t})=>{const{control:r}=J.useFormContext();return r?l.jsx(J.Controller,{name:e,control:r,render:({field:n,fieldState:o})=>l.jsx(sn,{tags:n.value,onChange:s=>n.onChange(s),error:o.error?.message,...t})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},ni={brand:"ring-1 ring-brand",solid:"ring-1 ring-base-6"},Bt=f.forwardRef(({label:e,labelPosition:t="default",placeholder:r,error:n,focusColor:o="brand",className:s,value:a,rows:i=3,...u},c)=>{const[d,m]=f.useState(!1),h=a!==""&&a!==null&&a!==void 0;return l.jsxs("div",{className:"relative",children:[t==="default"?l.jsx("label",{className:k("top-[18px] font-medium ml-0.5 text-xs",n&&"text-red-9"),children:e}):null,l.jsxs("div",{className:k(t==="default"?"p-0":"pt-5 pb-2",{"bg-red-4 text-red-9":!!n}),children:[t==="floating"&&l.jsx("label",{className:k("absolute transition-all duration-200 pointer-events-none","text-sm top-2.5 font-semibold left-2.5",{"text-xs top-2.5":d||h||r,"text-red-9":!!n}),children:e}),l.jsx("textarea",{ref:c,className:k(!n&&d&&ni[o],"bg-base-3 border border-base-4 light-theme:drop-shadow-sm rounded-6 w-full focus-visible:outline-none customscrollbarnohide","placeholder:text-base-11 text-sm","resize-none",t==="default"?"p-3":"mt-1",{"text-red-9 placeholder:text-red-9":!!n},s),value:a,placeholder:r,onFocus:()=>m(!0),onBlur:()=>m(!1),rows:i,...u})]})]})});Bt.displayName="TextArea";const oi=({name:e,customRead:t,customSet:r,...n})=>{const{control:o}=J.useFormContext(),s=f.useCallback(i=>t?t(i):i===null?Mt(i):i,[t]),a=f.useCallback(i=>r?r(i):i===null?et(i):i,[r]);return o?l.jsx(J.Controller,{name:e,control:o,render:({field:i,fieldState:u})=>l.jsxs("div",{children:[l.jsx(Bt,{value:s(i.value),onChange:c=>i.onChange(a(c.target.value)),error:!!u.error,ref:i.ref,...n}),u.error?l.jsx("span",{role:"alert",className:"text-red-9 text-sm mt-1 ml-0.5",children:u.error.message}):null]})}):(console.error(`Form control is missing for field: ${e}`),l.jsxs("p",{children:["Form control missing for field: ",e]}))},si=["Lunes","Martes","Miercoles","Jueves","Viernes","Sábado","Domingo"],ai=()=>l.jsx(ii,{}),ii=()=>l.jsx("div",{children:si.map(e=>l.jsx(li,{day:e},e))}),li=({day:e})=>{const[t,r]=f.useState(!1),n=f.useRef(null);return f.useEffect(()=>{n.current&&Zr(n.current)},[]),l.jsxs("div",{ref:n,className:k("p-2 rounded-xl mt-2",{"border border-uielborder":t,"bg-uielbg border border-transparent":!t}),children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("p",{children:e}),l.jsx(on,{className:"mt-0",checked:t,onCheckedChange:o=>r(o)})]}),t?l.jsx(ci,{}):null]},e)},ci=()=>{const[e,t]=f.useState([{from:"08:00",to:"12:00"},{from:"14:00",to:"18:00"}]),r=f.useRef(null);return f.useEffect(()=>{r.current&&Zr(r.current)},[]),l.jsxs("div",{ref:r,children:[e.map((n,o)=>l.jsxs("div",{className:"flex items-center justify-between mt-2",children:[l.jsx("p",{className:"text-sm text-secondarytext",children:"De"}),l.jsx(G,{color:"solid",className:"w-24",children:n.from}),l.jsx("p",{className:"text-sm text-secondarytext mx-1",children:"a"}),l.jsx(G,{color:"solid",className:"w-24",children:n.to}),l.jsx(G,{className:"rounded-full",children:l.jsx(Y.X,{className:"text-secondarytext",size:20})})]},`${n.from}${o}`)),l.jsxs(G,{onClick:()=>t(n=>[...n,{from:"19:00",to:"21:00"}]),className:"w-full mt-4",color:"contrast",children:[l.jsx(Y.Plus,{className:"stroke-1"}),"Añadir hora"]})]})};exports.AliveScope=wa;exports.Avatar=vn;exports.AvatarsGroup=xn;exports.Button=G;exports.Calendar=Wt;exports.Checkbox=Ar;exports.DatePickerDemo=Qs;exports.DatePickerPopover=Js;exports.DateTimePicker=ea;exports.ElasticHeader=ta;exports.FocusTrap=pn;exports.Form=ma;exports.FormInput=ga;exports.FormMultiSelect=ja;exports.FormSelect=Ga;exports.FormSubmit=Ja;exports.FormTags=ri;exports.FormTextArea=oi;exports.FormWorkingHours=ai;exports.Icon=Br;exports.Input=_t;exports.KeepAlive=Ea;exports.List=$a;exports.ListItem=Ca;exports.ModalsProvider=Za;exports.MultiSelect=Vr;exports.PageScroller=Ma;exports.PageTitle=Ta;exports.PopoverCard=Rr;exports.PopoverCardContent=Ks;exports.PopoverCardFooter=Us;exports.PopoverCardHeader=Vs;exports.Portal=qe;exports.SearchInput=Pa;exports.SeeMoreText=Oa;exports.SegmentedControl=Ua;exports.Select=en;exports.Separator=Qa;exports.Spinner=tn;exports.SuperModal=ti;exports.Switch=on;exports.Tags=sn;exports.TextArea=Bt;exports.TimePicker=Zs;exports.calculatePopoverPosition=vr;exports.checkOverflow=We;exports.cn=k;exports.debounce=mn;exports.extractDirtyData=bn;exports.generateInitials=mr;exports.nullRead=Mt;exports.nullSet=et;exports.removeWhitespaces=br;exports.setFocusEnd=hr;exports.throttle=Pe;exports.toTitleCase=hn;exports.useClickAway=yn;exports.useClickAwayAdvanced=kn;exports.useClickAwayWithRef=ut;exports.useKeepAlive=Na;exports.useKeyListener=xr;exports.useLargeScreen=He;exports.useMergedRef=Dt;exports.useMethods=ha;exports.useModals=nn;exports.useOverflow=pr;exports.useOverflowState=gn;exports.usePopover=ct;exports.useRipple=gr;exports.useScroller=Da;