UNPKG

@abhnvrmn99/react-input-phone-number

Version:

An opinionated and styled phone number input component for react.

34 lines 316 kB
import*as e from"react";import t,{forwardRef as n,createElement as r,useLayoutEffect as o,useEffect as a,useState as i,useRef as d,useCallback as s,useMemo as l}from"react";import*as u from"react-dom";import c from"react-dom";function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var p,$={exports:{}},h={};var m,g,y={}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */function v(){return m||(m=1,"production"!==process.env.NODE_ENV&&function(){var e=t,n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),$=Symbol.for("react.offscreen"),h=Symbol.iterator;var m=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];!function(e,t,n){var r=m.ReactDebugCurrentFrame,o=r.getStackAddendum();""!==o&&(t+="%s",n=n.concat([o]));var a=n.map((function(e){return String(e)}));a.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,a)}("error",e,n)}var v;function b(e){return e.displayName||"Context"}function w(e){if(null==e)return null;if("number"==typeof e.tag&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case r:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case s:return b(e)+".Consumer";case d:return b(e._context)+".Provider";case l:return function(e,t,n){var r=e.displayName;if(r)return r;var o=t.displayName||t.name||"";return""!==o?n+"("+o+")":n}(e,e.render,"ForwardRef");case f:var t=e.displayName||null;return null!==t?t:w(e.type)||"Memo";case p:var n=e,$=n._payload,h=n._init;try{return w(h($))}catch(e){return null}}return null}v=Symbol.for("react.module.reference");var x,C,N,S,E,O,P,A=Object.assign,k=0;function I(){}I.__reactDisabledLog=!0;var T,R=m.ReactCurrentDispatcher;function j(e,t,n){if(void 0===T)try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);T=r&&r[1]||""}return"\n"+T+e}var M,F=!1,_="function"==typeof WeakMap?WeakMap:Map;function D(e,t){if(!e||F)return"";var n,r=M.get(e);if(void 0!==r)return r;F=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=R.current,R.current=null,function(){if(0===k){x=console.log,C=console.info,N=console.warn,S=console.error,E=console.group,O=console.groupCollapsed,P=console.groupEnd;var e={configurable:!0,enumerable:!0,value:I,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}k++}();try{if(t){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(i,[])}catch(e){n=e}Reflect.construct(e,[],i)}else{try{i.call()}catch(e){n=e}e.call(i.prototype)}}else{try{throw Error()}catch(e){n=e}e()}}catch(t){if(t&&n&&"string"==typeof t.stack){for(var d=t.stack.split("\n"),s=n.stack.split("\n"),l=d.length-1,u=s.length-1;l>=1&&u>=0&&d[l]!==s[u];)u--;for(;l>=1&&u>=0;l--,u--)if(d[l]!==s[u]){if(1!==l||1!==u)do{if(l--,--u<0||d[l]!==s[u]){var c="\n"+d[l].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),"function"==typeof e&&M.set(e,c),c}}while(l>=1&&u>=0);break}}}finally{F=!1,R.current=o,function(){if(0==--k){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:A({},e,{value:x}),info:A({},e,{value:C}),warn:A({},e,{value:N}),error:A({},e,{value:S}),group:A({},e,{value:E}),groupCollapsed:A({},e,{value:O}),groupEnd:A({},e,{value:P})})}k<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var f=e?e.displayName||e.name:"",p=f?j(f):"";return"function"==typeof e&&M.set(e,p),p}function L(e,t,n){if(null==e)return"";if("function"==typeof e)return D(e,!(!(r=e.prototype)||!r.isReactComponent));var r;if("string"==typeof e)return j(e);switch(e){case u:return j("Suspense");case c:return j("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case l:return D(e.render,!1);case f:return L(e.type,t,n);case p:var o=e,a=o._payload,i=o._init;try{return L(i(a),t,n)}catch(e){}}return""}M=new _;var B=Object.prototype.hasOwnProperty,G={},W=m.ReactDebugCurrentFrame;function z(e){if(e){var t=e._owner,n=L(e.type,e._source,t?t.type:null);W.setExtraStackFrame(n)}else W.setExtraStackFrame(null)}var U=Array.isArray;function K(e){return U(e)}function V(e){return""+e}function H(e){if(function(e){try{return V(e),!1}catch(e){return!0}}(e))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),V(e)}var Y,q,Z,J=m.ReactCurrentOwner,X={key:!0,ref:!0,__self:!0,__source:!0};Z={};function Q(e,t,r,o,a){var i,d={},s=null,l=null;for(i in void 0!==r&&(H(r),s=""+r),function(e){if(B.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(H(t.key),s=""+t.key),function(e){if(B.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(l=t.ref,function(e,t){if("string"==typeof e.ref&&J.current&&t&&J.current.stateNode!==t){var n=w(J.current.type);Z[n]||(g('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',w(J.current.type),e.ref),Z[n]=!0)}}(t,a)),t)B.call(t,i)&&!X.hasOwnProperty(i)&&(d[i]=t[i]);if(e&&e.defaultProps){var u=e.defaultProps;for(i in u)void 0===d[i]&&(d[i]=u[i])}if(s||l){var c="function"==typeof e?e.displayName||e.name||"Unknown":e;s&&function(e,t){var n=function(){Y||(Y=!0,g("%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://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(d,c),l&&function(e,t){var n=function(){q||(q=!0,g("%s: `ref` 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://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(d,c)}return function(e,t,r,o,a,i,d){var s={$$typeof:n,type:e,key:t,ref:r,props:d,_owner:i,_store:{}};return Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}(e,s,l,a,o,J.current,d)}var ee,te=m.ReactCurrentOwner,ne=m.ReactDebugCurrentFrame;function re(e){if(e){var t=e._owner,n=L(e.type,e._source,t?t.type:null);ne.setExtraStackFrame(n)}else ne.setExtraStackFrame(null)}function oe(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}function ae(){if(te.current){var e=w(te.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}ee=!1;var ie={};function de(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=ae();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!ie[n]){ie[n]=!0;var r="";e&&e._owner&&e._owner!==te.current&&(r=" It was passed a child from "+w(e._owner.type)+"."),re(e),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),re(null)}}}function se(e,t){if("object"==typeof e)if(K(e))for(var n=0;n<e.length;n++){var r=e[n];oe(r)&&de(r,t)}else if(oe(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=h&&e[h]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var a,i=o.call(e);!(a=i.next()).done;)oe(a.value)&&de(a.value,t)}}function le(e){var t,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)t=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==l&&n.$$typeof!==f)return;t=n.propTypes}if(t){var r=w(n);!function(e,t,n,r,o){var a=Function.call.bind(B);for(var i in e)if(a(e,i)){var d=void 0;try{if("function"!=typeof e[i]){var s=Error((r||"React class")+": "+n+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw s.name="Invariant Violation",s}d=e[i](t,i,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){d=e}!d||d instanceof Error||(z(o),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",r||"React class",n,i,typeof d),z(null)),d instanceof Error&&!(d.message in G)&&(G[d.message]=!0,z(o),g("Failed %s type: %s",n,d.message),z(null))}}(t,e.props,"prop",r,e)}else if(void 0!==n.PropTypes&&!ee){ee=!0,g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",w(n)||"Unknown")}"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var ue={};function ce(e,t,r,h,m,y){var b=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===i||e===a||e===u||e===c||e===$||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===f||e.$$typeof===d||e.$$typeof===s||e.$$typeof===l||e.$$typeof===v||void 0!==e.getModuleId)}(e);if(!b){var x="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(x+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var C;x+=ae(),null===e?C="null":K(e)?C="array":void 0!==e&&e.$$typeof===n?(C="<"+(w(e.type)||"Unknown")+" />",x=" Did you accidentally export a JSX literal instead of a component?"):C=typeof e,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",C,x)}var N=Q(e,t,r,m,y);if(null==N)return N;if(b){var S=t.children;if(void 0!==S)if(h)if(K(S)){for(var E=0;E<S.length;E++)se(S[E],e);Object.freeze&&Object.freeze(S)}else g("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 se(S,e)}if(B.call(t,"key")){var O=w(e),P=Object.keys(t).filter((function(e){return"key"!==e})),A=P.length>0?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}";if(!ue[O+A])g('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',A,O,P.length>0?"{"+P.join(": ..., ")+": ...}":"{}",O),ue[O+A]=!0}return e===o?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var r=t[n];if("children"!==r&&"key"!==r){re(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),re(null);break}}null!==e.ref&&(re(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),re(null))}(N):le(N),N}var fe=function(e,t,n){return ce(e,t,n,!1)},pe=function(e,t,n){return ce(e,t,n,!0)};y.Fragment=o,y.jsx=fe,y.jsxs=pe}()),y}var b=(g||(g=1,"production"===process.env.NODE_ENV?$.exports=function(){if(p)return h;p=1;var e=t,n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,r){var d,s={},l=null,u=null;for(d in void 0!==r&&(l=""+r),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(u=t.ref),t)o.call(t,d)&&!i.hasOwnProperty(d)&&(s[d]=t[d]);if(e&&e.defaultProps)for(d in t=e.defaultProps)void 0===s[d]&&(s[d]=t[d]);return{$$typeof:n,type:e,key:l,ref:u,props:s,_owner:a.current}}return h.Fragment=r,h.jsx=d,h.jsxs=d,h}():$.exports=v()),$.exports); /** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w=(...e)=>e.filter(((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t)).join(" ").trim() /** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */;var x={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}; /** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C=n((({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:a="",children:i,iconNode:d,...s},l)=>r("svg",{ref:l,...x,width:t,height:t,stroke:e,strokeWidth:o?24*Number(n)/Number(t):n,className:w("lucide",a),...s},[...d.map((([e,t])=>r(e,t))),...Array.isArray(i)?i:[i]]))),N=(e,t)=>{const o=n((({className:n,...o},a)=>{return r(C,{ref:a,iconNode:t,className:w(`lucide-${i=e,i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,n),...o});var i}));return o.displayName=`${e}`,o},S=N("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),E=N("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),O=N("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),P=N("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]); /** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var A=function(){return A=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},A.apply(this,arguments)};function k(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function I(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function T(...e){return t=>e.forEach((e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t)))}function R(...t){return e.useCallback(T(...t),t)}function j(t,n=[]){let r=[];const o=()=>{const n=r.map((t=>e.createContext(t)));return function(r){const o=r?.[t]||n;return e.useMemo((()=>({[`__scope${t}`]:{...r,[t]:o}})),[r,o])}};return o.scopeName=t,[function(n,o){const a=e.createContext(o),i=r.length;r=[...r,o];const d=n=>{const{scope:r,children:o,...d}=n,s=r?.[t]?.[i]||a,l=e.useMemo((()=>d),Object.values(d));return b.jsx(s.Provider,{value:l,children:o})};return d.displayName=n+"Provider",[d,function(r,d){const s=d?.[t]?.[i]||a,l=e.useContext(s);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${r}\` must be used within \`${n}\``)}]},M(o,...n)]}function M(...t){const n=t[0];if(1===t.length)return n;const r=()=>{const r=t.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(t){const o=r.reduce(((e,{useScope:n,scopeName:r})=>({...e,...n(t)[`__scope${r}`]})),{});return e.useMemo((()=>({[`__scope${n.scopeName}`]:o})),[o])}};return r.scopeName=n.scopeName,r}"function"==typeof SuppressedError&&SuppressedError;var F=e.forwardRef(((t,n)=>{const{children:r,...o}=t,a=e.Children.toArray(r),i=a.find(L);if(i){const t=i.props.children,r=a.map((n=>n===i?e.Children.count(t)>1?e.Children.only(null):e.isValidElement(t)?t.props.children:null:n));return b.jsx(_,{...o,ref:n,children:e.isValidElement(t)?e.cloneElement(t,void 0,r):null})}return b.jsx(_,{...o,ref:n,children:r})}));F.displayName="Slot";var _=e.forwardRef(((t,n)=>{const{children:r,...o}=t;if(e.isValidElement(r)){const t=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(r);return e.cloneElement(r,{...B(o,r.props),ref:n?T(n,t):t})}return e.Children.count(r)>1?e.Children.only(null):null}));_.displayName="SlotClone";var D=({children:e})=>b.jsx(b.Fragment,{children:e});function L(t){return e.isValidElement(t)&&t.type===D}function B(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...e)=>{a(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}var G=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((t,n)=>{const r=e.forwardRef(((e,t)=>{const{asChild:r,...o}=e,a=r?F:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),b.jsx(a,{...o,ref:t})}));return r.displayName=`Primitive.${n}`,{...t,[n]:r}}),{});function W(t){const n=e.useRef(t);return e.useEffect((()=>{n.current=t})),e.useMemo((()=>(...e)=>n.current?.(...e)),[])}var z,U="dismissableLayer.update",K="dismissableLayer.pointerDownOutside",V="dismissableLayer.focusOutside",H=e.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Y=e.forwardRef(((t,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:d,onDismiss:s,...l}=t,u=e.useContext(H),[c,f]=e.useState(null),p=c?.ownerDocument??globalThis?.document,[,$]=e.useState({}),h=R(n,(e=>f(e))),m=Array.from(u.layers),[g]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(g),v=c?m.indexOf(c):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,x=v>=y,C=function(t,n=globalThis?.document){const r=W(t),o=e.useRef(!1),a=e.useRef((()=>{}));return e.useEffect((()=>{const e=e=>{if(e.target&&!o.current){let t=function(){Z(K,r,o,{discrete:!0})};const o={originalEvent:e};"touch"===e.pointerType?(n.removeEventListener("click",a.current),a.current=t,n.addEventListener("click",a.current,{once:!0})):t()}else n.removeEventListener("click",a.current);o.current=!1},t=window.setTimeout((()=>{n.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(t),n.removeEventListener("pointerdown",e),n.removeEventListener("click",a.current)}}),[n,r]),{onPointerDownCapture:()=>o.current=!0}}((e=>{const t=e.target,n=[...u.branches].some((e=>e.contains(t)));x&&!n&&(a?.(e),d?.(e),e.defaultPrevented||s?.())}),p),N=function(t,n=globalThis?.document){const r=W(t),o=e.useRef(!1);return e.useEffect((()=>{const e=e=>{if(e.target&&!o.current){Z(V,r,{originalEvent:e},{discrete:!1})}};return n.addEventListener("focusin",e),()=>n.removeEventListener("focusin",e)}),[n,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}((e=>{const t=e.target;[...u.branches].some((e=>e.contains(t)))||(i?.(e),d?.(e),e.defaultPrevented||s?.())}),p);return function(t,n=globalThis?.document){const r=W(t);e.useEffect((()=>{const e=e=>{"Escape"===e.key&&r(e)};return n.addEventListener("keydown",e,{capture:!0}),()=>n.removeEventListener("keydown",e,{capture:!0})}),[r,n])}((e=>{v===u.layers.size-1&&(o?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))}),p),e.useEffect((()=>{if(c)return r&&(0===u.layersWithOutsidePointerEventsDisabled.size&&(z=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),q(),()=>{r&&1===u.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=z)}}),[c,p,r,u]),e.useEffect((()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),q())}),[c,u]),e.useEffect((()=>{const e=()=>$({});return document.addEventListener(U,e),()=>document.removeEventListener(U,e)}),[]),b.jsx(G.div,{...l,ref:h,style:{pointerEvents:w?x?"auto":"none":void 0,...t.style},onFocusCapture:I(t.onFocusCapture,N.onFocusCapture),onBlurCapture:I(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:I(t.onPointerDownCapture,C.onPointerDownCapture)})}));Y.displayName="DismissableLayer";function q(){const e=new CustomEvent(U);document.dispatchEvent(e)}function Z(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&u.flushSync((()=>e.dispatchEvent(t)))}(o,a):o.dispatchEvent(a)}e.forwardRef(((t,n)=>{const r=e.useContext(H),o=e.useRef(null),a=R(n,o);return e.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),b.jsx(G.div,{...t,ref:a})})).displayName="DismissableLayerBranch";var J=0;function X(){e.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Q()),document.body.insertAdjacentElement("beforeend",e[1]??Q()),J++,()=>{1===J&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),J--}}),[])}function Q(){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 ee="focusScope.autoFocusOnMount",te="focusScope.autoFocusOnUnmount",ne={bubbles:!1,cancelable:!0},re=e.forwardRef(((t,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...d}=t,[s,l]=e.useState(null),u=W(a),c=W(i),f=e.useRef(null),p=R(n,(e=>l(e))),$=e.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;e.useEffect((()=>{if(o){let e=function(e){if($.paused||!s)return;const t=e.target;s.contains(t)?f.current=t:de(f.current,{select:!0})},t=function(e){if($.paused||!s)return;const t=e.relatedTarget;null!==t&&(s.contains(t)||de(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&de(s)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}}),[o,s,$.paused]),e.useEffect((()=>{if(s){se.add($);const t=document.activeElement;if(!s.contains(t)){const n=new CustomEvent(ee,ne);s.addEventListener(ee,u),s.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(de(r,{select:t}),document.activeElement!==n)return}((e=oe(s),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&de(s))}return()=>{s.removeEventListener(ee,u),setTimeout((()=>{const e=new CustomEvent(te,ne);s.addEventListener(te,c),s.dispatchEvent(e),e.defaultPrevented||de(t??document.body,{select:!0}),s.removeEventListener(te,c),se.remove($)}),0)}}var e}),[s,u,c,$]);const h=e.useCallback((e=>{if(!r&&!o)return;if($.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){const t=e.currentTarget,[o,a]=function(e){const t=oe(e),n=ae(t,e),r=ae(t.reverse(),e);return[n,r]}(t);o&&a?e.shiftKey||n!==a?e.shiftKey&&n===o&&(e.preventDefault(),r&&de(a,{select:!0})):(e.preventDefault(),r&&de(o,{select:!0})):n===t&&e.preventDefault()}}),[r,o,$.paused]);return b.jsx(G.div,{tabIndex:-1,...d,ref:p,onKeyDown:h})}));function oe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ae(e,t){for(const n of e)if(!ie(n,{upTo:t}))return n}function ie(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function de(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}re.displayName="FocusScope";var se=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=le(e,t),e.unshift(t)},remove(t){e=le(e,t),e[0]?.resume()}}}();function le(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var ue=Boolean(globalThis?.document)?e.useLayoutEffect:()=>{},ce=e["useId".toString()]||(()=>{}),fe=0;function pe(t){const[n,r]=e.useState(ce());return ue((()=>{r((e=>e??String(fe++)))}),[t]),n?`radix-${n}`:""}const $e=["top","right","bottom","left"],he=Math.min,me=Math.max,ge=Math.round,ye=Math.floor,ve=e=>({x:e,y:e}),be={left:"right",right:"left",bottom:"top",top:"bottom"},we={start:"end",end:"start"};function xe(e,t,n){return me(e,he(t,n))}function Ce(e,t){return"function"==typeof e?e(t):e}function Ne(e){return e.split("-")[0]}function Se(e){return e.split("-")[1]}function Ee(e){return"x"===e?"y":"x"}function Oe(e){return"y"===e?"height":"width"}function Pe(e){return["top","bottom"].includes(Ne(e))?"y":"x"}function Ae(e){return Ee(Pe(e))}function ke(e){return e.replace(/start|end/g,(e=>we[e]))}function Ie(e){return e.replace(/left|right|bottom|top/g,(e=>be[e]))}function Te(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Re(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function je(e,t,n){let{reference:r,floating:o}=e;const a=Pe(t),i=Ae(t),d=Oe(i),s=Ne(t),l="y"===a,u=r.x+r.width/2-o.width/2,c=r.y+r.height/2-o.height/2,f=r[d]/2-o[d]/2;let p;switch(s){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:c};break;case"left":p={x:r.x-o.width,y:c};break;default:p={x:r.x,y:r.y}}switch(Se(t)){case"start":p[i]-=f*(n&&l?-1:1);break;case"end":p[i]+=f*(n&&l?-1:1)}return p}async function Me(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:a,rects:i,elements:d,strategy:s}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:c="floating",altBoundary:f=!1,padding:p=0}=Ce(t,e),$=Te(p),h=d[f?"floating"===c?"reference":"floating":c],m=Re(await a.getClippingRect({element:null==(n=await(null==a.isElement?void 0:a.isElement(h)))||n?h:h.contextElement||await(null==a.getDocumentElement?void 0:a.getDocumentElement(d.floating)),boundary:l,rootBoundary:u,strategy:s})),g="floating"===c?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,y=await(null==a.getOffsetParent?void 0:a.getOffsetParent(d.floating)),v=await(null==a.isElement?void 0:a.isElement(y))&&await(null==a.getScale?void 0:a.getScale(y))||{x:1,y:1},b=Re(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:g,offsetParent:y,strategy:s}):g);return{top:(m.top-b.top+$.top)/v.y,bottom:(b.bottom-m.bottom+$.bottom)/v.y,left:(m.left-b.left+$.left)/v.x,right:(b.right-m.right+$.right)/v.x}}function Fe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function _e(e){return $e.some((t=>e[t]>=0))}function De(){return"undefined"!=typeof window}function Le(e){return We(e)?(e.nodeName||"").toLowerCase():"#document"}function Be(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ge(e){var t;return null==(t=(We(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function We(e){return!!De()&&(e instanceof Node||e instanceof Be(e).Node)}function ze(e){return!!De()&&(e instanceof Element||e instanceof Be(e).Element)}function Ue(e){return!!De()&&(e instanceof HTMLElement||e instanceof Be(e).HTMLElement)}function Ke(e){return!(!De()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Be(e).ShadowRoot)}function Ve(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Xe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function He(e){return["table","td","th"].includes(Le(e))}function Ye(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function qe(e){const t=Ze(),n=ze(e)?Xe(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function Ze(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Je(e){return["html","body","#document"].includes(Le(e))}function Xe(e){return Be(e).getComputedStyle(e)}function Qe(e){return ze(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function et(e){if("html"===Le(e))return e;const t=e.assignedSlot||e.parentNode||Ke(e)&&e.host||Ge(e);return Ke(t)?t.host:t}function tt(e){const t=et(e);return Je(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ue(t)&&Ve(t)?t:tt(t)}function nt(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=tt(e),a=o===(null==(r=e.ownerDocument)?void 0:r.body),i=Be(o);if(a){const e=rt(i);return t.concat(i,i.visualViewport||[],Ve(o)?o:[],e&&n?nt(e):[])}return t.concat(o,nt(o,[],n))}function rt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ot(e){const t=Xe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ue(e),a=o?e.offsetWidth:n,i=o?e.offsetHeight:r,d=ge(n)!==a||ge(r)!==i;return d&&(n=a,r=i),{width:n,height:r,$:d}}function at(e){return ze(e)?e:e.contextElement}function it(e){const t=at(e);if(!Ue(t))return ve(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:a}=ot(t);let i=(a?ge(n.width):n.width)/r,d=(a?ge(n.height):n.height)/o;return i&&Number.isFinite(i)||(i=1),d&&Number.isFinite(d)||(d=1),{x:i,y:d}}const dt=ve(0);function st(e){const t=Be(e);return Ze()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:dt}function lt(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),a=at(e);let i=ve(1);t&&(r?ze(r)&&(i=it(r)):i=it(e));const d=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Be(e))&&t}(a,n,r)?st(a):ve(0);let s=(o.left+d.x)/i.x,l=(o.top+d.y)/i.y,u=o.width/i.x,c=o.height/i.y;if(a){const e=Be(a),t=r&&ze(r)?Be(r):r;let n=e,o=rt(n);for(;o&&r&&t!==n;){const e=it(o),t=o.getBoundingClientRect(),r=Xe(o),a=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,i=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,l*=e.y,u*=e.x,c*=e.y,s+=a,l+=i,n=Be(o),o=rt(n)}}return Re({width:u,height:c,x:s,y:l})}function ut(e,t){const n=Qe(e).scrollLeft;return t?t.left+n:lt(Ge(e)).left+n}function ct(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:ut(e,r)),y:r.top+t.scrollTop}}function ft(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Be(e),r=Ge(e),o=n.visualViewport;let a=r.clientWidth,i=r.clientHeight,d=0,s=0;if(o){a=o.width,i=o.height;const e=Ze();(!e||e&&"fixed"===t)&&(d=o.offsetLeft,s=o.offsetTop)}return{width:a,height:i,x:d,y:s}}(e,n);else if("document"===t)r=function(e){const t=Ge(e),n=Qe(e),r=e.ownerDocument.body,o=me(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=me(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+ut(e);const d=-n.scrollTop;return"rtl"===Xe(r).direction&&(i+=me(t.clientWidth,r.clientWidth)-o),{width:o,height:a,x:i,y:d}}(Ge(e));else if(ze(t))r=function(e,t){const n=lt(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,a=Ue(e)?it(e):ve(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:o*a.x,y:r*a.y}}(t,n);else{const n=st(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Re(r)}function pt(e,t){const n=et(e);return!(n===t||!ze(n)||Je(n))&&("fixed"===Xe(n).position||pt(n,t))}function $t(e,t,n){const r=Ue(t),o=Ge(t),a="fixed"===n,i=lt(e,!0,a,t);let d={scrollLeft:0,scrollTop:0};const s=ve(0);if(r||!r&&!a)if(("body"!==Le(t)||Ve(o))&&(d=Qe(t)),r){const e=lt(t,!0,a,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&(s.x=ut(o));const l=!o||r||a?ve(0):ct(o,d);return{x:i.left+d.scrollLeft-s.x-l.x,y:i.top+d.scrollTop-s.y-l.y,width:i.width,height:i.height}}function ht(e){return"static"===Xe(e).position}function mt(e,t){if(!Ue(e)||"fixed"===Xe(e).position)return null;if(t)return t(e);let n=e.offsetParent;return Ge(e)===n&&(n=n.ownerDocument.body),n}function gt(e,t){const n=Be(e);if(Ye(e))return n;if(!Ue(e)){let t=et(e);for(;t&&!Je(t);){if(ze(t)&&!ht(t))return t;t=et(t)}return n}let r=mt(e,t);for(;r&&He(r)&&ht(r);)r=mt(r,t);return r&&Je(r)&&ht(r)&&!qe(r)?n:r||function(e){let t=et(e);for(;Ue(t)&&!Je(t);){if(qe(t))return t;if(Ye(t))return null;t=et(t)}return null}(e)||n}const yt={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const a="fixed"===o,i=Ge(r),d=!!t&&Ye(t.floating);if(r===i||d&&a)return n;let s={scrollLeft:0,scrollTop:0},l=ve(1);const u=ve(0),c=Ue(r);if((c||!c&&!a)&&(("body"!==Le(r)||Ve(i))&&(s=Qe(r)),Ue(r))){const e=lt(r);l=it(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const f=!i||c||a?ve(0):ct(i,s,!0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-s.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-s.scrollTop*l.y+u.y+f.y}},getDocumentElement:Ge,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[..."clippingAncestors"===n?Ye(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=nt(e,[],!1).filter((e=>ze(e)&&"body"!==Le(e))),o=null;const a="fixed"===Xe(e).position;let i=a?et(e):e;for(;ze(i)&&!Je(i);){const t=Xe(i),n=qe(i);n||"fixed"!==t.position||(o=null),(a?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||Ve(i)&&!n&&pt(e,i))?r=r.filter((e=>e!==i)):o=t,i=et(i)}return t.set(e,r),r}(t,this._c):[].concat(n),r],i=a[0],d=a.reduce(((e,n)=>{const r=ft(t,n,o);return e.top=me(r.top,e.top),e.right=he(r.right,e.right),e.bottom=he(r.bottom,e.bottom),e.left=me(r.left,e.left),e}),ft(t,i,o));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}},getOffsetParent:gt,getElementRects:async function(e){const t=this.getOffsetParent||gt,n=this.getDimensions,r=await n(e.floating);return{reference:$t(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=ot(e);return{width:t,height:n}},getScale:it,isElement:ze,isRTL:function(e){return"rtl"===Xe(e).direction}};function vt(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:d="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,l=at(e),u=o||a?[...l?nt(l):[],...nt(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),a&&e.addEventListener("resize",n)}));const c=l&&d?function(e,t){let n,r=null;const o=Ge(e);function a(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function i(d,s){void 0===d&&(d=!1),void 0===s&&(s=1),a();const{left:l,top:u,width:c,height:f}=e.getBoundingClientRect();if(d||t(),!c||!f)return;const p={rootMargin:-ye(u)+"px "+-ye(o.clientWidth-(l+c))+"px "+-ye(o.clientHeight-(u+f))+"px "+-ye(l)+"px",threshold:me(0,he(1,s))||1};let $=!0;function h(e){const t=e[0].intersectionRatio;if(t!==s){if(!$)return i();t?i(!1,t):n=setTimeout((()=>{i(!1,1e-7)}),1e3)}$=!1}try{r=new IntersectionObserver(h,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(h,p)}r.observe(e)}(!0),a}(l,n):null;let f,p=-1,$=null;i&&($=new ResizeObserver((e=>{let[r]=e;r&&r.target===l&&$&&($.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=$)||e.observe(t)}))),n()})),l&&!s&&$.observe(l),$.observe(t));let h=s?lt(e):null;return s&&function t(){const r=lt(e);!h||r.x===h.x&&r.y===h.y&&r.width===h.width&&r.height===h.height||n();h=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),a&&e.removeEventListener("resize",n)})),null==c||c(),null==(e=$)||e.disconnect(),$=null,s&&cancelAnimationFrame(f)}}const bt=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:a,placement:i,middlewareData:d}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,a=await(null==r.isRTL?void 0:r.isRTL(o.floating)),i=Ne(n),d=Se(n),s="y"===Pe(n),l=["left","top"].includes(i)?-1:1,u=a&&s?-1:1,c=Ce(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:$}="number"==typeof c?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return d&&"number"==typeof $&&(p="end"===d?-1*$:$),s?{x:p*u,y:f*l}:{x:f*l,y:p*u}}(t,e);return i===(null==(n=d.offset)?void 0:n.placement)&&null!=(r=d.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:a+s.y,data:{...s,placement:i}}}}},wt=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:d={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=Ce(e,t),l={x:n,y:r},u=await Me(t,s),c=Pe(Ne(o)),f=Ee(c);let p=l[f],$=l[c];if(a){const e="y"===f?"bottom":"right";p=xe(p+u["y"===f?"top":"left"],p,p-u[e])}if(i){const e="y"===c?"bottom":"right";$=xe($+u["y"===c?"top":"left"],$,$-u[e])}const h=d.fn({...t,[f]:p,[c]:$});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:a,[c]:i}}}}}},xt=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:a,rects:i,initialPlacement:d,platform:s,elements:l}=t,{mainAxis:u=!0,crossAxis:c=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:$="none",flipAlignment:h=!0,...m}=Ce(e,t);if(null!=(n=a.arrow)&&n.alignmentOffset)return{};const g=Ne(o),y=Pe(d),v=Ne(d)===d,b=await(null==s.isRTL?void 0:s.isRTL(l.floating)),w=f||(v||!h?[Ie(d)]:function(e){const t=Ie(e);return[ke(e),t,ke(t)]}(d)),x="none"!==$;!f&&x&&w.push(...function(e,t,n,r){const o=Se(e);let a=function(e,t,n){const r=["left","right"],o=["right","left"],a=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?a:i;default:return[]}}(Ne(e),"start"===n,r);return o&&(a=a.map((e=>e+"-"+o)),t&&(a=a.concat(a.map(ke)))),a}(d,h,$,b));const C=[d,...w],N=await Me(t,m),S=[];let E=(null==(r=a.flip)?void 0:r.overflows)||[];if(u&&S.push(N[g]),c){const e=function(e,t,n){void 0===n&&(n=!1);const r=Se(e),o=Ae(e),a=Oe(o);let i="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=Ie(i)),[i,Ie(i)]}(o,i,b);S.push(N[e[0]],N[e[1]])}if(E=[...E,{placement:o,overflows:S}],!S.every((e=>e<=0))){var O,P;const e=((null==(O=a.flip)?void 0:O.index)||0)+1,t=C[e];if(t)return{data:{index:e,overflows:E},reset:{placement:t}};let n=null==(P=E.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:P.placement;if(!n)switch(p){case"bestFit":{var A;const e=null==(A=E.filter((e=>{if(x){const t=Pe(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:A[0];e&&(n=e);break}case"initialPlacement":n=d}if(o!==n)return{reset:{placement:n}}}return{}}}},Ct=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:a,platform:i,elements:d}=t,{apply:s=()=>{},...l}=Ce(e,t),u=await Me(t,l),c=Ne(o),f=Se(o),p="y"===Pe(o),{width:$,height:h}=a.floating;let m,g;"top"===c||"bottom"===c?(m=c,g=f===(await(null==i.isRTL?void 0:i.isRTL(d.floating))?"start":"end")?"left":"right"):(g=c,m="end"===f?"top":"bottom");const y=h-u.top-u.bottom,v=$-u.left-u.right,b=he(h-u[m],y),w=he($-u[g],v),x=!t.middlewareData.shift;let C=b,N=w;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(N=v),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(C=y),x&&!f){const e=me(u.left,0),t=me(u.right,0),n=me(u.top,0),r=me(u.bottom,0);p?N=$-2*(0!==e||0!==t?e+t:me(u.left,u.right)):C=h-2*(0!==n||0!==r?n+r:me(u.top,u.bottom))}await s({...t,availableWidth:N,availableHeight:C});const S=await i.getDimensions(d.floating);return $!==S.width||h!==S.height?{reset:{rects:!0}}:{}}}},Nt=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Ce(e,t);switch(r){case"referenceHidden":{const e=Fe(await Me(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:_e(e)}}}case"escaped":{const e=Fe(await Me(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:_e(e)}}}default:return{}}}}},St=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:a,platform:i,elements:d,middlewareData:s}=t,{element:l,padding:u=0}=Ce(e,t)||{};if(null==l)return{};const c=Te(u),f={x:n,y:r},p=Ae(o),$=Oe(p),h=await i.getDimensions(l),m="y"===p,g=m?"top":"left",y=m?"bottom":"right",v=m?"clientHeight":"clientWidth",b=a.reference[$]+a.reference[p]-f[p]-a.floating[$],w=f[p]-a.reference[p],x=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l));let C=x?x[v]:0;C&&await(null==i.isElement?void 0:i.isElement(x))||(C=d.floating[v]||a.floating[$]);const N=b/2-w/2,S=C/2-h[$]/2-1,E=he(c[g],S),O=he(c[y],S),P=E,A=C-h[$]-O,k=C/2-h[$]/2+N,I=xe(P,k,A),T=!s.arrow&&null!=Se(o)&&k!==I&&a.reference[$]/2-(k<P?E:O)-h[$]/2<0,R=T?k<P?k-P:k-A:0;return{[p]:f[p]+R,data:{[p]:I,centerOffset:k-I-R,...T&&{alignmentOffset:R}},reset:T}}}),Et=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:a,middlewareData:i}=t,{offset:d=0,mainAxis:s=!0,crossAxis:l=!0}=Ce(e,t),u={x:n,y:r},c=Pe(o),f=Ee(c);let p=u[f],$=u[c];const h=Ce(d,t),m="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(s){const e="y"===f?"height":"width",t=a.reference[f]-a.floating[e]+m.mainAxis,n=a.reference[f]+a.reference[e]-m.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){var g,y;const e="y"===f?"width":"height",t=["top","left"].includes(Ne(o)),n=a.reference[c]-a.floating[e]+(t&&(null==(g=i.offset)?void 0:g[c])||0)+(t?0:m.crossAxis),r=a.reference[c]+a.reference[e]+(t?0:(null==(y=i.offset)?void 0:y[c])||0)-(t?m.crossAxis:0);$<n?$=n:$>r&&($=r)}return{[f]:p,[c]:$}}}},Ot=(e,t,n)=>{const r=new Map,o={platform:yt,...n},a={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:i}=n,d=a.filter(Boolean),s=await(null==i.isRTL?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:c}=je(l,r,s),f=r,p={},$=0;for(let n=0;n<d.length;n++){const{name:a,fn:h}=d[n],{x:m,y:g,data:y,reset:v}=await h({x:u,y:c,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:l,platform:i,elements:{reference:e,floating:t}});u=null!=m?m:u,c=null!=g?g:c,p={...p,[a]:{...p[a],...y}},v&&$<=50&&($++,"object"==typeof v&&(v.placement&&(f=v.placement),v.rects&&(l=!0===v.rects?await i.getElementRects({reference:e,floating:t,strategy:o}):v.rects),({x:u,y:c}=je(l,f,s))),n=-1)}return{x:u,y:c,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:a})};var Pt="undefined"!=typeof document?o:a;function At(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!At(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!At(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function kt(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function It(e,t){const n=kt(e);return Math.round(t*n)/n}function Tt(t){const n=e.useRef(t);return Pt((()=>{n.current=t})),n}const Rt=e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?St({element:n.current,padding:r}).fn(t):{}:n?St({element:n,padding:r}).fn(t):{};var o}}),jt=(e,t)=>({...bt(e),options:[e,t]}),Mt=(e,t)=>({...wt(e),options:[e,t]}),Ft=(e,t)=>({...Et(e),options:[e,t]}),_t=(e,t)=>({...xt(e),options:[e,t]}),Dt=(e,t)=>({...Ct(e),options:[e,t]}),Lt=(e,t)=>({...Nt(e),options:[e,t]}),Bt=(e,t)=>({...Rt(e),options:[e,t]});var Gt=e.forwardRef(((e,t)=>{const{children:n,width:r=10,height:o=5,...a}=e;return b.jsx(G.svg,{...a,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:b.jsx("polygon",{points:"0,0 30,0 15,10"})})}));Gt.displayName="Arrow";var Wt=Gt;function zt(...t){const n=t[0];if(1===t.length)return n;const r=()=>{const r=t.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(t){const o=r.reduce(((e,{useScope:n,scopeName:r})=>({...e,...n(t)[`__scope${r}`]})),{});return e.useMemo((()=>({[`__scope${n.scopeName}`]:o})),[o])}};return r.scopeName=n.scopeName,r}var Ut="Popper",[Kt,Vt]=function(t,n=[]){let r=[];const o=()=>{const n=r.map((t=>e.createContext(t)));return function(r){const o=r?.[t]||n;return e.useMemo((()=>({[`__scope${t}`]:{...r,[t]:o}})),[r,o])}};return o.scopeName=t,[function(n,o){const a=e.createContext(o),i=r.length;function d(n){const{scope:r,children:o,...d}=n,s=r?.[t][i]||a,l=e.useMemo((()=>d),Object.values(d));return b.jsx(s.Provider,{value:l,children:o})}return r=[...r,o],d.displayName=n+"Provider",[d,function(r,d){const s=d?.[t][i]||a,l=e.useContext(s);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${r}\` must be used within \`${n}\``)}]},zt(o,...n)]}(Ut),[Ht,Yt]=Kt(Ut),qt=t=>{const{__scopePopper:n,children:r}=t,[o,a]=e.useState(null);return b.jsx(Ht,{scope:n,anchor:o,onAnchorChange:a,children:r})};qt.displayName=Ut;var Zt="PopperAnchor",Jt=e.forwardRef(((t,n)=>{const{__scopePopper:r,virtualRef:o,...a}=t,i=Yt(Zt,r),d=e.useRef(null),s=R(n,d);return e.useEffect((()=>{i.onAnchorChange(o?.current||d.current)})),o?null:b.jsx(G.div,{...a,ref:s})}));Jt.displayName=Zt;var Xt="PopperContent",[Qt,en]=Kt(Xt),tn=e.forwardRef(((t,n)=>{const{__scopePopper:r,side:o="bottom",sideOffset:a=0,align:i="center",alignOffset:d=0,arrowPadding:s=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:$=!1,updatePositionStrategy:h="optimized",onPlaced:m,...g}=t,y=Yt(Xt,r),[v,w]=e.useState(null),x=R(n,(e=>w(e))),[C,N]=e.useState(null),S=function(t){const[n,r]=e.useState(void 0);return ue((()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const e=new ResizeObserver((e=>{if(!Array.isArray(e))return;if(!e.length)return;const n=e[0];let o,a;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,a=t.blockSize}else o=t.offsetWidth,a=t.offsetHeight;r({width:o,height:a})}));return e.observe(t,{box:"border-box"}),()=>e.unobserve(t)}r(void 0)}),[t]),n}(C),E=S?.width??0,O=S?.height??0,P=o+("center"!==i?"-"+i:""),A="number"==typeof f?f:{top:0,right:0,bottom:0,left:0,...f},k=Array.isArray(c)?c:[c],I=k.length>0,T={padding:A,boundary:k.filter(an),altBoundary:I},{refs:j,floatingStyles:M,placement:F,isPositioned:_,middlewareData:D}=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:a,elements:{reference:i,floating:d}={},transform:s=!0,whileElementsMounted:l,open:c}=t,[f,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[$,h]=e.useState(o);At($,o)||h(o);const[m,g]=e.useState(null),[y,v]=e.useState(null),b=e.useCallback((e=>{e!==N.current&&(N.current=e,g(e))}),[]),w=e.useCallback((e=>{e!==S.current&&(S.current=e,v(e))}),[]),x=i||m,C=d||y,N=e.useRef(null),S=e.useRef(null),E=e.useRef(f),O=null!=l,P=Tt(l),A=Tt(a),k=Tt(c),I=e.useCallback((()=>{if(!N.current||!S.current)return;const e={placement:n,strategy:r,middleware:$};A.current&&(e.platform=A.current),Ot(N.current,S.current,e).then((e=>{const t={...e,isPositioned:!1!==k.current};T.current&&!At(E.current,t)&&(E.current=t,u.flushSync((()=>{p(t)})))}))}),[$,n,r,A,k]);Pt((()=>{!1==