UNPKG

@angeluxee/cerberus-calendar

Version:

A highly configurable React calendar component with day, week, and month views

1 lines 141 kB
(function(I,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react/jsx-runtime"),require("react"),require("date-fns"),require("date-fns/locale"),require("class-variance-authority"),require("clsx"),require("tailwind-merge"),require("react-dom"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","date-fns","date-fns/locale","class-variance-authority","clsx","tailwind-merge","react-dom","lucide-react"],c):(I=typeof globalThis<"u"?globalThis:I||self,c(I.CerberusCalendar={},I["react/jsx-runtime"],I.React,I.dateFns,I.locale,I.cva,I.clsx,I.tailwindMerge,I.ReactDOM,I.LucideReact))})(this,function(I,c,V,G,bs,kt,vs,ys,Pt,Ee){"use strict";function Mr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const u=Mr(V),et=Mr(Pt),q=(e,t)=>G.format(e,t,{locale:bs.es}),Or=e=>{const t=G.startOfWeek(e,{weekStartsOn:1}),o=[];for(let n=0;n<7;n++)o.push(G.addDays(t,n));return o},Ir=e=>{const t=G.startOfMonth(e),o=G.endOfMonth(e),n=G.startOfWeek(t,{weekStartsOn:1}),s=G.endOfWeek(o,{weekStartsOn:1}),r=[];let a=n;for(;a<=s;)r.push(a),a=G.addDays(a,1);return r},_r=(e,t,o)=>{switch(o){case"day":return t==="prev"?G.subDays(e,1):G.addDays(e,1);case"week":return t==="prev"?G.subWeeks(e,1):G.addWeeks(e,1);case"month":return t==="prev"?G.subMonths(e,1):G.addMonths(e,1);default:return e}},Ue=(e,t)=>e.filter(o=>o.allDay?G.isSameDay(o.start,t):G.isWithinInterval(t,{start:G.startOfDay(o.start),end:G.endOfDay(o.end)})),hs=(e,t,o)=>e.filter(n=>G.isWithinInterval(n.start,{start:t,end:o})||G.isWithinInterval(n.end,{start:t,end:o})||n.start<=t&&n.end>=o),At=(e=0,t=24,o=30)=>{const n=[];for(let s=e;s<t;s++)for(let r=0;r<60;r+=o)n.push({hour:s,minute:r,date:new Date(0,0,0,s,r)});return n},Lr=(e,t,o)=>{const n=new Date(e.start),s=new Date(e.end),r=n.getHours()*60+n.getMinutes(),a=s.getHours()*60+s.getMinutes(),i=t*60,l=(r-i)/60*o,d=(a-r)/60*o;return{top:Math.max(0,l),height:Math.max(30,d)}},ws=(e,t=30)=>{const o=e.getMinutes(),n=Math.round(o/t)*t;return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),n)},ms=(e,t,o,n)=>{const s=e/n*60+o*60,r=Math.floor(s/60),a=s%60;return new Date(t.getFullYear(),t.getMonth(),t.getDate(),r,a)};function xs(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Fr(...e){return t=>e.forEach(o=>xs(o,t))}function X(...e){return u.useCallback(Fr(...e),e)}var De=u.forwardRef((e,t)=>{const{children:o,...n}=e,s=u.Children.toArray(o),r=s.find(Ss);if(r){const a=r.props.children,i=s.map(l=>l===r?u.Children.count(a)>1?u.Children.only(null):u.isValidElement(a)?a.props.children:null:l);return c.jsx(Mt,{...n,ref:t,children:u.isValidElement(a)?u.cloneElement(a,void 0,i):null})}return c.jsx(Mt,{...n,ref:t,children:o})});De.displayName="Slot";var Mt=u.forwardRef((e,t)=>{const{children:o,...n}=e;if(u.isValidElement(o)){const s=Es(o);return u.cloneElement(o,{...Ns(n,o.props),ref:t?Fr(t,s):s})}return u.Children.count(o)>1?u.Children.only(null):null});Mt.displayName="SlotClone";var Cs=({children:e})=>c.jsx(c.Fragment,{children:e});function Ss(e){return u.isValidElement(e)&&e.type===Cs}function Ns(e,t){const o={...t};for(const n in t){const s=e[n],r=t[n];/^on[A-Z]/.test(n)?s&&r?o[n]=(...i)=>{r(...i),s(...i)}:s&&(o[n]=s):n==="style"?o[n]={...s,...r}:n==="className"&&(o[n]=[s,r].filter(Boolean).join(" "))}return{...e,...o}}function Es(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,o=t&&"isReactWarning"in t&&t.isReactWarning;return o?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,o=t&&"isReactWarning"in t&&t.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}function H(...e){return ys.twMerge(vs.clsx(e))}const Ds=kt.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ve=u.forwardRef(({className:e,variant:t,size:o,asChild:n=!1,...s},r)=>{const a=n?De:"button";return c.jsx(a,{className:H(Ds({variant:t,size:o,className:e})),ref:r,...s})});ve.displayName="Button";function Hr(e,[t,o]){return Math.min(o,Math.max(t,e))}function U(e,t,{checkForDefaultPrevented:o=!0}={}){return function(s){if(e==null||e(s),o===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function Ts(e,t=[]){let o=[];function n(r,a){const i=u.createContext(a),l=o.length;o=[...o,a];function d(f){const{scope:b,children:v,...h}=f,p=(b==null?void 0:b[e][l])||i,y=u.useMemo(()=>h,Object.values(h));return c.jsx(p.Provider,{value:y,children:v})}function g(f,b){const v=(b==null?void 0:b[e][l])||i,h=u.useContext(v);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${r}\``)}return d.displayName=r+"Provider",[d,g]}const s=()=>{const r=o.map(a=>u.createContext(a));return function(i){const l=(i==null?void 0:i[e])||r;return u.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return s.scopeName=e,[n,ks(s,...t)]}function ks(...e){const t=e[0];if(e.length===1)return t;const o=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(r){const a=n.reduce((i,{useScope:l,scopeName:d})=>{const f=l(r)[`__scope${d}`];return{...i,...f}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return o.scopeName=t.scopeName,o}function Ps(e){const t=e+"CollectionProvider",[o,n]=Ts(t),[s,r]=o(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:h,children:p}=v,y=V.useRef(null),m=V.useRef(new Map).current;return c.jsx(s,{scope:h,itemMap:m,collectionRef:y,children:p})};a.displayName=t;const i=e+"CollectionSlot",l=V.forwardRef((v,h)=>{const{scope:p,children:y}=v,m=r(i,p),w=X(h,m.collectionRef);return c.jsx(De,{ref:w,children:y})});l.displayName=i;const d=e+"CollectionItemSlot",g="data-radix-collection-item",f=V.forwardRef((v,h)=>{const{scope:p,children:y,...m}=v,w=V.useRef(null),x=X(h,w),S=r(d,p);return V.useEffect(()=>(S.itemMap.set(w,{ref:w,...m}),()=>void S.itemMap.delete(w))),c.jsx(De,{[g]:"",ref:x,children:y})});f.displayName=d;function b(v){const h=r(e+"CollectionConsumer",v);return V.useCallback(()=>{const y=h.collectionRef.current;if(!y)return[];const m=Array.from(y.querySelectorAll(`[${g}]`));return Array.from(h.itemMap.values()).sort((S,N)=>m.indexOf(S.ref.current)-m.indexOf(N.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:a,Slot:l,ItemSlot:f},b,n]}function As(e,t){const o=u.createContext(t),n=r=>{const{children:a,...i}=r,l=u.useMemo(()=>i,Object.values(i));return c.jsx(o.Provider,{value:l,children:a})};n.displayName=e+"Provider";function s(r){const a=u.useContext(o);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}return[n,s]}function Ot(e,t=[]){let o=[];function n(r,a){const i=u.createContext(a),l=o.length;o=[...o,a];const d=f=>{var m;const{scope:b,children:v,...h}=f,p=((m=b==null?void 0:b[e])==null?void 0:m[l])||i,y=u.useMemo(()=>h,Object.values(h));return c.jsx(p.Provider,{value:y,children:v})};d.displayName=r+"Provider";function g(f,b){var p;const v=((p=b==null?void 0:b[e])==null?void 0:p[l])||i,h=u.useContext(v);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${r}\``)}return[d,g]}const s=()=>{const r=o.map(a=>u.createContext(a));return function(i){const l=(i==null?void 0:i[e])||r;return u.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return s.scopeName=e,[n,Ms(s,...t)]}function Ms(...e){const t=e[0];if(e.length===1)return t;const o=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(r){const a=n.reduce((i,{useScope:l,scopeName:d})=>{const f=l(r)[`__scope${d}`];return{...i,...f}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return o.scopeName=t.scopeName,o}var Os=u.createContext(void 0);function Is(e){const t=u.useContext(Os);return e||t||"ltr"}var _s=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],z=_s.reduce((e,t)=>{const o=u.forwardRef((n,s)=>{const{asChild:r,...a}=n,i=r?De:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(i,{...a,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function Ls(e,t){e&&et.flushSync(()=>e.dispatchEvent(t))}function pe(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...o)=>{var n;return(n=t.current)==null?void 0:n.call(t,...o)},[])}function Fs(e,t=globalThis==null?void 0:globalThis.document){const o=pe(e);u.useEffect(()=>{const n=s=>{s.key==="Escape"&&o(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[o,t])}var Hs="DismissableLayer",It="dismissableLayer.update",Bs="dismissableLayer.pointerDownOutside",$s="dismissableLayer.focusOutside",Br,$r=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_t=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:r,onInteractOutside:a,onDismiss:i,...l}=e,d=u.useContext($r),[g,f]=u.useState(null),b=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=u.useState({}),h=X(t,T=>f(T)),p=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),m=p.indexOf(y),w=g?p.indexOf(g):-1,x=d.layersWithOutsidePointerEventsDisabled.size>0,S=w>=m,N=zs(T=>{const F=T.target,$=[...d.branches].some(A=>A.contains(F));!S||$||(s==null||s(T),a==null||a(T),T.defaultPrevented||i==null||i())},b),_=Rs(T=>{const F=T.target;[...d.branches].some(A=>A.contains(F))||(r==null||r(T),a==null||a(T),T.defaultPrevented||i==null||i())},b);return Fs(T=>{w===d.layers.size-1&&(n==null||n(T),!T.defaultPrevented&&i&&(T.preventDefault(),i()))},b),u.useEffect(()=>{if(g)return o&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Br=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(g)),d.layers.add(g),Wr(),()=>{o&&d.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=Br)}},[g,b,o,d]),u.useEffect(()=>()=>{g&&(d.layers.delete(g),d.layersWithOutsidePointerEventsDisabled.delete(g),Wr())},[g,d]),u.useEffect(()=>{const T=()=>v({});return document.addEventListener(It,T),()=>document.removeEventListener(It,T)},[]),c.jsx(z.div,{...l,ref:h,style:{pointerEvents:x?S?"auto":"none":void 0,...e.style},onFocusCapture:U(e.onFocusCapture,_.onFocusCapture),onBlurCapture:U(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:U(e.onPointerDownCapture,N.onPointerDownCapture)})});_t.displayName=Hs;var Ws="DismissableLayerBranch",Vs=u.forwardRef((e,t)=>{const o=u.useContext($r),n=u.useRef(null),s=X(t,n);return u.useEffect(()=>{const r=n.current;if(r)return o.branches.add(r),()=>{o.branches.delete(r)}},[o.branches]),c.jsx(z.div,{...e,ref:s})});Vs.displayName=Ws;function zs(e,t=globalThis==null?void 0:globalThis.document){const o=pe(e),n=u.useRef(!1),s=u.useRef(()=>{});return u.useEffect(()=>{const r=i=>{if(i.target&&!n.current){let l=function(){Vr(Bs,o,d,{discrete:!0})};const d={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=l,t.addEventListener("click",s.current,{once:!0})):l()}else t.removeEventListener("click",s.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",r)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",r),t.removeEventListener("click",s.current)}},[t,o]),{onPointerDownCapture:()=>n.current=!0}}function Rs(e,t=globalThis==null?void 0:globalThis.document){const o=pe(e),n=u.useRef(!1);return u.useEffect(()=>{const s=r=>{r.target&&!n.current&&Vr($s,o,{originalEvent:r},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,o]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Wr(){const e=new CustomEvent(It);document.dispatchEvent(e)}function Vr(e,t,o,{discrete:n}){const s=o.originalEvent.target,r=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:o});t&&s.addEventListener(e,t,{once:!0}),n?Ls(s,r):s.dispatchEvent(r)}var Lt=0;function zr(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Rr()),document.body.insertAdjacentElement("beforeend",e[1]??Rr()),Lt++,()=>{Lt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Lt--}},[])}function Rr(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ft="focusScope.autoFocusOnMount",Ht="focusScope.autoFocusOnUnmount",jr={bubbles:!1,cancelable:!0},js="FocusScope",Bt=u.forwardRef((e,t)=>{const{loop:o=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:r,...a}=e,[i,l]=u.useState(null),d=pe(s),g=pe(r),f=u.useRef(null),b=X(t,p=>l(p)),v=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(n){let p=function(x){if(v.paused||!i)return;const S=x.target;i.contains(S)?f.current=S:ye(f.current,{select:!0})},y=function(x){if(v.paused||!i)return;const S=x.relatedTarget;S!==null&&(i.contains(S)||ye(f.current,{select:!0}))},m=function(x){if(document.activeElement===document.body)for(const N of x)N.removedNodes.length>0&&ye(i)};document.addEventListener("focusin",p),document.addEventListener("focusout",y);const w=new MutationObserver(m);return i&&w.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",y),w.disconnect()}}},[n,i,v.paused]),u.useEffect(()=>{if(i){Yr.add(v);const p=document.activeElement;if(!i.contains(p)){const m=new CustomEvent(Ft,jr);i.addEventListener(Ft,d),i.dispatchEvent(m),m.defaultPrevented||(Us(qs(Ur(i)),{select:!0}),document.activeElement===p&&ye(i))}return()=>{i.removeEventListener(Ft,d),setTimeout(()=>{const m=new CustomEvent(Ht,jr);i.addEventListener(Ht,g),i.dispatchEvent(m),m.defaultPrevented||ye(p??document.body,{select:!0}),i.removeEventListener(Ht,g),Yr.remove(v)},0)}}},[i,d,g,v]);const h=u.useCallback(p=>{if(!o&&!n||v.paused)return;const y=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,m=document.activeElement;if(y&&m){const w=p.currentTarget,[x,S]=Ks(w);x&&S?!p.shiftKey&&m===S?(p.preventDefault(),o&&ye(x,{select:!0})):p.shiftKey&&m===x&&(p.preventDefault(),o&&ye(S,{select:!0})):m===w&&p.preventDefault()}},[o,n,v.paused]);return c.jsx(z.div,{tabIndex:-1,...a,ref:b,onKeyDown:h})});Bt.displayName=js;function Us(e,{select:t=!1}={}){const o=document.activeElement;for(const n of e)if(ye(n,{select:t}),document.activeElement!==o)return}function Ks(e){const t=Ur(e),o=Kr(t,e),n=Kr(t.reverse(),e);return[o,n]}function Ur(e){const t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;o.nextNode();)t.push(o.currentNode);return t}function Kr(e,t){for(const o of e)if(!Ys(o,{upTo:t}))return o}function Ys(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Gs(e){return e instanceof HTMLInputElement&&"select"in e}function ye(e,{select:t=!1}={}){if(e&&e.focus){const o=document.activeElement;e.focus({preventScroll:!0}),e!==o&&Gs(e)&&t&&e.select()}}var Yr=Xs();function Xs(){let e=[];return{add(t){const o=e[0];t!==o&&(o==null||o.pause()),e=Gr(e,t),e.unshift(t)},remove(t){var o;e=Gr(e,t),(o=e[0])==null||o.resume()}}}function Gr(e,t){const o=[...e],n=o.indexOf(t);return n!==-1&&o.splice(n,1),o}function qs(e){return e.filter(t=>t.tagName!=="A")}var J=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},Zs=u.useId||(()=>{}),Qs=0;function _e(e){const[t,o]=u.useState(Zs());return J(()=>{o(n=>n??String(Qs++))},[e]),t?`radix-${t}`:""}const Js=["top","right","bottom","left"],he=Math.min,ee=Math.max,tt=Math.round,rt=Math.floor,we=e=>({x:e,y:e}),ea={left:"right",right:"left",bottom:"top",top:"bottom"},ta={start:"end",end:"start"};function $t(e,t,o){return ee(e,he(t,o))}function ge(e,t){return typeof e=="function"?e(t):e}function be(e){return e.split("-")[0]}function Le(e){return e.split("-")[1]}function Wt(e){return e==="x"?"y":"x"}function Vt(e){return e==="y"?"height":"width"}function me(e){return["top","bottom"].includes(be(e))?"y":"x"}function zt(e){return Wt(me(e))}function ra(e,t,o){o===void 0&&(o=!1);const n=Le(e),s=zt(e),r=Vt(s);let a=s==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(a=ot(a)),[a,ot(a)]}function oa(e){const t=ot(e);return[Rt(e),t,Rt(t)]}function Rt(e){return e.replace(/start|end/g,t=>ta[t])}function na(e,t,o){const n=["left","right"],s=["right","left"],r=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return o?t?s:n:t?n:s;case"left":case"right":return t?r:a;default:return[]}}function sa(e,t,o,n){const s=Le(e);let r=na(be(e),o==="start",n);return s&&(r=r.map(a=>a+"-"+s),t&&(r=r.concat(r.map(Rt)))),r}function ot(e){return e.replace(/left|right|bottom|top/g,t=>ea[t])}function aa(e){return{top:0,right:0,bottom:0,left:0,...e}}function Xr(e){return typeof e!="number"?aa(e):{top:e,right:e,bottom:e,left:e}}function nt(e){const{x:t,y:o,width:n,height:s}=e;return{width:n,height:s,top:o,left:t,right:t+n,bottom:o+s,x:t,y:o}}function qr(e,t,o){let{reference:n,floating:s}=e;const r=me(t),a=zt(t),i=Vt(a),l=be(t),d=r==="y",g=n.x+n.width/2-s.width/2,f=n.y+n.height/2-s.height/2,b=n[i]/2-s[i]/2;let v;switch(l){case"top":v={x:g,y:n.y-s.height};break;case"bottom":v={x:g,y:n.y+n.height};break;case"right":v={x:n.x+n.width,y:f};break;case"left":v={x:n.x-s.width,y:f};break;default:v={x:n.x,y:n.y}}switch(Le(t)){case"start":v[a]-=b*(o&&d?-1:1);break;case"end":v[a]+=b*(o&&d?-1:1);break}return v}const ia=async(e,t,o)=>{const{placement:n="bottom",strategy:s="absolute",middleware:r=[],platform:a}=o,i=r.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:g,y:f}=qr(d,n,l),b=n,v={},h=0;for(let p=0;p<i.length;p++){const{name:y,fn:m}=i[p],{x:w,y:x,data:S,reset:N}=await m({x:g,y:f,initialPlacement:n,placement:b,strategy:s,middlewareData:v,rects:d,platform:a,elements:{reference:e,floating:t}});g=w??g,f=x??f,v={...v,[y]:{...v[y],...S}},N&&h<=50&&(h++,typeof N=="object"&&(N.placement&&(b=N.placement),N.rects&&(d=N.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):N.rects),{x:g,y:f}=qr(d,b,l)),p=-1)}return{x:g,y:f,placement:b,strategy:s,middlewareData:v}};async function Ke(e,t){var o;t===void 0&&(t={});const{x:n,y:s,platform:r,rects:a,elements:i,strategy:l}=e,{boundary:d="clippingAncestors",rootBoundary:g="viewport",elementContext:f="floating",altBoundary:b=!1,padding:v=0}=ge(t,e),h=Xr(v),y=i[b?f==="floating"?"reference":"floating":f],m=nt(await r.getClippingRect({element:(o=await(r.isElement==null?void 0:r.isElement(y)))==null||o?y:y.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(i.floating)),boundary:d,rootBoundary:g,strategy:l})),w=f==="floating"?{x:n,y:s,width:a.floating.width,height:a.floating.height}:a.reference,x=await(r.getOffsetParent==null?void 0:r.getOffsetParent(i.floating)),S=await(r.isElement==null?void 0:r.isElement(x))?await(r.getScale==null?void 0:r.getScale(x))||{x:1,y:1}:{x:1,y:1},N=nt(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:w,offsetParent:x,strategy:l}):w);return{top:(m.top-N.top+h.top)/S.y,bottom:(N.bottom-m.bottom+h.bottom)/S.y,left:(m.left-N.left+h.left)/S.x,right:(N.right-m.right+h.right)/S.x}}const ca=e=>({name:"arrow",options:e,async fn(t){const{x:o,y:n,placement:s,rects:r,platform:a,elements:i,middlewareData:l}=t,{element:d,padding:g=0}=ge(e,t)||{};if(d==null)return{};const f=Xr(g),b={x:o,y:n},v=zt(s),h=Vt(v),p=await a.getDimensions(d),y=v==="y",m=y?"top":"left",w=y?"bottom":"right",x=y?"clientHeight":"clientWidth",S=r.reference[h]+r.reference[v]-b[v]-r.floating[h],N=b[v]-r.reference[v],_=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let T=_?_[x]:0;(!T||!await(a.isElement==null?void 0:a.isElement(_)))&&(T=i.floating[x]||r.floating[h]);const F=S/2-N/2,$=T/2-p[h]/2-1,A=he(f[m],$),k=he(f[w],$),L=A,O=T-p[h]-k,C=T/2-p[h]/2+F,M=$t(L,C,O),E=!l.arrow&&Le(s)!=null&&C!==M&&r.reference[h]/2-(C<L?A:k)-p[h]/2<0,D=E?C<L?C-L:C-O:0;return{[v]:b[v]+D,data:{[v]:M,centerOffset:C-M-D,...E&&{alignmentOffset:D}},reset:E}}}),la=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,n;const{placement:s,middlewareData:r,rects:a,initialPlacement:i,platform:l,elements:d}=t,{mainAxis:g=!0,crossAxis:f=!0,fallbackPlacements:b,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:p=!0,...y}=ge(e,t);if((o=r.arrow)!=null&&o.alignmentOffset)return{};const m=be(s),w=me(i),x=be(i)===i,S=await(l.isRTL==null?void 0:l.isRTL(d.floating)),N=b||(x||!p?[ot(i)]:oa(i)),_=h!=="none";!b&&_&&N.push(...sa(i,p,h,S));const T=[i,...N],F=await Ke(t,y),$=[];let A=((n=r.flip)==null?void 0:n.overflows)||[];if(g&&$.push(F[m]),f){const C=ra(s,a,S);$.push(F[C[0]],F[C[1]])}if(A=[...A,{placement:s,overflows:$}],!$.every(C=>C<=0)){var k,L;const C=(((k=r.flip)==null?void 0:k.index)||0)+1,M=T[C];if(M)return{data:{index:C,overflows:A},reset:{placement:M}};let E=(L=A.filter(D=>D.overflows[0]<=0).sort((D,P)=>D.overflows[1]-P.overflows[1])[0])==null?void 0:L.placement;if(!E)switch(v){case"bestFit":{var O;const D=(O=A.filter(P=>{if(_){const W=me(P.placement);return W===w||W==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(W=>W>0).reduce((W,Z)=>W+Z,0)]).sort((P,W)=>P[1]-W[1])[0])==null?void 0:O[0];D&&(E=D);break}case"initialPlacement":E=i;break}if(s!==E)return{reset:{placement:E}}}return{}}}};function Zr(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Qr(e){return Js.some(t=>e[t]>=0)}const da=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:o}=t,{strategy:n="referenceHidden",...s}=ge(e,t);switch(n){case"referenceHidden":{const r=await Ke(t,{...s,elementContext:"reference"}),a=Zr(r,o.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Qr(a)}}}case"escaped":{const r=await Ke(t,{...s,altBoundary:!0}),a=Zr(r,o.floating);return{data:{escapedOffsets:a,escaped:Qr(a)}}}default:return{}}}}};async function ua(e,t){const{placement:o,platform:n,elements:s}=e,r=await(n.isRTL==null?void 0:n.isRTL(s.floating)),a=be(o),i=Le(o),l=me(o)==="y",d=["left","top"].includes(a)?-1:1,g=r&&l?-1:1,f=ge(t,e);let{mainAxis:b,crossAxis:v,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return i&&typeof h=="number"&&(v=i==="end"?h*-1:h),l?{x:v*g,y:b*d}:{x:b*d,y:v*g}}const fa=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,n;const{x:s,y:r,placement:a,middlewareData:i}=t,l=await ua(t,e);return a===((o=i.offset)==null?void 0:o.placement)&&(n=i.arrow)!=null&&n.alignmentOffset?{}:{x:s+l.x,y:r+l.y,data:{...l,placement:a}}}}},pa=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:n,placement:s}=t,{mainAxis:r=!0,crossAxis:a=!1,limiter:i={fn:y=>{let{x:m,y:w}=y;return{x:m,y:w}}},...l}=ge(e,t),d={x:o,y:n},g=await Ke(t,l),f=me(be(s)),b=Wt(f);let v=d[b],h=d[f];if(r){const y=b==="y"?"top":"left",m=b==="y"?"bottom":"right",w=v+g[y],x=v-g[m];v=$t(w,v,x)}if(a){const y=f==="y"?"top":"left",m=f==="y"?"bottom":"right",w=h+g[y],x=h-g[m];h=$t(w,h,x)}const p=i.fn({...t,[b]:v,[f]:h});return{...p,data:{x:p.x-o,y:p.y-n,enabled:{[b]:r,[f]:a}}}}}},ga=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:o,y:n,placement:s,rects:r,middlewareData:a}=t,{offset:i=0,mainAxis:l=!0,crossAxis:d=!0}=ge(e,t),g={x:o,y:n},f=me(s),b=Wt(f);let v=g[b],h=g[f];const p=ge(i,t),y=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const x=b==="y"?"height":"width",S=r.reference[b]-r.floating[x]+y.mainAxis,N=r.reference[b]+r.reference[x]-y.mainAxis;v<S?v=S:v>N&&(v=N)}if(d){var m,w;const x=b==="y"?"width":"height",S=["top","left"].includes(be(s)),N=r.reference[f]-r.floating[x]+(S&&((m=a.offset)==null?void 0:m[f])||0)+(S?0:y.crossAxis),_=r.reference[f]+r.reference[x]+(S?0:((w=a.offset)==null?void 0:w[f])||0)-(S?y.crossAxis:0);h<N?h=N:h>_&&(h=_)}return{[b]:v,[f]:h}}}},ba=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var o,n;const{placement:s,rects:r,platform:a,elements:i}=t,{apply:l=()=>{},...d}=ge(e,t),g=await Ke(t,d),f=be(s),b=Le(s),v=me(s)==="y",{width:h,height:p}=r.floating;let y,m;f==="top"||f==="bottom"?(y=f,m=b===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(m=f,y=b==="end"?"top":"bottom");const w=p-g.top-g.bottom,x=h-g.left-g.right,S=he(p-g[y],w),N=he(h-g[m],x),_=!t.middlewareData.shift;let T=S,F=N;if((o=t.middlewareData.shift)!=null&&o.enabled.x&&(F=x),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(T=w),_&&!b){const A=ee(g.left,0),k=ee(g.right,0),L=ee(g.top,0),O=ee(g.bottom,0);v?F=h-2*(A!==0||k!==0?A+k:ee(g.left,g.right)):T=p-2*(L!==0||O!==0?L+O:ee(g.top,g.bottom))}await l({...t,availableWidth:F,availableHeight:T});const $=await a.getDimensions(i.floating);return h!==$.width||p!==$.height?{reset:{rects:!0}}:{}}}};function st(){return typeof window<"u"}function Fe(e){return Jr(e)?(e.nodeName||"").toLowerCase():"#document"}function te(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ce(e){var t;return(t=(Jr(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Jr(e){return st()?e instanceof Node||e instanceof te(e).Node:!1}function oe(e){return st()?e instanceof Element||e instanceof te(e).Element:!1}function le(e){return st()?e instanceof HTMLElement||e instanceof te(e).HTMLElement:!1}function eo(e){return!st()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof te(e).ShadowRoot}function Ye(e){const{overflow:t,overflowX:o,overflowY:n,display:s}=ne(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+o)&&!["inline","contents"].includes(s)}function va(e){return["table","td","th"].includes(Fe(e))}function at(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function jt(e){const t=Ut(),o=oe(e)?ne(e):e;return o.transform!=="none"||o.perspective!=="none"||(o.containerType?o.containerType!=="normal":!1)||!t&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!t&&(o.filter?o.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(o.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(o.contain||"").includes(n))}function ya(e){let t=xe(e);for(;le(t)&&!He(t);){if(jt(t))return t;if(at(t))return null;t=xe(t)}return null}function Ut(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function He(e){return["html","body","#document"].includes(Fe(e))}function ne(e){return te(e).getComputedStyle(e)}function it(e){return oe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xe(e){if(Fe(e)==="html")return e;const t=e.assignedSlot||e.parentNode||eo(e)&&e.host||ce(e);return eo(t)?t.host:t}function to(e){const t=xe(e);return He(t)?e.ownerDocument?e.ownerDocument.body:e.body:le(t)&&Ye(t)?t:to(t)}function Ge(e,t,o){var n;t===void 0&&(t=[]),o===void 0&&(o=!0);const s=to(e),r=s===((n=e.ownerDocument)==null?void 0:n.body),a=te(s);if(r){const i=Kt(a);return t.concat(a,a.visualViewport||[],Ye(s)?s:[],i&&o?Ge(i):[])}return t.concat(s,Ge(s,[],o))}function Kt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ro(e){const t=ne(e);let o=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const s=le(e),r=s?e.offsetWidth:o,a=s?e.offsetHeight:n,i=tt(o)!==r||tt(n)!==a;return i&&(o=r,n=a),{width:o,height:n,$:i}}function Yt(e){return oe(e)?e:e.contextElement}function Be(e){const t=Yt(e);if(!le(t))return we(1);const o=t.getBoundingClientRect(),{width:n,height:s,$:r}=ro(t);let a=(r?tt(o.width):o.width)/n,i=(r?tt(o.height):o.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const ha=we(0);function oo(e){const t=te(e);return!Ut()||!t.visualViewport?ha:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function wa(e,t,o){return t===void 0&&(t=!1),!o||t&&o!==te(e)?!1:t}function Te(e,t,o,n){t===void 0&&(t=!1),o===void 0&&(o=!1);const s=e.getBoundingClientRect(),r=Yt(e);let a=we(1);t&&(n?oe(n)&&(a=Be(n)):a=Be(e));const i=wa(r,o,n)?oo(r):we(0);let l=(s.left+i.x)/a.x,d=(s.top+i.y)/a.y,g=s.width/a.x,f=s.height/a.y;if(r){const b=te(r),v=n&&oe(n)?te(n):n;let h=b,p=Kt(h);for(;p&&n&&v!==h;){const y=Be(p),m=p.getBoundingClientRect(),w=ne(p),x=m.left+(p.clientLeft+parseFloat(w.paddingLeft))*y.x,S=m.top+(p.clientTop+parseFloat(w.paddingTop))*y.y;l*=y.x,d*=y.y,g*=y.x,f*=y.y,l+=x,d+=S,h=te(p),p=Kt(h)}}return nt({width:g,height:f,x:l,y:d})}function ma(e){let{elements:t,rect:o,offsetParent:n,strategy:s}=e;const r=s==="fixed",a=ce(n),i=t?at(t.floating):!1;if(n===a||i&&r)return o;let l={scrollLeft:0,scrollTop:0},d=we(1);const g=we(0),f=le(n);if((f||!f&&!r)&&((Fe(n)!=="body"||Ye(a))&&(l=it(n)),le(n))){const b=Te(n);d=Be(n),g.x=b.x+n.clientLeft,g.y=b.y+n.clientTop}return{width:o.width*d.x,height:o.height*d.y,x:o.x*d.x-l.scrollLeft*d.x+g.x,y:o.y*d.y-l.scrollTop*d.y+g.y}}function xa(e){return Array.from(e.getClientRects())}function Gt(e,t){const o=it(e).scrollLeft;return t?t.left+o:Te(ce(e)).left+o}function Ca(e){const t=ce(e),o=it(e),n=e.ownerDocument.body,s=ee(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),r=ee(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let a=-o.scrollLeft+Gt(e);const i=-o.scrollTop;return ne(n).direction==="rtl"&&(a+=ee(t.clientWidth,n.clientWidth)-s),{width:s,height:r,x:a,y:i}}function Sa(e,t){const o=te(e),n=ce(e),s=o.visualViewport;let r=n.clientWidth,a=n.clientHeight,i=0,l=0;if(s){r=s.width,a=s.height;const d=Ut();(!d||d&&t==="fixed")&&(i=s.offsetLeft,l=s.offsetTop)}return{width:r,height:a,x:i,y:l}}function Na(e,t){const o=Te(e,!0,t==="fixed"),n=o.top+e.clientTop,s=o.left+e.clientLeft,r=le(e)?Be(e):we(1),a=e.clientWidth*r.x,i=e.clientHeight*r.y,l=s*r.x,d=n*r.y;return{width:a,height:i,x:l,y:d}}function no(e,t,o){let n;if(t==="viewport")n=Sa(e,o);else if(t==="document")n=Ca(ce(e));else if(oe(t))n=Na(t,o);else{const s=oo(e);n={...t,x:t.x-s.x,y:t.y-s.y}}return nt(n)}function so(e,t){const o=xe(e);return o===t||!oe(o)||He(o)?!1:ne(o).position==="fixed"||so(o,t)}function Ea(e,t){const o=t.get(e);if(o)return o;let n=Ge(e,[],!1).filter(i=>oe(i)&&Fe(i)!=="body"),s=null;const r=ne(e).position==="fixed";let a=r?xe(e):e;for(;oe(a)&&!He(a);){const i=ne(a),l=jt(a);!l&&i.position==="fixed"&&(s=null),(r?!l&&!s:!l&&i.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||Ye(a)&&!l&&so(e,a))?n=n.filter(g=>g!==a):s=i,a=xe(a)}return t.set(e,n),n}function Da(e){let{element:t,boundary:o,rootBoundary:n,strategy:s}=e;const a=[...o==="clippingAncestors"?at(t)?[]:Ea(t,this._c):[].concat(o),n],i=a[0],l=a.reduce((d,g)=>{const f=no(t,g,s);return d.top=ee(f.top,d.top),d.right=he(f.right,d.right),d.bottom=he(f.bottom,d.bottom),d.left=ee(f.left,d.left),d},no(t,i,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Ta(e){const{width:t,height:o}=ro(e);return{width:t,height:o}}function ka(e,t,o){const n=le(t),s=ce(t),r=o==="fixed",a=Te(e,!0,r,t);let i={scrollLeft:0,scrollTop:0};const l=we(0);if(n||!n&&!r)if((Fe(t)!=="body"||Ye(s))&&(i=it(t)),n){const v=Te(t,!0,r,t);l.x=v.x+t.clientLeft,l.y=v.y+t.clientTop}else s&&(l.x=Gt(s));let d=0,g=0;if(s&&!n&&!r){const v=s.getBoundingClientRect();g=v.top+i.scrollTop,d=v.left+i.scrollLeft-Gt(s,v)}const f=a.left+i.scrollLeft-l.x-d,b=a.top+i.scrollTop-l.y-g;return{x:f,y:b,width:a.width,height:a.height}}function Xt(e){return ne(e).position==="static"}function ao(e,t){if(!le(e)||ne(e).position==="fixed")return null;if(t)return t(e);let o=e.offsetParent;return ce(e)===o&&(o=o.ownerDocument.body),o}function io(e,t){const o=te(e);if(at(e))return o;if(!le(e)){let s=xe(e);for(;s&&!He(s);){if(oe(s)&&!Xt(s))return s;s=xe(s)}return o}let n=ao(e,t);for(;n&&va(n)&&Xt(n);)n=ao(n,t);return n&&He(n)&&Xt(n)&&!jt(n)?o:n||ya(e)||o}const Pa=async function(e){const t=this.getOffsetParent||io,o=this.getDimensions,n=await o(e.floating);return{reference:ka(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Aa(e){return ne(e).direction==="rtl"}const Ma={convertOffsetParentRelativeRectToViewportRelativeRect:ma,getDocumentElement:ce,getClippingRect:Da,getOffsetParent:io,getElementRects:Pa,getClientRects:xa,getDimensions:Ta,getScale:Be,isElement:oe,isRTL:Aa};function Oa(e,t){let o=null,n;const s=ce(e);function r(){var i;clearTimeout(n),(i=o)==null||i.disconnect(),o=null}function a(i,l){i===void 0&&(i=!1),l===void 0&&(l=1),r();const{left:d,top:g,width:f,height:b}=e.getBoundingClientRect();if(i||t(),!f||!b)return;const v=rt(g),h=rt(s.clientWidth-(d+f)),p=rt(s.clientHeight-(g+b)),y=rt(d),w={rootMargin:-v+"px "+-h+"px "+-p+"px "+-y+"px",threshold:ee(0,he(1,l))||1};let x=!0;function S(N){const _=N[0].intersectionRatio;if(_!==l){if(!x)return a();_?a(!1,_):n=setTimeout(()=>{a(!1,1e-7)},1e3)}x=!1}try{o=new IntersectionObserver(S,{...w,root:s.ownerDocument})}catch{o=new IntersectionObserver(S,w)}o.observe(e)}return a(!0),r}function Ia(e,t,o,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:r=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,d=Yt(e),g=s||r?[...d?Ge(d):[],...Ge(t)]:[];g.forEach(m=>{s&&m.addEventListener("scroll",o,{passive:!0}),r&&m.addEventListener("resize",o)});const f=d&&i?Oa(d,o):null;let b=-1,v=null;a&&(v=new ResizeObserver(m=>{let[w]=m;w&&w.target===d&&v&&(v.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var x;(x=v)==null||x.observe(t)})),o()}),d&&!l&&v.observe(d),v.observe(t));let h,p=l?Te(e):null;l&&y();function y(){const m=Te(e);p&&(m.x!==p.x||m.y!==p.y||m.width!==p.width||m.height!==p.height)&&o(),p=m,h=requestAnimationFrame(y)}return o(),()=>{var m;g.forEach(w=>{s&&w.removeEventListener("scroll",o),r&&w.removeEventListener("resize",o)}),f==null||f(),(m=v)==null||m.disconnect(),v=null,l&&cancelAnimationFrame(h)}}const _a=fa,La=pa,Fa=la,Ha=ba,Ba=da,co=ca,$a=ga,Wa=(e,t,o)=>{const n=new Map,s={platform:Ma,...o},r={...s.platform,_c:n};return ia(e,t,{...s,platform:r})};var ct=typeof document<"u"?V.useLayoutEffect:V.useEffect;function lt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let o,n,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(o=e.length,o!==t.length)return!1;for(n=o;n--!==0;)if(!lt(e[n],t[n]))return!1;return!0}if(s=Object.keys(e),o=s.length,o!==Object.keys(t).length)return!1;for(n=o;n--!==0;)if(!{}.hasOwnProperty.call(t,s[n]))return!1;for(n=o;n--!==0;){const r=s[n];if(!(r==="_owner"&&e.$$typeof)&&!lt(e[r],t[r]))return!1}return!0}return e!==e&&t!==t}function lo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function uo(e,t){const o=lo(e);return Math.round(t*o)/o}function qt(e){const t=u.useRef(e);return ct(()=>{t.current=e}),t}function Va(e){e===void 0&&(e={});const{placement:t="bottom",strategy:o="absolute",middleware:n=[],platform:s,elements:{reference:r,floating:a}={},transform:i=!0,whileElementsMounted:l,open:d}=e,[g,f]=u.useState({x:0,y:0,strategy:o,placement:t,middlewareData:{},isPositioned:!1}),[b,v]=u.useState(n);lt(b,n)||v(n);const[h,p]=u.useState(null),[y,m]=u.useState(null),w=u.useCallback(P=>{P!==_.current&&(_.current=P,p(P))},[]),x=u.useCallback(P=>{P!==T.current&&(T.current=P,m(P))},[]),S=r||h,N=a||y,_=u.useRef(null),T=u.useRef(null),F=u.useRef(g),$=l!=null,A=qt(l),k=qt(s),L=qt(d),O=u.useCallback(()=>{if(!_.current||!T.current)return;const P={placement:t,strategy:o,middleware:b};k.current&&(P.platform=k.current),Wa(_.current,T.current,P).then(W=>{const Z={...W,isPositioned:L.current!==!1};C.current&&!lt(F.current,Z)&&(F.current=Z,et.flushSync(()=>{f(Z)}))})},[b,t,o,k,L]);ct(()=>{d===!1&&F.current.isPositioned&&(F.current.isPositioned=!1,f(P=>({...P,isPositioned:!1})))},[d]);const C=u.useRef(!1);ct(()=>(C.current=!0,()=>{C.current=!1}),[]),ct(()=>{if(S&&(_.current=S),N&&(T.current=N),S&&N){if(A.current)return A.current(S,N,O);O()}},[S,N,O,A,$]);const M=u.useMemo(()=>({reference:_,floating:T,setReference:w,setFloating:x}),[w,x]),E=u.useMemo(()=>({reference:S,floating:N}),[S,N]),D=u.useMemo(()=>{const P={position:o,left:0,top:0};if(!E.floating)return P;const W=uo(E.floating,g.x),Z=uo(E.floating,g.y);return i?{...P,transform:"translate("+W+"px, "+Z+"px)",...lo(E.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:W,top:Z}},[o,i,E.floating,g.x,g.y]);return u.useMemo(()=>({...g,update:O,refs:M,elements:E,floatingStyles:D}),[g,O,M,E,D])}const za=e=>{function t(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:e,fn(o){const{element:n,padding:s}=typeof e=="function"?e(o):e;return n&&t(n)?n.current!=null?co({element:n.current,padding:s}).fn(o):{}:n?co({element:n,padding:s}).fn(o):{}}}},Ra=(e,t)=>({..._a(e),options:[e,t]}),ja=(e,t)=>({...La(e),options:[e,t]}),Ua=(e,t)=>({...$a(e),options:[e,t]}),Ka=(e,t)=>({...Fa(e),options:[e,t]}),Ya=(e,t)=>({...Ha(e),options:[e,t]}),Ga=(e,t)=>({...Ba(e),options:[e,t]}),Xa=(e,t)=>({...za(e),options:[e,t]});var qa="Arrow",fo=u.forwardRef((e,t)=>{const{children:o,width:n=10,height:s=5,...r}=e;return c.jsx(z.svg,{...r,ref:t,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?o:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});fo.displayName=qa;var Za=fo;function Qa(e,t=[]){let o=[];function n(r,a){const i=u.createContext(a),l=o.length;o=[...o,a];function d(f){const{scope:b,children:v,...h}=f,p=(b==null?void 0:b[e][l])||i,y=u.useMemo(()=>h,Object.values(h));return c.jsx(p.Provider,{value:y,children:v})}function g(f,b){const v=(b==null?void 0:b[e][l])||i,h=u.useContext(v);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${r}\``)}return d.displayName=r+"Provider",[d,g]}const s=()=>{const r=o.map(a=>u.createContext(a));return function(i){const l=(i==null?void 0:i[e])||r;return u.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return s.scopeName=e,[n,Ja(s,...t)]}function Ja(...e){const t=e[0];if(e.length===1)return t;const o=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(r){const a=n.reduce((i,{useScope:l,scopeName:d})=>{const f=l(r)[`__scope${d}`];return{...i,...f}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return o.scopeName=t.scopeName,o}function po(e){const[t,o]=u.useState(void 0);return J(()=>{if(e){o({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const r=s[0];let a,i;if("borderBoxSize"in r){const l=r.borderBoxSize,d=Array.isArray(l)?l[0]:l;a=d.inlineSize,i=d.blockSize}else a=e.offsetWidth,i=e.offsetHeight;o({width:a,height:i})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else o(void 0)},[e]),t}var Zt="Popper",[go,bo]=Qa(Zt),[ei,vo]=go(Zt),yo=e=>{const{__scopePopper:t,children:o}=e,[n,s]=u.useState(null);return c.jsx(ei,{scope:t,anchor:n,onAnchorChange:s,children:o})};yo.displayName=Zt;var ho="PopperAnchor",wo=u.forwardRef((e,t)=>{const{__scopePopper:o,virtualRef:n,...s}=e,r=vo(ho,o),a=u.useRef(null),i=X(t,a);return u.useEffect(()=>{r.onAnchorChange((n==null?void 0:n.current)||a.current)}),n?null:c.jsx(z.div,{...s,ref:i})});wo.displayName=ho;var Qt="PopperContent",[ti,ri]=go(Qt),mo=u.forwardRef((e,t)=>{var B,Y,Q,K,R,j;const{__scopePopper:o,side:n="bottom",sideOffset:s=0,align:r="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:l=!0,collisionBoundary:d=[],collisionPadding:g=0,sticky:f="partial",hideWhenDetached:b=!1,updatePositionStrategy:v="optimized",onPlaced:h,...p}=e,y=vo(Qt,o),[m,w]=u.useState(null),x=X(t,re=>w(re)),[S,N]=u.useState(null),_=po(S),T=(_==null?void 0:_.width)??0,F=(_==null?void 0:_.height)??0,$=n+(r!=="center"?"-"+r:""),A=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},k=Array.isArray(d)?d:[d],L=k.length>0,O={padding:A,boundary:k.filter(ni),altBoundary:L},{refs:C,floatingStyles:M,placement:E,isPositioned:D,middlewareData:P}=Va({strategy:"fixed",placement:$,whileElementsMounted:(...re)=>Ia(...re,{animationFrame:v==="always"}),elements:{reference:y.anchor},middleware:[Ra({mainAxis:s+F,alignmentAxis:a}),l&&ja({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Ua():void 0,...O}),l&&Ka({...O}),Ya({...O,apply:({elements:re,rects:fe,availableWidth:Ze,availableHeight:Qe})=>{const{width:Je,height:ll}=fe.reference,Tt=re.floating.style;Tt.setProperty("--radix-popper-available-width",`${Ze}px`),Tt.setProperty("--radix-popper-available-height",`${Qe}px`),Tt.setProperty("--radix-popper-anchor-width",`${Je}px`),Tt.setProperty("--radix-popper-anchor-height",`${ll}px`)}}),S&&Xa({element:S,padding:i}),si({arrowWidth:T,arrowHeight:F}),b&&Ga({strategy:"referenceHidden",...O})]}),[W,Z]=So(E),ie=pe(h);J(()=>{D&&(ie==null||ie())},[D,ie]);const Me=(B=P.arrow)==null?void 0:B.x,Oe=(Y=P.arrow)==null?void 0:Y.y,Ne=((Q=P.arrow)==null?void 0:Q.centerOffset)!==0,[je,Ie]=u.useState();return J(()=>{m&&Ie(window.getComputedStyle(m).zIndex)},[m]),c.jsx("div",{ref:C.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:D?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:je,"--radix-popper-transform-origin":[(K=P.transformOrigin)==null?void 0:K.x,(R=P.transformOrigin)==null?void 0:R.y].join(" "),...((j=P.hide)==null?void 0:j.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(ti,{scope:o,placedSide:W,onArrowChange:N,arrowX:Me,arrowY:Oe,shouldHideArrow:Ne,children:c.jsx(z.div,{"data-side":W,"data-align":Z,...p,ref:x,style:{...p.style,animation:D?void 0:"none"}})})})});mo.displayName=Qt;var xo="PopperArrow",oi={top:"bottom",right:"left",bottom:"top",left:"right"},Co=u.forwardRef(function(t,o){const{__scopePopper:n,...s}=t,r=ri(xo,n),a=oi[r.placedSide];return c.jsx("span",{ref:r.onArrowChange,style:{position:"absolute",left:r.arrowX,top:r.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[r.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[r.placedSide],visibility:r.shouldHideArrow?"hidden":void 0},children:c.jsx(Za,{...s,ref:o,style:{...s.style,display:"block"}})})});Co.displayName=xo;function ni(e){return e!==null}var si=e=>({name:"transformOrigin",options:e,fn(t){var y,m,w;const{placement:o,rects:n,middlewareData:s}=t,a=((y=s.arrow)==null?void 0:y.centerOffset)!==0,i=a?0:e.arrowWidth,l=a?0:e.arrowHeight,[d,g]=So(o),f={start:"0%",center:"50%",end:"100%"}[g],b=(((m=s.arrow)==null?void 0:m.x)??0)+i/2,v=(((w=s.arrow)==null?void 0:w.y)??0)+l/2;let h="",p="";return d==="bottom"?(h=a?f:`${b}px`,p=`${-l}px`):d==="top"?(h=a?f:`${b}px`,p=`${n.floating.height+l}px`):d==="right"?(h=`${-l}px`,p=a?f:`${v}px`):d==="left"&&(h=`${n.floating.width+l}px`,p=a?f:`${v}px`),{data:{x:h,y:p}}}});function So(e){const[t,o="center"]=e.split("-");return[t,o]}var ai=yo,ii=wo,ci=mo,li=Co,di="Portal",Jt=u.forwardRef((e,t)=>{var i;const{container:o,...n}=e,[s,r]=u.useState(!1);J(()=>r(!0),[]);const a=o||s&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?Pt.createPortal(c.jsx(z.div,{...n,ref:t}),a):null});Jt.displayName=di;function dt({prop:e,defaultProp:t,onChange:o=()=>{}}){const[n,s]=ui({defaultProp:t,onChange:o}),r=e!==void 0,a=r?e:n,i=pe(o),l=u.useCallback(d=>{if(r){const f=typeof d=="function"?d(e):d;f!==e&&i(f)}else s(d)},[r,e,s,i]);return[a,l]}function ui({defaultProp:e,onChange:t}){const o=u.useState(e),[n]=o,s=u.useRef(n),r=pe(t);return u.useEffect(()=>{s.current!==n&&(r(n),s.current=n)},[n,s,r]),o}function No(e){const t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var fi="VisuallyHidden",Eo=u.forwardRef((e,t)=>c.jsx(z.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));Eo.displayName=fi;var pi=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},$e=new WeakMap,ut=new WeakMap,ft={},er=0,Do=function(e){return e&&(e.host||Do(e.parentNode))},gi=function(e,t){return t.map(function(o){if(e.contains(o))return o;var n=Do(o);return n&&e.contains(n)?n:(console.error("aria-hidden",o,"in not contained inside",e,". Doing nothing"),null)}).filter(function(o){return!!o})},bi=function(e,t,o,n){var s=gi(t,Array.isArray(e)?e:[e]);ft[o]||(ft[o]=new WeakMap);var r=ft[o],a=[],i=new Set,l=new Set(s),d=function(f){!f||i.has(f)||(i.add(f),d(f.parentNode))};s.forEach(d);var g=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(b){if(i.has(b))g(b);else try{var v=b.getAttribute(n),h=v!==null&&v!=="false",p=($e.get(b)||0)+1,y=(r.get(b)||0)+1;$e.set(b,p),r.set(b,y),a.push(b),p===1&&h&&ut.set(b,!0),y===1&&b.setAttribute(o,"true"),h||b.setAttribute(n,"true")}catch(m){console.error("aria-hidden: cannot operate on ",b,m)}})};return g(t),i.clear(),er++,function(){a.forEach(function(f){var b=$e.get(f)-1,v=r.get(f)-1;$e.set(f,b),r.set(f,v),b||(ut.has(f)||f.removeAttribute(n),ut.delete(f)),v||f.removeAttribute(o)}),er--,er||($e=new WeakMap,$e=new WeakMap,ut=new WeakMap,ft={})}},To=function(e,t,o){o===void 0&&(o="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=pi(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live]"))),bi(n,s,o,"aria-hidden")):function(){return null}},de=function(){return de=Object.assign||function(t){for(var o,n=1,s=arguments.length;n<s;n++){o=arguments[n];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(t[r]=o[r])}return t},de.apply(this,arguments)};function ko(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(o[n[s]]=e[n[s]]);return o}function vi(e,t,o){if(o||arguments.length===2)for(var n=0,s=t.length,r;n<s;n++)(r||!(n in t))&&(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var pt="right-scroll-bar-position",gt="width-before-scroll-bar",yi="with-scroll-bars-hidden",hi="--removed-body-scroll-bar-size";function tr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function wi(e,t){var o=V.useState(function(){return{value:e,callback:t,facade:{get current(){return o.value},set current(n){var s=o.value;s!==n&&(o.value=n,o.callback(n,s))}}}})[0];return o.callback=t,o.facade}var mi=typeof window<"u"?u.useLayoutEffect:u.useEffect,Po=new WeakMap;function xi(e,t){var o=wi(null,function(n){return e.forEach(function(s){return tr(s,n)})});return mi(function(){var n=Po.get(o);if(n){var s=new Set(n),r=new Set(e),a=o.current;s.forEach(function(i){r.has(i)||tr(i,null)}),r.forEach(function(i){s.has(i)||tr(i,a)})}Po.set(o,e)},[e]),o}function Ci(e){return e}function Si(e,t){t===void 0&&(t=Ci);var o=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return o.length?o[o.length-1]:e},useMedium:function(r){var a=t(r,n);return o.push(a),function(){o=o.filter(function(i){return i!==a})}},assignSyncMedium:function(r){for(n=!0;o.length;){var a=o;o=[],a.forEach(r)}o={push:function(i){return r(i)},filter:function(){return o}}},assignMedium:function(r){n=!0;var a=[];if(o.length){var i=o;o=[],i.forEach(r),a=o}var l=function(){var g=a;a=[],g.forEach(r)},d=function(){return Promise.resolve().then(l)};d(),o={push:function(g){a.push(g),d()},filter:function(g){return a=a.filter(g),o}}}};return s}function Ni(e){e===void 0&&(e={});var t=Si(null);return t.options=de({async:!0,ssr:!1},e),t}var Ao=function(e){var t=e.sideCar,o=ko(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return u.createElement(n,de({},o))};Ao.isSideCarExport=!0;function Ei(e,t){return e.useMedium(t),Ao}var Mo=Ni(),rr=function(){},bt=u.forwardRef(function(e,t){var o=u.useRef(null),n=u.