UNPKG

@luciodale/react-searchable-dropdown

Version:
25 lines 118 kB
(function(Ue,C){typeof exports=="object"&&typeof module<"u"?C(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],C):(Ue=typeof globalThis<"u"?globalThis:Ue||self,C(Ue.LucioDaleReactSearchableDropdown={},Ue.React,Ue.ReactDOM))})(this,function(Ue,C,vo){"use strict";function xo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const N=xo(C),bo=xo(vo);var wo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function En(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rn={exports:{}},Ht={};/** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var So;function Mi(){if(So)return Ht;So=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(o,r,i){var s=null;if(i!==void 0&&(s=""+i),r.key!==void 0&&(s=""+r.key),"key"in r){i={};for(var l in r)l!=="key"&&(i[l]=r[l])}else i=r;return r=i.ref,{$$typeof:e,type:o,key:s,ref:r!==void 0?r:null,props:i}}return Ht.Fragment=t,Ht.jsx=n,Ht.jsxs=n,Ht}var Mt={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var To;function Li(){return To||(To=1,process.env.NODE_ENV!=="production"&&function(){function e(T){if(T==null)return null;if(typeof T=="function")return T.$$typeof===M?null:T.displayName||T.name||null;if(typeof T=="string")return T;switch(T){case b:return"Fragment";case m:return"Profiler";case p:return"StrictMode";case S:return"Suspense";case x:return"SuspenseList";case L:return"Activity"}if(typeof T=="object")switch(typeof T.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),T.$$typeof){case v:return"Portal";case w:return(T.displayName||"Context")+".Provider";case h:return(T._context.displayName||"Context")+".Consumer";case I:var z=T.render;return T=T.displayName,T||(T=z.displayName||z.name||"",T=T!==""?"ForwardRef("+T+")":"ForwardRef"),T;case y:return z=T.displayName||null,z!==null?z:e(T.type)||"Memo";case R:z=T._payload,T=T._init;try{return e(T(z))}catch{}}return null}function t(T){return""+T}function n(T){try{t(T);var z=!1}catch{z=!0}if(z){z=console;var Z=z.error,J=typeof Symbol=="function"&&Symbol.toStringTag&&T[Symbol.toStringTag]||T.constructor.name||"Object";return Z.call(z,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",J),t(T)}}function o(T){if(T===b)return"<>";if(typeof T=="object"&&T!==null&&T.$$typeof===R)return"<...>";try{var z=e(T);return z?"<"+z+">":"<...>"}catch{return"<...>"}}function r(){var T=j.A;return T===null?null:T.getOwner()}function i(){return Error("react-stack-top-frame")}function s(T){if(B.call(T,"key")){var z=Object.getOwnPropertyDescriptor(T,"key").get;if(z&&z.isReactWarning)return!1}return T.key!==void 0}function l(T,z){function Z(){Y||(Y=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",z))}Z.isReactWarning=!0,Object.defineProperty(T,"key",{get:Z,configurable:!0})}function a(){var T=e(this.type);return Q[T]||(Q[T]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),T=this.props.ref,T!==void 0?T:null}function c(T,z,Z,J,ue,oe,me,ge){return Z=oe.ref,T={$$typeof:d,type:T,key:z,props:oe,_owner:ue},(Z!==void 0?Z:null)!==null?Object.defineProperty(T,"ref",{enumerable:!1,get:a}):Object.defineProperty(T,"ref",{enumerable:!1,value:null}),T._store={},Object.defineProperty(T._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(T,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(T,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:me}),Object.defineProperty(T,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ge}),Object.freeze&&(Object.freeze(T.props),Object.freeze(T)),T}function u(T,z,Z,J,ue,oe,me,ge){var E=z.children;if(E!==void 0)if(J)if(_(E)){for(J=0;J<E.length;J++)f(E[J]);Object.freeze&&Object.freeze(E)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(E);if(B.call(z,"key")){E=e(T);var D=Object.keys(z).filter(function(le){return le!=="key"});J=0<D.length?"{key: someKey, "+D.join(": ..., ")+": ...}":"{key: someKey}",te[E+J]||(D=0<D.length?"{"+D.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`,J,E,D,E),te[E+J]=!0)}if(E=null,Z!==void 0&&(n(Z),E=""+Z),s(z)&&(n(z.key),E=""+z.key),"key"in z){Z={};for(var G in z)G!=="key"&&(Z[G]=z[G])}else Z=z;return E&&l(Z,typeof T=="function"?T.displayName||T.name||"Unknown":T),c(T,E,oe,ue,r(),Z,me,ge)}function f(T){typeof T=="object"&&T!==null&&T.$$typeof===d&&T._store&&(T._store.validated=1)}var g=C,d=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),w=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),M=Symbol.for("react.client.reference"),j=g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=Object.prototype.hasOwnProperty,_=Array.isArray,H=console.createTask?console.createTask:function(){return null};g={react_stack_bottom_frame:function(T){return T()}};var Y,Q={},ee=g.react_stack_bottom_frame.bind(g,i)(),V=H(o(i)),te={};Mt.Fragment=b,Mt.jsx=function(T,z,Z,J,ue){var oe=1e4>j.recentlyCreatedOwnerStacks++;return u(T,z,Z,!1,J,ue,oe?Error("react-stack-top-frame"):ee,oe?H(o(T)):V)},Mt.jsxs=function(T,z,Z,J,ue){var oe=1e4>j.recentlyCreatedOwnerStacks++;return u(T,z,Z,!0,J,ue,oe?Error("react-stack-top-frame"):ee,oe?H(o(T)):V)}}()),Mt}process.env.NODE_ENV==="production"?Rn.exports=Mi():Rn.exports=Li();var O=Rn.exports;function Qt(){return typeof window<"u"}function St(e){return An(e)?(e.nodeName||"").toLowerCase():"#document"}function Oe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function $e(e){var t;return(t=(An(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function An(e){return Qt()?e instanceof Node||e instanceof Oe(e).Node:!1}function Te(e){return Qt()?e instanceof Element||e instanceof Oe(e).Element:!1}function Ye(e){return Qt()?e instanceof HTMLElement||e instanceof Oe(e).HTMLElement:!1}function kn(e){return!Qt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Oe(e).ShadowRoot}const Pi=new Set(["inline","contents"]);function Lt(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Be(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!Pi.has(r)}const ji=new Set(["table","td","th"]);function zi(e){return ji.has(St(e))}const Fi=[":popover-open",":modal"];function Jt(e){return Fi.some(t=>{try{return e.matches(t)}catch{return!1}})}const Ni=["transform","translate","scale","rotate","perspective"],Di=["transform","translate","scale","rotate","perspective","filter"],Bi=["paint","layout","strict","content"];function On(e){const t=Hn(),n=Te(e)?Be(e):e;return Ni.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Di.some(o=>(n.willChange||"").includes(o))||Bi.some(o=>(n.contain||"").includes(o))}function Wi(e){let t=rt(e);for(;Ye(t)&&!Tt(t);){if(On(t))return t;if(Jt(t))return null;t=rt(t)}return null}function Hn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const _i=new Set(["html","body","#document"]);function Tt(e){return _i.has(St(e))}function Be(e){return Oe(e).getComputedStyle(e)}function Zt(e){return Te(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function rt(e){if(St(e)==="html")return e;const t=e.assignedSlot||e.parentNode||kn(e)&&e.host||$e(e);return kn(t)?t.host:t}function Co(e){const t=rt(e);return Tt(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ye(t)&&Lt(t)?t:Co(t)}function Pt(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Co(e),i=r===((o=e.ownerDocument)==null?void 0:o.body),s=Oe(r);if(i){const l=Mn(s);return t.concat(s,s.visualViewport||[],Lt(r)?r:[],l&&n?Pt(l):[])}return t.concat(r,Pt(r,[],n))}function Mn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Ct=Math.min,He=Math.max,Kt=Math.round,en=Math.floor,Ge=e=>({x:e,y:e}),Vi={left:"right",right:"left",bottom:"top",top:"bottom"},Ui={start:"end",end:"start"};function yo(e,t,n){return He(e,Ct(t,n))}function jt(e,t){return typeof e=="function"?e(t):e}function it(e){return e.split("-")[0]}function zt(e){return e.split("-")[1]}function Io(e){return e==="x"?"y":"x"}function Eo(e){return e==="y"?"height":"width"}const $i=new Set(["top","bottom"]);function et(e){return $i.has(it(e))?"y":"x"}function Ro(e){return Io(et(e))}function Yi(e,t,n){n===void 0&&(n=!1);const o=zt(e),r=Ro(e),i=Eo(r);let s=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=tn(s)),[s,tn(s)]}function Gi(e){const t=tn(e);return[Ln(e),t,Ln(t)]}function Ln(e){return e.replace(/start|end/g,t=>Ui[t])}const Ao=["left","right"],ko=["right","left"],qi=["top","bottom"],Xi=["bottom","top"];function Qi(e,t,n){switch(e){case"top":case"bottom":return n?t?ko:Ao:t?Ao:ko;case"left":case"right":return t?qi:Xi;default:return[]}}function Ji(e,t,n,o){const r=zt(e);let i=Qi(it(e),n==="start",o);return r&&(i=i.map(s=>s+"-"+r),t&&(i=i.concat(i.map(Ln)))),i}function tn(e){return e.replace(/left|right|bottom|top/g,t=>Vi[t])}function Zi(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ki(e){return typeof e!="number"?Zi(e):{top:e,right:e,bottom:e,left:e}}function nn(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}/*! * tabbable 6.2.0 * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE */var es=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Pn=es.join(","),Oo=typeof Element>"u",Ft=Oo?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,on=!Oo&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},rn=function e(t,n){var o;n===void 0&&(n=!0);var r=t==null||(o=t.getAttribute)===null||o===void 0?void 0:o.call(t,"inert"),i=r===""||r==="true",s=i||n&&t&&e(t.parentNode);return s},ts=function(t){var n,o=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return o===""||o==="true"},ns=function(t,n,o){if(rn(t))return[];var r=Array.prototype.slice.apply(t.querySelectorAll(Pn));return n&&Ft.call(t,Pn)&&r.unshift(t),r=r.filter(o),r},os=function e(t,n,o){for(var r=[],i=Array.from(t);i.length;){var s=i.shift();if(!rn(s,!1))if(s.tagName==="SLOT"){var l=s.assignedElements(),a=l.length?l:s.children,c=e(a,!0,o);o.flatten?r.push.apply(r,c):r.push({scopeParent:s,candidates:c})}else{var u=Ft.call(s,Pn);u&&o.filter(s)&&(n||!t.includes(s))&&r.push(s);var f=s.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(s),g=!rn(f,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(s));if(f&&g){var d=e(f===!0?s.children:f.children,!0,o);o.flatten?r.push.apply(r,d):r.push({scopeParent:s,candidates:d})}else i.unshift.apply(i,s.children)}}return r},Ho=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Mo=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||ts(t))&&!Ho(t)?0:t.tabIndex},rs=function(t,n){var o=Mo(t);return o<0&&n&&!Ho(t)?0:o},is=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Lo=function(t){return t.tagName==="INPUT"},ss=function(t){return Lo(t)&&t.type==="hidden"},ls=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(o){return o.tagName==="SUMMARY"});return n},as=function(t,n){for(var o=0;o<t.length;o++)if(t[o].checked&&t[o].form===n)return t[o]},cs=function(t){if(!t.name)return!0;var n=t.form||on(t),o=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(t.name));else try{r=o(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=as(r,t.form);return!i||i===t},us=function(t){return Lo(t)&&t.type==="radio"},fs=function(t){return us(t)&&!cs(t)},ds=function(t){var n,o=t&&on(t),r=(n=o)===null||n===void 0?void 0:n.host,i=!1;if(o&&o!==t){var s,l,a;for(i=!!((s=r)!==null&&s!==void 0&&(l=s.ownerDocument)!==null&&l!==void 0&&l.contains(r)||t!=null&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));!i&&r;){var c,u,f;o=on(r),r=(c=o)===null||c===void 0?void 0:c.host,i=!!((u=r)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(r))}}return i},Po=function(t){var n=t.getBoundingClientRect(),o=n.width,r=n.height;return o===0&&r===0},hs=function(t,n){var o=n.displayCheck,r=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Ft.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Ft.call(s,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="legacy-full"){if(typeof r=="function"){for(var l=t;t;){var a=t.parentElement,c=on(t);if(a&&!a.shadowRoot&&r(a)===!0)return Po(t);t.assignedSlot?t=t.assignedSlot:!a&&c!==t.ownerDocument?t=c.host:t=a}t=l}if(ds(t))return!t.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return Po(t);return!1},ms=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var o=0;o<n.children.length;o++){var r=n.children.item(o);if(r.tagName==="LEGEND")return Ft.call(n,"fieldset[disabled] *")?!0:!r.contains(t)}return!0}n=n.parentElement}return!1},gs=function(t,n){return!(n.disabled||rn(n)||ss(n)||hs(n,t)||ls(n)||ms(n))},jo=function(t,n){return!(fs(n)||Mo(n)<0||!gs(t,n))},ps=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},vs=function e(t){var n=[],o=[];return t.forEach(function(r,i){var s=!!r.scopeParent,l=s?r.scopeParent:r,a=rs(l,s),c=s?e(r.candidates):l;a===0?s?n.push.apply(n,c):n.push(l):o.push({documentOrder:i,tabIndex:a,item:r,isScope:s,content:c})}),o.sort(is).reduce(function(r,i){return i.isScope?r.push.apply(r,i.content):r.push(i.content),r},[]).concat(n)},zo=function(t,n){n=n||{};var o;return n.getShadowRoot?o=os([t],n.includeContainer,{filter:jo.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:ps}):o=ns(t,n.includeContainer,jo.bind(null,n)),vs(o)};function xs(){return/apple/i.test(navigator.vendor)}function bs(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function ws(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&kn(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function jn(e){return(e==null?void 0:e.ownerDocument)||document}var Ss=typeof document<"u",Ts=function(){},ft=Ss?C.useLayoutEffect:Ts;const Cs={...N}.useInsertionEffect||(e=>e());function ys(e){const t=N.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Cs(()=>{t.current=e}),N.useCallback(function(){for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.current==null?void 0:t.current(...o)},[])}const Fo=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function No(e,t){const n=zo(e,Fo()),o=n.length;if(o===0)return;const r=bs(jn(e)),i=n.indexOf(r),s=i===-1?t===1?0:o-1:i+t;return n[s]}function Is(e){return No(jn(e).body,1)||e}function Es(e){return No(jn(e).body,-1)||e}function zn(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!ws(n,o)}function Rs(e){zo(e,Fo()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Do(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const o=n.dataset.tabindex;delete n.dataset.tabindex,o?n.setAttribute("tabindex",o):n.removeAttribute("tabindex")})}function Bo(e,t,n){let{reference:o,floating:r}=e;const i=et(t),s=Ro(t),l=Eo(s),a=it(t),c=i==="y",u=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,g=o[l]/2-r[l]/2;let d;switch(a){case"top":d={x:u,y:o.y-r.height};break;case"bottom":d={x:u,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:f};break;case"left":d={x:o.x-r.width,y:f};break;default:d={x:o.x,y:o.y}}switch(zt(t)){case"start":d[s]-=g*(n&&c?-1:1);break;case"end":d[s]+=g*(n&&c?-1:1);break}return d}const As=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:f}=Bo(c,o,a),g=o,d={},v=0;for(let b=0;b<l.length;b++){const{name:p,fn:m}=l[b],{x:h,y:w,data:I,reset:S}=await m({x:u,y:f,initialPlacement:o,placement:g,strategy:r,middlewareData:d,rects:c,platform:s,elements:{reference:e,floating:t}});u=h??u,f=w??f,d={...d,[p]:{...d[p],...I}},S&&v<=50&&(v++,typeof S=="object"&&(S.placement&&(g=S.placement),S.rects&&(c=S.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:r}):S.rects),{x:u,y:f}=Bo(c,g,a)),b=-1)}return{x:u,y:f,placement:g,strategy:r,middlewareData:d}};async function Fn(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:i,rects:s,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:g=!1,padding:d=0}=jt(t,e),v=Ki(d),p=l[g?f==="floating"?"reference":"floating":f],m=nn(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(p)))==null||n?p:p.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),h=f==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),I=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},S=nn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:h,offsetParent:w,strategy:a}):h);return{top:(m.top-S.top+v.top)/I.y,bottom:(S.bottom-m.bottom+v.bottom)/I.y,left:(m.left-S.left+v.left)/I.x,right:(S.right-m.right+v.right)/I.x}}const ks=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:l,platform:a,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0,...p}=jt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const m=it(r),h=et(l),w=it(l)===l,I=await(a.isRTL==null?void 0:a.isRTL(c.floating)),S=g||(w||!b?[tn(l)]:Gi(l)),x=v!=="none";!g&&x&&S.push(...Ji(l,b,v,I));const y=[l,...S],R=await Fn(t,p),L=[];let M=((o=i.flip)==null?void 0:o.overflows)||[];if(u&&L.push(R[m]),f){const H=Yi(r,s,I);L.push(R[H[0]],R[H[1]])}if(M=[...M,{placement:r,overflows:L}],!L.every(H=>H<=0)){var j,B;const H=(((j=i.flip)==null?void 0:j.index)||0)+1,Y=y[H];if(Y&&(!(f==="alignment"?h!==et(Y):!1)||M.every(V=>V.overflows[0]>0&&et(V.placement)===h)))return{data:{index:H,overflows:M},reset:{placement:Y}};let Q=(B=M.filter(ee=>ee.overflows[0]<=0).sort((ee,V)=>ee.overflows[1]-V.overflows[1])[0])==null?void 0:B.placement;if(!Q)switch(d){case"bestFit":{var _;const ee=(_=M.filter(V=>{if(x){const te=et(V.placement);return te===h||te==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(te=>te>0).reduce((te,T)=>te+T,0)]).sort((V,te)=>V[1]-te[1])[0])==null?void 0:_[0];ee&&(Q=ee);break}case"initialPlacement":Q=l;break}if(r!==Q)return{reset:{placement:Q}}}return{}}}},Os=new Set(["left","top"]);async function Hs(e,t){const{placement:n,platform:o,elements:r}=e,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=it(n),l=zt(n),a=et(n)==="y",c=Os.has(s)?-1:1,u=i&&a?-1:1,f=jt(t,e);let{mainAxis:g,crossAxis:d,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof v=="number"&&(d=l==="end"?v*-1:v),a?{x:d*u,y:g*c}:{x:g*c,y:d*u}}const Ms=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:s,middlewareData:l}=t,a=await Hs(t,e);return s===((n=l.offset)==null?void 0:n.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:r+a.x,y:i+a.y,data:{...a,placement:s}}}}},Ls=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:p=>{let{x:m,y:h}=p;return{x:m,y:h}}},...a}=jt(e,t),c={x:n,y:o},u=await Fn(t,a),f=et(it(r)),g=Io(f);let d=c[g],v=c[f];if(i){const p=g==="y"?"top":"left",m=g==="y"?"bottom":"right",h=d+u[p],w=d-u[m];d=yo(h,d,w)}if(s){const p=f==="y"?"top":"left",m=f==="y"?"bottom":"right",h=v+u[p],w=v-u[m];v=yo(h,v,w)}const b=l.fn({...t,[g]:d,[f]:v});return{...b,data:{x:b.x-n,y:b.y-o,enabled:{[g]:i,[f]:s}}}}}},Ps=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:i,platform:s,elements:l}=t,{apply:a=()=>{},...c}=jt(e,t),u=await Fn(t,c),f=it(r),g=zt(r),d=et(r)==="y",{width:v,height:b}=i.floating;let p,m;f==="top"||f==="bottom"?(p=f,m=g===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(m=f,p=g==="end"?"top":"bottom");const h=b-u.top-u.bottom,w=v-u.left-u.right,I=Ct(b-u[p],h),S=Ct(v-u[m],w),x=!t.middlewareData.shift;let y=I,R=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(R=w),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(y=h),x&&!g){const M=He(u.left,0),j=He(u.right,0),B=He(u.top,0),_=He(u.bottom,0);d?R=v-2*(M!==0||j!==0?M+j:He(u.left,u.right)):y=b-2*(B!==0||_!==0?B+_:He(u.top,u.bottom))}await a({...t,availableWidth:R,availableHeight:y});const L=await s.getDimensions(l.floating);return v!==L.width||b!==L.height?{reset:{rects:!0}}:{}}}};function Wo(e){const t=Be(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=Ye(e),i=r?e.offsetWidth:n,s=r?e.offsetHeight:o,l=Kt(n)!==i||Kt(o)!==s;return l&&(n=i,o=s),{width:n,height:o,$:l}}function Nn(e){return Te(e)?e:e.contextElement}function yt(e){const t=Nn(e);if(!Ye(t))return Ge(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=Wo(t);let s=(i?Kt(n.width):n.width)/o,l=(i?Kt(n.height):n.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const js=Ge(0);function _o(e){const t=Oe(e);return!Hn()||!t.visualViewport?js:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zs(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Oe(e)?!1:t}function dt(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=Nn(e);let s=Ge(1);t&&(o?Te(o)&&(s=yt(o)):s=yt(e));const l=zs(i,n,o)?_o(i):Ge(0);let a=(r.left+l.x)/s.x,c=(r.top+l.y)/s.y,u=r.width/s.x,f=r.height/s.y;if(i){const g=Oe(i),d=o&&Te(o)?Oe(o):o;let v=g,b=Mn(v);for(;b&&o&&d!==v;){const p=yt(b),m=b.getBoundingClientRect(),h=Be(b),w=m.left+(b.clientLeft+parseFloat(h.paddingLeft))*p.x,I=m.top+(b.clientTop+parseFloat(h.paddingTop))*p.y;a*=p.x,c*=p.y,u*=p.x,f*=p.y,a+=w,c+=I,v=Oe(b),b=Mn(v)}}return nn({width:u,height:f,x:a,y:c})}function Dn(e,t){const n=Zt(e).scrollLeft;return t?t.left+n:dt($e(e)).left+n}function Vo(e,t,n){n===void 0&&(n=!1);const o=e.getBoundingClientRect(),r=o.left+t.scrollLeft-(n?0:Dn(e,o)),i=o.top+t.scrollTop;return{x:r,y:i}}function Fs(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i=r==="fixed",s=$e(o),l=t?Jt(t.floating):!1;if(o===s||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=Ge(1);const u=Ge(0),f=Ye(o);if((f||!f&&!i)&&((St(o)!=="body"||Lt(s))&&(a=Zt(o)),Ye(o))){const d=dt(o);c=yt(o),u.x=d.x+o.clientLeft,u.y=d.y+o.clientTop}const g=s&&!f&&!i?Vo(s,a,!0):Ge(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+g.x,y:n.y*c.y-a.scrollTop*c.y+u.y+g.y}}function Ns(e){return Array.from(e.getClientRects())}function Ds(e){const t=$e(e),n=Zt(e),o=e.ownerDocument.body,r=He(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=He(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+Dn(e);const l=-n.scrollTop;return Be(o).direction==="rtl"&&(s+=He(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:l}}function Bs(e,t){const n=Oe(e),o=$e(e),r=n.visualViewport;let i=o.clientWidth,s=o.clientHeight,l=0,a=0;if(r){i=r.width,s=r.height;const c=Hn();(!c||c&&t==="fixed")&&(l=r.offsetLeft,a=r.offsetTop)}return{width:i,height:s,x:l,y:a}}const Ws=new Set(["absolute","fixed"]);function _s(e,t){const n=dt(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=Ye(e)?yt(e):Ge(1),s=e.clientWidth*i.x,l=e.clientHeight*i.y,a=r*i.x,c=o*i.y;return{width:s,height:l,x:a,y:c}}function Uo(e,t,n){let o;if(t==="viewport")o=Bs(e,n);else if(t==="document")o=Ds($e(e));else if(Te(t))o=_s(t,n);else{const r=_o(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return nn(o)}function $o(e,t){const n=rt(e);return n===t||!Te(n)||Tt(n)?!1:Be(n).position==="fixed"||$o(n,t)}function Vs(e,t){const n=t.get(e);if(n)return n;let o=Pt(e,[],!1).filter(l=>Te(l)&&St(l)!=="body"),r=null;const i=Be(e).position==="fixed";let s=i?rt(e):e;for(;Te(s)&&!Tt(s);){const l=Be(s),a=On(s);!a&&l.position==="fixed"&&(r=null),(i?!a&&!r:!a&&l.position==="static"&&!!r&&Ws.has(r.position)||Lt(s)&&!a&&$o(e,s))?o=o.filter(u=>u!==s):r=l,s=rt(s)}return t.set(e,o),o}function Us(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const s=[...n==="clippingAncestors"?Jt(t)?[]:Vs(t,this._c):[].concat(n),o],l=s[0],a=s.reduce((c,u)=>{const f=Uo(t,u,r);return c.top=He(f.top,c.top),c.right=Ct(f.right,c.right),c.bottom=Ct(f.bottom,c.bottom),c.left=He(f.left,c.left),c},Uo(t,l,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function $s(e){const{width:t,height:n}=Wo(e);return{width:t,height:n}}function Ys(e,t,n){const o=Ye(t),r=$e(t),i=n==="fixed",s=dt(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const a=Ge(0);function c(){a.x=Dn(r)}if(o||!o&&!i)if((St(t)!=="body"||Lt(r))&&(l=Zt(t)),o){const d=dt(t,!0,i,t);a.x=d.x+t.clientLeft,a.y=d.y+t.clientTop}else r&&c();i&&!o&&r&&c();const u=r&&!o&&!i?Vo(r,l):Ge(0),f=s.left+l.scrollLeft-a.x-u.x,g=s.top+l.scrollTop-a.y-u.y;return{x:f,y:g,width:s.width,height:s.height}}function Bn(e){return Be(e).position==="static"}function Yo(e,t){if(!Ye(e)||Be(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return $e(e)===n&&(n=n.ownerDocument.body),n}function Go(e,t){const n=Oe(e);if(Jt(e))return n;if(!Ye(e)){let r=rt(e);for(;r&&!Tt(r);){if(Te(r)&&!Bn(r))return r;r=rt(r)}return n}let o=Yo(e,t);for(;o&&zi(o)&&Bn(o);)o=Yo(o,t);return o&&Tt(o)&&Bn(o)&&!On(o)?n:o||Wi(e)||n}const Gs=async function(e){const t=this.getOffsetParent||Go,n=this.getDimensions,o=await n(e.floating);return{reference:Ys(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function qs(e){return Be(e).direction==="rtl"}const Xs={convertOffsetParentRelativeRectToViewportRelativeRect:Fs,getDocumentElement:$e,getClippingRect:Us,getOffsetParent:Go,getElementRects:Gs,getClientRects:Ns,getDimensions:$s,getScale:yt,isElement:Te,isRTL:qs};function qo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Qs(e,t){let n=null,o;const r=$e(e);function i(){var l;clearTimeout(o),(l=n)==null||l.disconnect(),n=null}function s(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const c=e.getBoundingClientRect(),{left:u,top:f,width:g,height:d}=c;if(l||t(),!g||!d)return;const v=en(f),b=en(r.clientWidth-(u+g)),p=en(r.clientHeight-(f+d)),m=en(u),w={rootMargin:-v+"px "+-b+"px "+-p+"px "+-m+"px",threshold:He(0,Ct(1,a))||1};let I=!0;function S(x){const y=x[0].intersectionRatio;if(y!==a){if(!I)return s();y?s(!1,y):o=setTimeout(()=>{s(!1,1e-7)},1e3)}y===1&&!qo(c,e.getBoundingClientRect())&&s(),I=!1}try{n=new IntersectionObserver(S,{...w,root:r.ownerDocument})}catch{n=new IntersectionObserver(S,w)}n.observe(e)}return s(!0),i}function Xo(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,c=Nn(e),u=r||i?[...c?Pt(c):[],...Pt(t)]:[];u.forEach(m=>{r&&m.addEventListener("scroll",n,{passive:!0}),i&&m.addEventListener("resize",n)});const f=c&&l?Qs(c,n):null;let g=-1,d=null;s&&(d=new ResizeObserver(m=>{let[h]=m;h&&h.target===c&&d&&(d.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var w;(w=d)==null||w.observe(t)})),n()}),c&&!a&&d.observe(c),d.observe(t));let v,b=a?dt(e):null;a&&p();function p(){const m=dt(e);b&&!qo(b,m)&&n(),b=m,v=requestAnimationFrame(p)}return n(),()=>{var m;u.forEach(h=>{r&&h.removeEventListener("scroll",n),i&&h.removeEventListener("resize",n)}),f==null||f(),(m=d)==null||m.disconnect(),d=null,a&&cancelAnimationFrame(v)}}const Js=Ms,Zs=Ls,Ks=ks,el=Ps,tl=(e,t,n)=>{const o=new Map,r={platform:Xs,...n},i={...r.platform,_c:o};return As(e,t,{...r,platform:i})};var nl=typeof document<"u",ol=function(){},sn=nl?C.useLayoutEffect:ol;function ln(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 n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!ln(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const i=r[o];if(!(i==="_owner"&&e.$$typeof)&&!ln(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Qo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Jo(e,t){const n=Qo(e);return Math.round(t*n)/n}function Wn(e){const t=N.useRef(e);return sn(()=>{t.current=e}),t}function rl(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:a,open:c}=e,[u,f]=N.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,d]=N.useState(o);ln(g,o)||d(o);const[v,b]=N.useState(null),[p,m]=N.useState(null),h=N.useCallback(V=>{V!==x.current&&(x.current=V,b(V))},[]),w=N.useCallback(V=>{V!==y.current&&(y.current=V,m(V))},[]),I=i||v,S=s||p,x=N.useRef(null),y=N.useRef(null),R=N.useRef(u),L=a!=null,M=Wn(a),j=Wn(r),B=Wn(c),_=N.useCallback(()=>{if(!x.current||!y.current)return;const V={placement:t,strategy:n,middleware:g};j.current&&(V.platform=j.current),tl(x.current,y.current,V).then(te=>{const T={...te,isPositioned:B.current!==!1};H.current&&!ln(R.current,T)&&(R.current=T,bo.flushSync(()=>{f(T)}))})},[g,t,n,j,B]);sn(()=>{c===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,f(V=>({...V,isPositioned:!1})))},[c]);const H=N.useRef(!1);sn(()=>(H.current=!0,()=>{H.current=!1}),[]),sn(()=>{if(I&&(x.current=I),S&&(y.current=S),I&&S){if(M.current)return M.current(I,S,_);_()}},[I,S,_,M,L]);const Y=N.useMemo(()=>({reference:x,floating:y,setReference:h,setFloating:w}),[h,w]),Q=N.useMemo(()=>({reference:I,floating:S}),[I,S]),ee=N.useMemo(()=>{const V={position:n,left:0,top:0};if(!Q.floating)return V;const te=Jo(Q.floating,u.x),T=Jo(Q.floating,u.y);return l?{...V,transform:"translate("+te+"px, "+T+"px)",...Qo(Q.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:te,top:T}},[n,l,Q.floating,u.x,u.y]);return N.useMemo(()=>({...u,update:_,refs:Y,elements:Q,floatingStyles:ee}),[u,_,Y,Q,ee])}const Zo=(e,t)=>({...Js(e),options:[e,t]}),Ko=(e,t)=>({...Zs(e),options:[e,t]}),er=(e,t)=>({...Ks(e),options:[e,t]}),tr=(e,t)=>({...el(e),options:[e,t]}),il={...N};let nr=!1,sl=0;const or=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+sl++;function ll(){const[e,t]=N.useState(()=>nr?or():void 0);return ft(()=>{e==null&&t(or())},[]),N.useEffect(()=>{nr=!0},[]),e}const rr=il.useId||ll;let _n;process.env.NODE_ENV!=="production"&&(_n=new Set);function al(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];const r="Floating UI: "+n.join(" ");if(!((e=_n)!=null&&e.has(r))){var i;(i=_n)==null||i.add(r),console.error(r)}}function cl(){const e=new Map;return{emit(t,n){var o;(o=e.get(t))==null||o.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var o;(o=e.get(t))==null||o.delete(n)}}}const ul=N.createContext(null),fl=N.createContext(null),dl=()=>{var e;return((e=N.useContext(ul))==null?void 0:e.id)||null},hl=()=>N.useContext(fl);function ir(e){return"data-floating-ui-"+e}const sr={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},lr=N.forwardRef(function(t,n){const[o,r]=N.useState();ft(()=>{xs()&&r("button")},[]);const i={ref:n,tabIndex:0,role:o,"aria-hidden":o?void 0:!0,[ir("focus-guard")]:"",style:sr};return O.jsx("span",{...t,...i})}),ar=N.createContext(null),cr=ir("portal");function ml(e){e===void 0&&(e={});const{id:t,root:n}=e,o=rr(),r=gl(),[i,s]=N.useState(null),l=N.useRef(null);return ft(()=>()=>{i==null||i.remove(),queueMicrotask(()=>{l.current=null})},[i]),ft(()=>{if(!o||l.current)return;const a=t?document.getElementById(t):null;if(!a)return;const c=document.createElement("div");c.id=o,c.setAttribute(cr,""),a.appendChild(c),l.current=c,s(c)},[t,o]),ft(()=>{if(n===null||!o||l.current)return;let a=n||(r==null?void 0:r.portalNode);a&&!An(a)&&(a=a.current),a=a||document.body;let c=null;t&&(c=document.createElement("div"),c.id=t,a.appendChild(c));const u=document.createElement("div");u.id=o,u.setAttribute(cr,""),a=c||a,a.appendChild(u),l.current=u,s(u)},[t,n,o,r]),i}function ur(e){const{children:t,id:n,root:o,preserveTabOrder:r=!0}=e,i=ml({id:n,root:o}),[s,l]=N.useState(null),a=N.useRef(null),c=N.useRef(null),u=N.useRef(null),f=N.useRef(null),g=s==null?void 0:s.modal,d=s==null?void 0:s.open,v=!!s&&!s.modal&&s.open&&r&&!!(o||i);return N.useEffect(()=>{if(!i||!r||g)return;function b(p){i&&zn(p)&&(p.type==="focusin"?Do:Rs)(i)}return i.addEventListener("focusin",b,!0),i.addEventListener("focusout",b,!0),()=>{i.removeEventListener("focusin",b,!0),i.removeEventListener("focusout",b,!0)}},[i,r,g]),N.useEffect(()=>{i&&(d||Do(i))},[d,i]),O.jsxs(ar.Provider,{value:N.useMemo(()=>({preserveTabOrder:r,beforeOutsideRef:a,afterOutsideRef:c,beforeInsideRef:u,afterInsideRef:f,portalNode:i,setFocusManagerState:l}),[r,i]),children:[v&&i&&O.jsx(lr,{"data-type":"outside",ref:a,onFocus:b=>{if(zn(b,i)){var p;(p=u.current)==null||p.focus()}else{const m=s?s.domReference:null,h=Es(m);h==null||h.focus()}}}),v&&i&&O.jsx("span",{"aria-owns":i.id,style:sr}),i&&bo.createPortal(t,i),v&&i&&O.jsx(lr,{"data-type":"outside",ref:c,onFocus:b=>{if(zn(b,i)){var p;(p=f.current)==null||p.focus()}else{const m=s?s.domReference:null,h=Is(m);h==null||h.focus(),s!=null&&s.closeOnFocusOut&&(s==null||s.onOpenChange(!1,b.nativeEvent,"focus-out"))}}})]})}const gl=()=>N.useContext(ar);function pl(e){const{open:t=!1,onOpenChange:n,elements:o}=e,r=rr(),i=N.useRef({}),[s]=N.useState(()=>cl()),l=dl()!=null;if(process.env.NODE_ENV!=="production"){const d=o.reference;d&&!Te(d)&&al("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,c]=N.useState(o.reference),u=ys((d,v,b)=>{i.current.openEvent=d?v:void 0,s.emit("openchange",{open:d,event:v,reason:b,nested:l}),n==null||n(d,v,b)}),f=N.useMemo(()=>({setPositionReference:c}),[]),g=N.useMemo(()=>({reference:a||o.reference||null,floating:o.floating||null,domReference:o.reference}),[a,o.reference,o.floating]);return N.useMemo(()=>({dataRef:i,open:t,onOpenChange:u,elements:g,events:s,floatingId:r,refs:f}),[t,u,g,s,r,f])}function fr(e){e===void 0&&(e={});const{nodeId:t}=e,n=pl({...e,elements:{reference:null,floating:null,...e.elements}}),o=e.rootContext||n,r=o.elements,[i,s]=N.useState(null),[l,a]=N.useState(null),u=(r==null?void 0:r.domReference)||i,f=N.useRef(null),g=hl();ft(()=>{u&&(f.current=u)},[u]);const d=rl({...e,elements:{...r,...l&&{reference:l}}}),v=N.useCallback(w=>{const I=Te(w)?{getBoundingClientRect:()=>w.getBoundingClientRect(),getClientRects:()=>w.getClientRects(),contextElement:w}:w;a(I),d.refs.setReference(I)},[d.refs]),b=N.useCallback(w=>{(Te(w)||w===null)&&(f.current=w,s(w)),(Te(d.refs.reference.current)||d.refs.reference.current===null||w!==null&&!Te(w))&&d.refs.setReference(w)},[d.refs]),p=N.useMemo(()=>({...d.refs,setReference:b,setPositionReference:v,domReference:f}),[d.refs,b,v]),m=N.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),h=N.useMemo(()=>({...d,...o,refs:p,elements:m,nodeId:t}),[d,p,m,t,o]);return ft(()=>{o.dataRef.current.floatingContext=h;const w=g==null?void 0:g.nodesRef.current.find(I=>I.id===t);w&&(w.context=h)}),N.useMemo(()=>({...d,context:h,refs:p,elements:m}),[d,p,m,h])}const an=0,st=1,It=2,dr=4;function hr(e){return()=>e}function vl(e){e()}function mr(e,t){return n=>e(t(n))}function gr(e,t){return()=>e(t)}function xl(e,t){return n=>e(t,n)}function Vn(e){return e!==void 0}function bl(...e){return()=>{e.map(vl)}}function Et(){}function cn(e,t){return t(e),e}function wl(e,t){return t(e)}function fe(...e){return e}function se(e,t){return e(st,t)}function q(e,t){e(an,t)}function Un(e){e(It)}function we(e){return e(dr)}function F(e,t){return se(e,xl(t,an))}function qe(e,t){const n=e(st,o=>{n(),t(o)});return n}function pr(e){let t,n;return o=>r=>{t=r,n&&clearTimeout(n),n=setTimeout(()=>{o(t)},e)}}function vr(e,t){return e===t}function de(e=vr){let t;return n=>o=>{e(t,o)||(t=o,n(o))}}function W(e){return t=>n=>{e(n)&&t(n)}}function P(e){return t=>mr(t,e)}function Xe(e){return t=>()=>{t(e)}}function A(e,...t){const n=Sl(...t);return(o,r)=>{switch(o){case It:Un(e);return;case st:return se(e,n(r))}}}function Qe(e,t){return n=>o=>{n(t=e(t,o))}}function Rt(e){return t=>n=>{e>0?e--:t(n)}}function lt(e){let t=null,n;return o=>r=>{t=r,!n&&(n=setTimeout(()=>{n=void 0,o(t)},e))}}function X(...e){const t=new Array(e.length);let n=0,o=null;const r=Math.pow(2,e.length)-1;return e.forEach((i,s)=>{const l=Math.pow(2,s);se(i,a=>{const c=n;n=n|l,t[s]=a,c!==r&&n===r&&o&&(o(),o=null)})}),i=>s=>{const l=()=>{i([s].concat(t))};n===r?l():o=l}}function Sl(...e){return t=>e.reduceRight(wl,t)}function Tl(e){let t,n;const o=()=>t==null?void 0:t();return function(r,i){switch(r){case st:return i?n===i?void 0:(o(),n=i,t=se(e,i),t):(o(),Et);case It:o(),n=null;return}}}function k(e){let t=e;const n=K();return(o,r)=>{switch(o){case an:t=r;break;case st:{r(t);break}case dr:return t}return n(o,r)}}function Ce(e,t){return cn(k(t),n=>F(e,n))}function K(){const e=[];return(t,n)=>{switch(t){case an:e.slice().forEach(o=>{o(n)});return;case It:e.splice(0,e.length);return;case st:return e.push(n),()=>{const o=e.indexOf(n);o>-1&&e.splice(o,1)}}}}function Me(e){return cn(K(),t=>F(e,t))}function ne(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:Cl(),singleton:n}}const Cl=()=>Symbol();function yl(e){const t=new Map,n=({constructor:o,dependencies:r,id:i,singleton:s})=>{if(s&&t.has(i))return t.get(i);const l=o(r.map(a=>n(a)));return s&&t.set(i,l),l};return n(e)}function xe(...e){const t=K(),n=new Array(e.length);let o=0;const r=Math.pow(2,e.length)-1;return e.forEach((i,s)=>{const l=Math.pow(2,s);se(i,a=>{n[s]=a,o=o|l,o===r&&q(t,n)})}),function(i,s){switch(i){case It:{Un(t);return}case st:return o===r&&s(n),se(t,s)}}}function U(e,t=vr){return A(e,de(t))}function xr(...e){return function(t,n){switch(t){case It:return;case st:return bl(...e.map(o=>se(o,n)))}}}var Re=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Re||{});const Il={0:"debug",3:"error",1:"log",2:"warn"},El=()=>typeof globalThis>"u"?window:globalThis,at=ne(()=>{const e=k(3);return{log:k((t,n,o=1)=>{var r;const i=(r=El().VIRTUOSO_LOG_LEVEL)!=null?r:we(e);o>=i&&console[Il[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function ht(e,t,n){return $n(e,t,n).callbackRef}function $n(e,t,n){const o=C.useRef(null);let r=s=>{};const i=C.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(s=>{const l=()=>{const a=s[0].target;a.offsetParent!==null&&e(a)};n?l():requestAnimationFrame(l)}):null,[e,n]);return r=s=>{s&&t?(i==null||i.observe(s),o.current=s):(o.current&&(i==null||i.unobserve(o.current)),o.current=null)},{callbackRef:r,ref:o}}function Rl(e,t,n,o,r,i,s,l,a){const c=C.useCallback(u=>{const f=Al(u.children,t,l?"offsetWidth":"offsetHeight",r);let g=u.parentElement;for(;!g.dataset.virtuosoScroller;)g=g.parentElement;const d=g.lastElementChild.dataset.viewportType==="window";let v;d&&(v=g.ownerDocument.defaultView);const b=s?l?s.scrollLeft:s.scrollTop:d?l?v.scrollX||v.document.documentElement.scrollLeft:v.scrollY||v.document.documentElement.scrollTop:l?g.scrollLeft:g.scrollTop,p=s?l?s.scrollWidth:s.scrollHeight:d?l?v.document.documentElement.scrollWidth:v.document.documentElement.scrollHeight:l?g.scrollWidth:g.scrollHeight,m=s?l?s.offsetWidth:s.offsetHeight:d?l?v.innerWidth:v.innerHeight:l?g.offsetWidth:g.offsetHeight;o({scrollHeight:p,scrollTop:Math.max(b,0),viewportHeight:m}),i==null||i(l?br("column-gap",getComputedStyle(u).columnGap,r):br("row-gap",getComputedStyle(u).rowGap,r)),f!==null&&e(f)},[e,t,r,i,s,o,l]);return $n(c,n,a)}function Al(e,t,n,o){const r=e.length;if(r===0)return null;const i=[];for(let s=0;s<r;s++){const l=e.item(s);if(l.dataset.index===void 0)continue;const a=parseInt(l.dataset.index),c=parseFloat(l.dataset.knownSize),u=t(l,n);if(u===0&&o("Zero-sized element, this should not happen",{child:l},Re.ERROR),u===c)continue;const f=i[i.length-1];i.length===0||f.size!==u||f.endIndex!==a-1?i.push({endIndex:a,size:u,startIndex:a}):i[i.length-1].endIndex++}return i}function br(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Re.WARN),t==="normal"?0:parseInt(t??"0",10)}function wr(e,t,n){const o=C.useRef(null),r=C.useCallback(a=>{if(!(a!=null&&a.offsetParent))return;const c=a.getBoundingClientRect(),u=c.width;let f,g;if(t){const d=t.getBoundingClientRect(),v=c.top-d.top;g=d.height-Math.max(0,v),f=v+t.scrollTop}else{const d=s.current.ownerDocument.defaultView;g=d.innerHeight-Math.max(0,c.top),f=c.top+d.scrollY}o.current={offsetTop:f,visibleHeight:g,visibleWidth:u},e(o.current)},[e,t]),{callbackRef:i,ref:s}=$n(r,!0,n),l=C.useCallback(()=>{r(s.current)},[r,s]);return C.useEffect(()=>{var a;if(t){t.addEventListener("scroll",l);const c=new ResizeObserver(()=>{requestAnimationFrame(l)});return c.observe(t),()=>{t.removeEventListener("scroll",l),c.unobserve(t)}}else{const c=(a=s.current)==null?void 0:a.ownerDocument.defaultView;return c==null||c.addEventListener("scroll",l),c==null||c.addEventListener("resize",l),()=>{c==null||c.removeEventListener("scroll",l),c==null||c.removeEventListener("resize",l)}}},[l,t,s]),i}const ye=ne(()=>{const e=K(),t=K(),n=k(0),o=K(),r=k(0),i=K(),s=K(),l=k(0),a=k(0),c=k(0),u=k(0),f=K(),g=K(),d=k(!1),v=k(!1),b=k(!1);return F(A(e,P(({scrollTop:p})=>p)),t),F(A(e,P(({scrollHeight:p})=>p)),s),F(t,r),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:a,footerHeight:u,headerHeight:l,horizontalDirection:v,scrollBy:g,scrollContainerState:e,scrollHeight:s,scrollingInProgress:d,scrollTo:f,scrollTop:t,skipAnimationFrameInResizeObserver:b,smoothScrollTargetReached:o,statefulScrollTop:r,viewportHeight:i}},[],{singleton:!0}),Nt={lvl:0};function Sr(e,t){const n=e.length;if(n===0)return[];let{index:o,value:r}=t(e[0]);const i=[];for(let s=1;s<n;s++){const{index:l,value:a}=t(e[s]);i.push({end:l-1,start:o,value:r}),o=l,r=a}return i.push({end:1/0,start:o,value:r}),i}function ae(e){return e===Nt}function Dt(e,t){if(!ae(e))return t===e.k?e.v:t<e.k?Dt(e.l,t):Dt(e.r,t)}function We(e,t,n="k"){if(ae(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const o=We(e.r,t,n);return o[0]===-1/0?[e.k,e.v]:o}return We(e.l,t,n)}function Le(e,t,n){return ae(e)?yr(t,n,1):t===e.k?be(e,{k:t,v:n}):t<e.k?Ir(be(e,{l:Le(e.l,t,n)})):Ir(be(e,{r:Le(e.r,t,n)}))}function At(){return Nt}function un(e,t,n){if(ae(e))return[];const o=We(e,t)[0];return kl(Gn(e,o,n))}function Yn(e,t){if(ae(e))return Nt;const{k:n,l:o,r}=e;if(t===n){if(ae(o))return r;if(ae(r))return o;{const[i,s]=Cr(o);return fn(be(e,{k:i,l:Tr(o),v:s}))}}else return t<n?fn(be(e,{l:Yn(o,t)})):fn(be(e,{r:Yn(r,t)}))}function mt(e){return ae(e)?[]:[...mt(e.l),{k:e.k,v:e.v},...mt(e.r)]}function Gn(e,t,n){if(ae(e))return[];const{k:o,l:r,r:i,v:s}=e;let l=[];return o>t&&(l=l.concat(Gn(r,t,n))),o>=t&&o<=n&&l.push({k:o,v:s}),o<=n&&(l=l.concat(Gn(i,t,n))),l}function fn(e){const{l:t,lvl:n,r:o}=e;if(o.lvl>=n-1&&t.lvl>=n-1)return e;if(n>o.lvl+1){if(qn(t))return Er(be(e,{lvl:n-1}));if(!ae(t)&&!ae(t.r))return be(t.r,{l:be(t,{r:t.r.l}),lvl:n,r:be(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(qn(e))return Xn(be(e,{lvl:n-1}));if(!ae(o)&&!ae(o.l)){const r=o.l,i=qn(r)?o.lvl-1:o.lvl;return be(r,{l:be(e,{lvl:n-1,r:r.l}),lvl:r.lvl+1,r:Xn(be(o,{l:r.r,lvl:i}))})}else throw new Error("Unexpected empty nodes")}}function be(e,t){return yr(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Tr(e){return ae(e.r)?e.l:fn(be(e,{r:Tr(e.r)}))}function qn(e){return ae(e)||e.lvl>e.r.lvl}function Cr(e){return ae(e.r)?[e.k,e.v]:Cr(e.r)}function yr(e,t,n,o=Nt,r=Nt){return{k:e,l:o,lvl:n,r,v:t}}function Ir(e){return Xn(Er(e))}function Er(e){const{l:t}=e;return!ae(t)&&t.lvl===e.lvl?be(t,{r:be(e,{l:t.r})}):e}function Xn(e){const{lvl:t,r:n}=e;return!ae(n)&&!ae(n.r)&&n.lvl===t&&n.r.lvl===t?be(n,{l:be(e,{r:n.l}),lvl:t+1}):e}function kl(e){return Sr(e,({k:t,v:n})=>({index:t,value:n}))}function Rr(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Bt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const Qn=ne(()=>({recalcInProgress:k(!1)}),[],{singleton:!0});function Ar(e,t,n){return e[dn(e,t,n)]}function dn(e,t,n,o=0){let r=e.length-1;for(;o<=r;){const i=Math.floor((o+r)/2),s=e[i],l=n(s,t);if(l===0)return i;if(l===-1){if(r-o<2)return i-1;r=i-1}else{if(r===o)return i;o=i+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function Ol(e,t,n,o){const r=dn(e,t,o),i=dn(e,n,o,r);return e.slice(r,i+1)}function ct(e,t){return Math.round(e.getBoundingClientRect()[t])}function hn(e){return!ae(e.groupOffsetTree)}function Jn({index:e},t){return t===e?0:t<e?-1:1}function Hl(){return{groupIndices:[],groupOffsetTree:At(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:At()}}function Ml(e,t){let n=ae(e)?0:1/0;for(const o of t){const{endIndex:r,size:i,startIndex:s}=o;if(n=Math.min(n,s),ae(e)){e=Le(e,0,i);continue}const l=un(e,s-1,r+1);if(l.some(Dl(o)))continue;let a=!1,c=!1;for(const{end:u,start:f,value:g}of l)a?(r>=f||i===g)&&(e=Yn(e,f)):(c=g!==i,a=!0),u>r&&r>=f&&g!==i&&(e=Le(e,r+1,g));c&&(e=Le(e,s,i))}return[e,n]}function Ll(e){return typeof e.groupIndex<"u"}function Pl({offset:e},t){return t===e?0:t<e?-1:1}function Wt(e,t,n){if(t.length===0)return 0;const{index:o,offset:r,size:i}=Ar(t,e,Jn),s=e-o,l=i*s+(s-1)*n+r;return l>0?l+n:l}function kr(e,t){if(!hn(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Or(e,t,n){if(Ll(e))return t.groupIndices[e.groupIndex]+1;{const o=e.index==="LAST"?n:e.index;let r=kr(o,t);return r=Math.max(0,r,Math.min(n,r)),r}}function jl(e,t,n,o=0){return o>0&&(t=Math.max(t,Ar(e,o,Jn).offset)),Sr(Ol(e,t,n,Pl),Nl)}function zl(e,[t,n,o,r]){t.length>0&&o("received item sizes",t,Re.DEBUG);const i=e.sizeTree;let s=i,l=0;if(n.length>0&&ae(i)&&t.length===2){const g=t[0].size,d=t[1].size;s=n.reduce((v,b)=>Le(Le(v,b,g),b+1,d),s)}else[s,l]=Ml(s,t);if(s===i)return e;const{lastIndex:a,lastOffset:c,lastSize:u,offsetTree:f}=Zn(e.offsetTree,l,s,r);return{groupIndices:n,groupOffset