UNPKG

crystara-sdk

Version:

Official SDK for Crystara NFT Marketplace

26 lines 251 kB
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as n from"react";import o,{forwardRef as i,createElement as a,useLayoutEffect as s,useState as l,useRef as c,useReducer as u,useEffect as d,useMemo as f,useCallback as h,createContext as m,useContext as p}from"react";import{motion as g,AnimatePresence as v,useAnimation as b}from"framer-motion";import*as y from"react-dom";import w from"react-dom";import x from"canvas-confetti";import E from"crypto";var k=function(){return k=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},k.apply(this,arguments)};function A(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function N(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))}function z(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function U(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))} /** * @license lucide-react v0.513.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,((e,t,r)=>r?r.toUpperCase():t.toLowerCase())))(e);return t.charAt(0).toUpperCase()+t.slice(1)},T=(...e)=>e.filter(((e,t,r)=>Boolean(e)&&""!==e.trim()&&r.indexOf(e)===t)).join(" ").trim(),S=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0}; /** * @license lucide-react v0.513.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ var C={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.513.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I=i((({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:s,...l},c)=>a("svg",{ref:c,...C,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:T("lucide",o),...!i&&!S(l)&&{"aria-hidden":"true"},...l},[...s.map((([e,t])=>a(e,t))),...Array.isArray(i)?i:[i]]))),O=(e,t)=>{const r=i((({className:r,...n},o)=>{return a(I,{ref:o,iconNode:t,className:T(`lucide-${i=_(e),i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,r),...n});var i}));return r.displayName=_(e),r},L=O("badge-check",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),M=O("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),R=O("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),B=O("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]); /** * @license lucide-react v0.513.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */function P(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function D(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function H(...e){return t=>{let r=!1;const n=e.map((e=>{const n=D(e,t);return r||"function"!=typeof n||(r=!0),n}));if(r)return()=>{for(let t=0;t<n.length;t++){const r=n[t];"function"==typeof r?r():D(e[t],null)}}}}function F(...e){return n.useCallback(H(...e),e)}function W(t,r=[]){let o=[];const i=()=>{const e=o.map((e=>n.createContext(e)));return function(r){const o=r?.[t]||e;return n.useMemo((()=>({[`__scope${t}`]:{...r,[t]:o}})),[r,o])}};return i.scopeName=t,[function(r,i){const a=n.createContext(i),s=o.length;o=[...o,i];const l=r=>{const{scope:o,children:i,...l}=r,c=o?.[t]?.[s]||a,u=n.useMemo((()=>l),Object.values(l));return e(c.Provider,{value:u,children:i})};return l.displayName=r+"Provider",[l,function(e,o){const l=o?.[t]?.[s]||a,c=n.useContext(l);if(c)return c;if(void 0!==i)return i;throw new Error(`\`${e}\` must be used within \`${r}\``)}]},j(i,...r)]}function j(...e){const t=e[0];if(1===e.length)return t;const r=()=>{const r=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const o=r.reduce(((t,{useScope:r,scopeName:n})=>({...t,...r(e)[`__scope${n}`]})),{});return n.useMemo((()=>({[`__scope${t.scopeName}`]:o})),[o])}};return r.scopeName=t.scopeName,r}function $(t){const r=K(t),o=n.forwardRef(((t,o)=>{const{children:i,...a}=t,s=n.Children.toArray(i),l=s.find(Y);if(l){const t=l.props.children,i=s.map((e=>e===l?n.Children.count(t)>1?n.Children.only(null):n.isValidElement(t)?t.props.children:null:e));return e(r,{...a,ref:o,children:n.isValidElement(t)?n.cloneElement(t,void 0,i):null})}return e(r,{...a,ref:o,children:i})}));return o.displayName=`${t}.Slot`,o}var G=$("Slot");function K(e){const t=n.forwardRef(((e,t)=>{const{children:r,...o}=e;if(n.isValidElement(r)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(r),i=function(e,t){const r={...t};for(const n in t){const o=e[n],i=t[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...e)=>{const t=i(...e);return o(...e),t}:o&&(r[n]=o):"style"===n?r[n]={...o,...i}:"className"===n&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...e,...r}}(o,r.props);return r.type!==n.Fragment&&(i.ref=t?H(t,e):e),n.cloneElement(r,i)}return n.Children.count(r)>1?n.Children.only(null):null}));return t.displayName=`${e}.SlotClone`,t}var V=Symbol("radix.slottable");function Y(e){return n.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===V}var q=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((t,r)=>{const o=$(`Primitive.${r}`),i=n.forwardRef(((t,n)=>{const{asChild:i,...a}=t,s=i?o:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e(s,{...a,ref:n})}));return i.displayName=`Primitive.${r}`,{...t,[r]:i}}),{});function X(e){const t=n.useRef(e);return n.useEffect((()=>{t.current=e})),n.useMemo((()=>(...e)=>t.current?.(...e)),[])}var Q,Z="dismissableLayer.update",J="dismissableLayer.pointerDownOutside",ee="dismissableLayer.focusOutside",te=n.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),re=n.forwardRef(((t,r)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=t,d=n.useContext(te),[f,h]=n.useState(null),m=f?.ownerDocument??globalThis?.document,[,p]=n.useState({}),g=F(r,(e=>h(e))),v=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=v.indexOf(b),w=f?v.indexOf(f):-1,x=d.layersWithOutsidePointerEventsDisabled.size>0,E=w>=y,k=function(e,t=globalThis?.document){const r=X(e),o=n.useRef(!1),i=n.useRef((()=>{}));return n.useEffect((()=>{const e=e=>{if(e.target&&!o.current){let n=function(){oe(J,r,o,{discrete:!0})};const o={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",i.current),i.current=n,t.addEventListener("click",i.current,{once:!0})):n()}else t.removeEventListener("click",i.current);o.current=!1},n=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(n),t.removeEventListener("pointerdown",e),t.removeEventListener("click",i.current)}}),[t,r]),{onPointerDownCapture:()=>o.current=!0}}((e=>{const t=e.target,r=[...d.branches].some((e=>e.contains(t)));E&&!r&&(a?.(e),l?.(e),e.defaultPrevented||c?.())}),m),A=function(e,t=globalThis?.document){const r=X(e),o=n.useRef(!1);return n.useEffect((()=>{const e=e=>{if(e.target&&!o.current){oe(ee,r,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(s?.(e),l?.(e),e.defaultPrevented||c?.())}),m);return function(e,t=globalThis?.document){const r=X(e);n.useEffect((()=>{const e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})}),[r,t])}((e=>{w===d.layers.size-1&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),m),n.useEffect((()=>{if(f)return o&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(Q=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),ne(),()=>{o&&1===d.layersWithOutsidePointerEventsDisabled.size&&(m.body.style.pointerEvents=Q)}}),[f,m,o,d]),n.useEffect((()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),ne())}),[f,d]),n.useEffect((()=>{const e=()=>p({});return document.addEventListener(Z,e),()=>document.removeEventListener(Z,e)}),[]),e(q.div,{...u,ref:g,style:{pointerEvents:x?E?"auto":"none":void 0,...t.style},onFocusCapture:P(t.onFocusCapture,A.onFocusCapture),onBlurCapture:P(t.onBlurCapture,A.onBlurCapture),onPointerDownCapture:P(t.onPointerDownCapture,k.onPointerDownCapture)})}));re.displayName="DismissableLayer";function ne(){const e=new CustomEvent(Z);document.dispatchEvent(e)}function oe(e,t,r,{discrete:n}){const o=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?function(e,t){e&&y.flushSync((()=>e.dispatchEvent(t)))}(o,i):o.dispatchEvent(i)}n.forwardRef(((t,r)=>{const o=n.useContext(te),i=n.useRef(null),a=F(r,i);return n.useEffect((()=>{const e=i.current;if(e)return o.branches.add(e),()=>{o.branches.delete(e)}}),[o.branches]),e(q.div,{...t,ref:a})})).displayName="DismissableLayerBranch";var ie=globalThis?.document?n.useLayoutEffect:()=>{},ae=n[" useId ".trim().toString()]||(()=>{}),se=0;function le(e){const[t,r]=n.useState(ae());return ie((()=>{e||r((e=>e??String(se++)))}),[e]),e||(t?`radix-${t}`:"")}const ce=["top","right","bottom","left"],ue=Math.min,de=Math.max,fe=Math.round,he=Math.floor,me=e=>({x:e,y:e}),pe={left:"right",right:"left",bottom:"top",top:"bottom"},ge={start:"end",end:"start"};function ve(e,t,r){return de(e,ue(t,r))}function be(e,t){return"function"==typeof e?e(t):e}function ye(e){return e.split("-")[0]}function we(e){return e.split("-")[1]}function xe(e){return"x"===e?"y":"x"}function Ee(e){return"y"===e?"height":"width"}function ke(e){return["top","bottom"].includes(ye(e))?"y":"x"}function Ae(e){return xe(ke(e))}function Ne(e){return e.replace(/start|end/g,(e=>ge[e]))}function ze(e){return e.replace(/left|right|bottom|top/g,(e=>pe[e]))}function Ue(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 _e(e){const{x:t,y:r,width:n,height:o}=e;return{width:n,height:o,top:r,left:t,right:t+n,bottom:r+o,x:t,y:r}}function Te(e,t,r){let{reference:n,floating:o}=e;const i=ke(t),a=Ae(t),s=Ee(a),l=ye(t),c="y"===i,u=n.x+n.width/2-o.width/2,d=n.y+n.height/2-o.height/2,f=n[s]/2-o[s]/2;let h;switch(l){case"top":h={x:u,y:n.y-o.height};break;case"bottom":h={x:u,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:d};break;case"left":h={x:n.x-o.width,y:d};break;default:h={x:n.x,y:n.y}}switch(we(t)){case"start":h[a]-=f*(r&&c?-1:1);break;case"end":h[a]+=f*(r&&c?-1:1)}return h}async function Se(e,t){var r;void 0===t&&(t={});const{x:n,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=be(t,e),m=Ue(h),p=s[f?"floating"===d?"reference":"floating":d],g=_e(await i.getClippingRect({element:null==(r=await(null==i.isElement?void 0:i.isElement(p)))||r?p:p.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:n,y:o,width:a.floating.width,height:a.floating.height}:a.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),y=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},w=_e(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:b,strategy:l}):v);return{top:(g.top-w.top+m.top)/y.y,bottom:(w.bottom-g.bottom+m.bottom)/y.y,left:(g.left-w.left+m.left)/y.x,right:(w.right-g.right+m.right)/y.x}}function Ce(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ie(e){return ce.some((t=>e[t]>=0))}function Oe(){return"undefined"!=typeof window}function Le(e){return Be(e)?(e.nodeName||"").toLowerCase():"#document"}function Me(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Re(e){var t;return null==(t=(Be(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Be(e){return!!Oe()&&(e instanceof Node||e instanceof Me(e).Node)}function Pe(e){return!!Oe()&&(e instanceof Element||e instanceof Me(e).Element)}function De(e){return!!Oe()&&(e instanceof HTMLElement||e instanceof Me(e).HTMLElement)}function He(e){return!(!Oe()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Me(e).ShadowRoot)}function Fe(e){const{overflow:t,overflowX:r,overflowY:n,display:o}=Ve(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(o)}function We(e){return["table","td","th"].includes(Le(e))}function je(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function $e(e){const t=Ge(),r=Pe(e)?Ve(e):e;return["transform","translate","scale","rotate","perspective"].some((e=>!!r[e]&&"none"!==r[e]))||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||["transform","translate","scale","rotate","perspective","filter"].some((e=>(r.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(r.contain||"").includes(e)))}function Ge(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Ke(e){return["html","body","#document"].includes(Le(e))}function Ve(e){return Me(e).getComputedStyle(e)}function Ye(e){return Pe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function qe(e){if("html"===Le(e))return e;const t=e.assignedSlot||e.parentNode||He(e)&&e.host||Re(e);return He(t)?t.host:t}function Xe(e){const t=qe(e);return Ke(t)?e.ownerDocument?e.ownerDocument.body:e.body:De(t)&&Fe(t)?t:Xe(t)}function Qe(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const o=Xe(e),i=o===(null==(n=e.ownerDocument)?void 0:n.body),a=Me(o);if(i){const e=Ze(a);return t.concat(a,a.visualViewport||[],Fe(o)?o:[],e&&r?Qe(e):[])}return t.concat(o,Qe(o,[],r))}function Ze(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Je(e){const t=Ve(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=De(e),i=o?e.offsetWidth:r,a=o?e.offsetHeight:n,s=fe(r)!==i||fe(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function et(e){return Pe(e)?e:e.contextElement}function tt(e){const t=et(e);if(!De(t))return me(1);const r=t.getBoundingClientRect(),{width:n,height:o,$:i}=Je(t);let a=(i?fe(r.width):r.width)/n,s=(i?fe(r.height):r.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const rt=me(0);function nt(e){const t=Me(e);return Ge()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:rt}function ot(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const o=e.getBoundingClientRect(),i=et(e);let a=me(1);t&&(n?Pe(n)&&(a=tt(n)):a=tt(e));const s=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==Me(e))&&t}(i,r,n)?nt(i):me(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,u=o.width/a.x,d=o.height/a.y;if(i){const e=Me(i),t=n&&Pe(n)?Me(n):n;let r=e,o=Ze(r);for(;o&&n&&t!==r;){const e=tt(o),t=o.getBoundingClientRect(),n=Ve(o),i=t.left+(o.clientLeft+parseFloat(n.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(n.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=i,c+=a,r=Me(o),o=Ze(r)}}return _e({width:u,height:d,x:l,y:c})}function it(e,t){const r=Ye(e).scrollLeft;return t?t.left+r:ot(Re(e)).left+r}function at(e,t,r){void 0===r&&(r=!1);const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-(r?0:it(e,n)),y:n.top+t.scrollTop}}function st(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=Me(e),n=Re(e),o=r.visualViewport;let i=n.clientWidth,a=n.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=Ge();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,r);else if("document"===t)n=function(e){const t=Re(e),r=Ye(e),n=e.ownerDocument.body,o=de(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=de(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+it(e);const s=-r.scrollTop;return"rtl"===Ve(n).direction&&(a+=de(t.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}(Re(e));else if(Pe(t))n=function(e,t){const r=ot(e,!0,"fixed"===t),n=r.top+e.clientTop,o=r.left+e.clientLeft,i=De(e)?tt(e):me(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:n*i.y}}(t,r);else{const r=nt(e);n={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return _e(n)}function lt(e,t){const r=qe(e);return!(r===t||!Pe(r)||Ke(r))&&("fixed"===Ve(r).position||lt(r,t))}function ct(e,t,r){const n=De(t),o=Re(t),i="fixed"===r,a=ot(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=me(0);function c(){l.x=it(o)}if(n||!n&&!i)if(("body"!==Le(t)||Fe(o))&&(s=Ye(t)),n){const e=ot(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&c();i&&!n&&o&&c();const u=!o||n||i?me(0):at(o,s);return{x:a.left+s.scrollLeft-l.x-u.x,y:a.top+s.scrollTop-l.y-u.y,width:a.width,height:a.height}}function ut(e){return"static"===Ve(e).position}function dt(e,t){if(!De(e)||"fixed"===Ve(e).position)return null;if(t)return t(e);let r=e.offsetParent;return Re(e)===r&&(r=r.ownerDocument.body),r}function ft(e,t){const r=Me(e);if(je(e))return r;if(!De(e)){let t=qe(e);for(;t&&!Ke(t);){if(Pe(t)&&!ut(t))return t;t=qe(t)}return r}let n=dt(e,t);for(;n&&We(n)&&ut(n);)n=dt(n,t);return n&&Ke(n)&&ut(n)&&!$e(n)?r:n||function(e){let t=qe(e);for(;De(t)&&!Ke(t);){if($e(t))return t;if(je(t))return null;t=qe(t)}return null}(e)||r}const ht={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:o}=e;const i="fixed"===o,a=Re(n),s=!!t&&je(t.floating);if(n===a||s&&i)return r;let l={scrollLeft:0,scrollTop:0},c=me(1);const u=me(0),d=De(n);if((d||!d&&!i)&&(("body"!==Le(n)||Fe(a))&&(l=Ye(n)),De(n))){const e=ot(n);c=tt(n),u.x=e.x+n.clientLeft,u.y=e.y+n.clientTop}const f=!a||d||i?me(0):at(a,l,!0);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:r.y*c.y-l.scrollTop*c.y+u.y+f.y}},getDocumentElement:Re,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:o}=e;const i=[..."clippingAncestors"===r?je(t)?[]:function(e,t){const r=t.get(e);if(r)return r;let n=Qe(e,[],!1).filter((e=>Pe(e)&&"body"!==Le(e))),o=null;const i="fixed"===Ve(e).position;let a=i?qe(e):e;for(;Pe(a)&&!Ke(a);){const t=Ve(a),r=$e(a);r||"fixed"!==t.position||(o=null),(i?!r&&!o:!r&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||Fe(a)&&!r&&lt(e,a))?n=n.filter((e=>e!==a)):o=t,a=qe(a)}return t.set(e,n),n}(t,this._c):[].concat(r),n],a=i[0],s=i.reduce(((e,r)=>{const n=st(t,r,o);return e.top=de(n.top,e.top),e.right=ue(n.right,e.right),e.bottom=ue(n.bottom,e.bottom),e.left=de(n.left,e.left),e}),st(t,a,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:ft,getElementRects:async function(e){const t=this.getOffsetParent||ft,r=this.getDimensions,n=await r(e.floating);return{reference:ct(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:r}=Je(e);return{width:t,height:r}},getScale:tt,isElement:Pe,isRTL:function(e){return"rtl"===Ve(e).direction}};function mt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pt(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=n,c=et(e),u=o||i?[...c?Qe(c):[],...Qe(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",r,{passive:!0}),i&&e.addEventListener("resize",r)}));const d=c&&s?function(e,t){let r,n=null;const o=Re(e);function i(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:h}=c;if(s||t(),!f||!h)return;const m={rootMargin:-he(d)+"px "+-he(o.clientWidth-(u+f))+"px "+-he(o.clientHeight-(d+h))+"px "+-he(u)+"px",threshold:de(0,ue(1,l))||1};let p=!0;function g(t){const n=t[0].intersectionRatio;if(n!==l){if(!p)return a();n?a(!1,n):r=setTimeout((()=>{a(!1,1e-7)}),1e3)}1!==n||mt(c,e.getBoundingClientRect())||a(),p=!1}try{n=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch(e){n=new IntersectionObserver(g,m)}n.observe(e)}(!0),i}(c,r):null;let f,h=-1,m=null;a&&(m=new ResizeObserver((e=>{let[n]=e;n&&n.target===c&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame((()=>{var e;null==(e=m)||e.observe(t)}))),r()})),c&&!l&&m.observe(c),m.observe(t));let p=l?ot(e):null;return l&&function t(){const n=ot(e);p&&!mt(p,n)&&r();p=n,f=requestAnimationFrame(t)}(),r(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",r),i&&e.removeEventListener("resize",r)})),null==d||d(),null==(e=m)||e.disconnect(),m=null,l&&cancelAnimationFrame(f)}}const gt=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:r,platform:n,elements:o}=e,i=await(null==n.isRTL?void 0:n.isRTL(o.floating)),a=ye(r),s=we(r),l="y"===ke(r),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=be(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:m}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof m&&(h="end"===s?-1*m:m),l?{x:h*u,y:f*c}:{x:f*c,y:h*u}}(t,e);return a===(null==(r=s.offset)?void 0:r.placement)&&null!=(n=s.arrow)&&n.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}},vt=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=be(e,t),c={x:r,y:n},u=await Se(t,l),d=ke(ye(o)),f=xe(d);let h=c[f],m=c[d];if(i){const e="y"===f?"bottom":"right";h=ve(h+u["y"===f?"top":"left"],h,h-u[e])}if(a){const e="y"===d?"bottom":"right";m=ve(m+u["y"===d?"top":"left"],m,m-u[e])}const p=s.fn({...t,[f]:h,[d]:m});return{...p,data:{x:p.x-r,y:p.y-n,enabled:{[f]:i,[d]:a}}}}}},bt=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:p=!0,...g}=be(e,t);if(null!=(r=i.arrow)&&r.alignmentOffset)return{};const v=ye(o),b=ke(s),y=ye(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=f||(y||!p?[ze(s)]:function(e){const t=ze(e);return[Ne(e),t,Ne(t)]}(s)),E="none"!==m;!f&&E&&x.push(...function(e,t,r,n){const o=we(e);let i=function(e,t,r){const n=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return r?t?o:n:t?n:o;case"left":case"right":return t?i:a;default:return[]}}(ye(e),"start"===r,n);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Ne)))),i}(s,p,m,w));const k=[s,...x],A=await Se(t,g),N=[];let z=(null==(n=i.flip)?void 0:n.overflows)||[];if(u&&N.push(A[v]),d){const e=function(e,t,r){void 0===r&&(r=!1);const n=we(e),o=Ae(e),i=Ee(o);let a="x"===o?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=ze(a)),[a,ze(a)]}(o,a,w);N.push(A[e[0]],A[e[1]])}if(z=[...z,{placement:o,overflows:N}],!N.every((e=>e<=0))){var U,_;const e=((null==(U=i.flip)?void 0:U.index)||0)+1,t=k[e];if(t){if(!("alignment"===d&&b!==ke(t))||z.every((e=>e.overflows[0]>0&&ke(e.placement)===b)))return{data:{index:e,overflows:z},reset:{placement:t}}}let r=null==(_=z.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:_.placement;if(!r)switch(h){case"bestFit":{var T;const e=null==(T=z.filter((e=>{if(E){const t=ke(e.placement);return t===b||"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:T[0];e&&(r=e);break}case"initialPlacement":r=s}if(o!==r)return{reset:{placement:r}}}return{}}}},yt=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:o,rects:i,platform:a,elements:s}=t,{apply:l=()=>{},...c}=be(e,t),u=await Se(t,c),d=ye(o),f=we(o),h="y"===ke(o),{width:m,height:p}=i.floating;let g,v;"top"===d||"bottom"===d?(g=d,v=f===(await(null==a.isRTL?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(v=d,g="end"===f?"top":"bottom");const b=p-u.top-u.bottom,y=m-u.left-u.right,w=ue(p-u[g],b),x=ue(m-u[v],y),E=!t.middlewareData.shift;let k=w,A=x;if(null!=(r=t.middlewareData.shift)&&r.enabled.x&&(A=y),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(k=b),E&&!f){const e=de(u.left,0),t=de(u.right,0),r=de(u.top,0),n=de(u.bottom,0);h?A=m-2*(0!==e||0!==t?e+t:de(u.left,u.right)):k=p-2*(0!==r||0!==n?r+n:de(u.top,u.bottom))}await l({...t,availableWidth:A,availableHeight:k});const N=await a.getDimensions(s.floating);return m!==N.width||p!==N.height?{reset:{rects:!0}}:{}}}},wt=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...o}=be(e,t);switch(n){case"referenceHidden":{const e=Ce(await Se(t,{...o,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ie(e)}}}case"escaped":{const e=Ce(await Se(t,{...o,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:Ie(e)}}}default:return{}}}}},xt=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:o,rects:i,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=be(e,t)||{};if(null==c)return{};const d=Ue(u),f={x:r,y:n},h=Ae(o),m=Ee(h),p=await a.getDimensions(c),g="y"===h,v=g?"top":"left",b=g?"bottom":"right",y=g?"clientHeight":"clientWidth",w=i.reference[m]+i.reference[h]-f[h]-i.floating[m],x=f[h]-i.reference[h],E=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let k=E?E[y]:0;k&&await(null==a.isElement?void 0:a.isElement(E))||(k=s.floating[y]||i.floating[m]);const A=w/2-x/2,N=k/2-p[m]/2-1,z=ue(d[v],N),U=ue(d[b],N),_=z,T=k-p[m]-U,S=k/2-p[m]/2+A,C=ve(_,S,T),I=!l.arrow&&null!=we(o)&&S!==C&&i.reference[m]/2-(S<_?z:U)-p[m]/2<0,O=I?S<_?S-_:S-T:0;return{[h]:f[h]+O,data:{[h]:C,centerOffset:S-C-O,...I&&{alignmentOffset:O}},reset:I}}}),Et=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:o,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=be(e,t),u={x:r,y:n},d=ke(o),f=xe(d);let h=u[f],m=u[d];const p=be(s,t),g="number"==typeof p?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const e="y"===f?"height":"width",t=i.reference[f]-i.floating[e]+g.mainAxis,r=i.reference[f]+i.reference[e]-g.mainAxis;h<t?h=t:h>r&&(h=r)}if(c){var v,b;const e="y"===f?"width":"height",t=["top","left"].includes(ye(o)),r=i.reference[d]-i.floating[e]+(t&&(null==(v=a.offset)?void 0:v[d])||0)+(t?0:g.crossAxis),n=i.reference[d]+i.reference[e]+(t?0:(null==(b=a.offset)?void 0:b[d])||0)-(t?g.crossAxis:0);m<r?m=r:m>n&&(m=n)}return{[f]:h,[d]:m}}}},kt=(e,t,r)=>{const n=new Map,o={platform:ht,...r},i={...o.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:a}=r,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Te(c,n,l),f=n,h={},m=0;for(let r=0;r<s.length;r++){const{name:i,fn:p}=s[r],{x:g,y:v,data:b,reset:y}=await p({x:u,y:d,initialPlacement:n,placement:f,strategy:o,middlewareData:h,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,d=null!=v?v:d,h={...h,[i]:{...h[i],...b}},y&&m<=50&&(m++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(c=!0===y.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):y.rects),({x:u,y:d}=Te(c,f,l))),r=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:h}})(e,t,{...o,platform:i})};var At="undefined"!=typeof document?s:function(){};function Nt(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 r,n,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;0!==n--;)if(!Nt(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!{}.hasOwnProperty.call(t,o[n]))return!1;for(n=r;0!==n--;){const r=o[n];if(("_owner"!==r||!e.$$typeof)&&!Nt(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function zt(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ut(e,t){const r=zt(e);return Math.round(t*r)/r}function _t(e){const t=n.useRef(e);return At((()=>{t.current=e})),t}const Tt=e=>({name:"arrow",options:e,fn(t){const{element:r,padding:n}="function"==typeof e?e(t):e;return r&&(o=r,{}.hasOwnProperty.call(o,"current"))?null!=r.current?xt({element:r.current,padding:n}).fn(t):{}:r?xt({element:r,padding:n}).fn(t):{};var o}}),St=(e,t)=>({...gt(e),options:[e,t]}),Ct=(e,t)=>({...vt(e),options:[e,t]}),It=(e,t)=>({...Et(e),options:[e,t]}),Ot=(e,t)=>({...bt(e),options:[e,t]}),Lt=(e,t)=>({...yt(e),options:[e,t]}),Mt=(e,t)=>({...wt(e),options:[e,t]}),Rt=(e,t)=>({...Tt(e),options:[e,t]});var Bt=n.forwardRef(((t,r)=>{const{children:n,width:o=10,height:i=5,...a}=t;return e(q.svg,{...a,ref:r,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:e("polygon",{points:"0,0 30,0 15,10"})})}));Bt.displayName="Arrow";var Pt=Bt;var Dt="Popper",[Ht,Ft]=W(Dt),[Wt,jt]=Ht(Dt),$t=t=>{const{__scopePopper:r,children:o}=t,[i,a]=n.useState(null);return e(Wt,{scope:r,anchor:i,onAnchorChange:a,children:o})};$t.displayName=Dt;var Gt="PopperAnchor",Kt=n.forwardRef(((t,r)=>{const{__scopePopper:o,virtualRef:i,...a}=t,s=jt(Gt,o),l=n.useRef(null),c=F(r,l);return n.useEffect((()=>{s.onAnchorChange(i?.current||l.current)})),i?null:e(q.div,{...a,ref:c})}));Kt.displayName=Gt;var Vt="PopperContent",[Yt,qt]=Ht(Vt),Xt=n.forwardRef(((t,r)=>{const{__scopePopper:o,side:i="bottom",sideOffset:a=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:g,...v}=t,b=jt(Vt,o),[w,x]=n.useState(null),E=F(r,(e=>x(e))),[k,A]=n.useState(null),N=function(e){const[t,r]=n.useState(void 0);return ie((()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver((t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let o,i;if("borderBoxSize"in n){const e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,i=t.blockSize}else o=e.offsetWidth,i=e.offsetHeight;r({width:o,height:i})}));return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)}),[e]),t}(k),z=N?.width??0,U=N?.height??0,_=i+("center"!==s?"-"+s:""),T="number"==typeof f?f:{top:0,right:0,bottom:0,left:0,...f},S=Array.isArray(d)?d:[d],C=S.length>0,I={padding:T,boundary:S.filter(er),altBoundary:C},{refs:O,floatingStyles:L,placement:M,isPositioned:R,middlewareData:B}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:a,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=n.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=n.useState(o);Nt(h,o)||m(o);const[p,g]=n.useState(null),[v,b]=n.useState(null),w=n.useCallback((e=>{e!==A.current&&(A.current=e,g(e))}),[]),x=n.useCallback((e=>{e!==N.current&&(N.current=e,b(e))}),[]),E=a||p,k=s||v,A=n.useRef(null),N=n.useRef(null),z=n.useRef(d),U=null!=c,_=_t(c),T=_t(i),S=_t(u),C=n.useCallback((()=>{if(!A.current||!N.current)return;const e={placement:t,strategy:r,middleware:h};T.current&&(e.platform=T.current),kt(A.current,N.current,e).then((e=>{const t={...e,isPositioned:!1!==S.current};I.current&&!Nt(z.current,t)&&(z.current=t,y.flushSync((()=>{f(t)})))}))}),[h,t,r,T,S]);At((()=>{!1===u&&z.current.isPositioned&&(z.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[u]);const I=n.useRef(!1);At((()=>(I.current=!0,()=>{I.current=!1})),[]),At((()=>{if(E&&(A.current=E),k&&(N.current=k),E&&k){if(_.current)return _.current(E,k,C);C()}}),[E,k,C,_,U]);const O=n.useMemo((()=>({reference:A,floating:N,setReference:w,setFloating:x})),[w,x]),L=n.useMemo((()=>({reference:E,floating:k})),[E,k]),M=n.useMemo((()=>{const e={position:r,left:0,top:0};if(!L.floating)return e;const t=Ut(L.floating,d.x),n=Ut(L.floating,d.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...zt(L.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,l,L.floating,d.x,d.y]);return n.useMemo((()=>({...d,update:C,refs:O,elements:L,floatingStyles:M})),[d,C,O,L,M])}({strategy:"fixed",placement:_,whileElementsMounted:(...e)=>pt(...e,{animationFrame:"always"===p}),elements:{reference:b.anchor},middleware:[St({mainAxis:a+U,alignmentAxis:l}),u&&Ct({mainAxis:!0,crossAxis:!1,limiter:"partial"===h?It():void 0,...I}),u&&Ot({...I}),Lt({...I,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{const{width:o,height:i}=t.reference,a=e.floating.style;a.setProperty("--radix-popper-available-width",`${r}px`),a.setProperty("--radix-popper-available-height",`${n}px`),a.setProperty("--radix-popper-anchor-width",`${o}px`),a.setProperty("--radix-popper-anchor-height",`${i}px`)}}),k&&Rt({element:k,padding:c}),tr({arrowWidth:z,arrowHeight:U}),m&&Mt({strategy:"referenceHidden",...I})]}),[P,D]=rr(M),H=X(g);ie((()=>{R&&H?.()}),[R,H]);const W=B.arrow?.x,j=B.arrow?.y,$=0!==B.arrow?.centerOffset,[G,K]=n.useState();return ie((()=>{w&&K(window.getComputedStyle(w).zIndex)}),[w]),e("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:R?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:G,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e(Yt,{scope:o,placedSide:P,onArrowChange:A,arrowX:W,arrowY:j,shouldHideArrow:$,children:e(q.div,{"data-side":P,"data-align":D,...v,ref:E,style:{...v.style,animation:R?void 0:"none"}})})})}));Xt.displayName=Vt;var Qt="PopperArrow",Zt={top:"bottom",right:"left",bottom:"top",left:"right"},Jt=n.forwardRef((function(t,r){const{__scopePopper:n,...o}=t,i=qt(Qt,n),a=Zt[i.placedSide];return e("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:e(Pt,{...o,ref:r,style:{...o.style,display:"block"}})})}));function er(e){return null!==e}Jt.displayName=Qt;var tr=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:o}=t,i=0!==o.arrow?.centerOffset,a=i?0:e.arrowWidth,s=i?0:e.arrowHeight,[l,c]=rr(r),u={start:"0%",center:"50%",end:"100%"}[c],d=(o.arrow?.x??0)+a/2,f=(o.arrow?.y??0)+s/2;let h="",m="";return"bottom"===l?(h=i?u:`${d}px`,m=-s+"px"):"top"===l?(h=i?u:`${d}px`,m=`${n.floating.height+s}px`):"right"===l?(h=-s+"px",m=i?u:`${f}px`):"left"===l&&(h=`${n.floating.width+s}px`,m=i?u:`${f}px`),{data:{x:h,y:m}}}});function rr(e){const[t,r="center"]=e.split("-");return[t,r]}var nr=$t,or=Kt,ir=Xt,ar=Jt,sr=n.forwardRef(((t,r)=>{const{container:o,...i}=t,[a,s]=n.useState(!1);ie((()=>s(!0)),[]);const l=o||a&&globalThis?.document?.body;return l?w.createPortal(e(q.div,{...i,ref:r}),l):null}));sr.displayName="Portal";var lr=e=>{const{present:t,children:r}=e,o=function(e){const[t,r]=n.useState(),o=n.useRef(null),i=n.useRef(e),a=n.useRef("none"),s=e?"mounted":"unmounted",[l,c]=function(e,t){return n.useReducer(((e,r)=>t[e][r]??e),e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return n.useEffect((()=>{const e=cr(o.current);a.current="mounted"===l?e:"none"}),[l]),ie((()=>{const t=o.current,r=i.current;if(r!==e){const n=a.current,o=cr(t);if(e)c("MOUNT");else if("none"===o||"none"===t?.display)c("UNMOUNT");else{c(r&&n!==o?"ANIMATION_OUT":"UNMOUNT")}i.current=e}}),[e,c]),ie((()=>{if(t){let e;const r=t.ownerDocument.defaultView??window,n=n=>{const a=cr(o.current).includes(n.animationName);if(n.target===t&&a&&(c("ANIMATION_END"),!i.current)){const n=t.style.animationFillMode;t.style.animationFillMode="forwards",e=r.setTimeout((()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=n)}))}},s=e=>{e.target===t&&(a.current=cr(o.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",n),t.addEventListener("animationend",n),()=>{r.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",n),t.removeEventListener("animationend",n)}}c("ANIMATION_END")}),[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:n.useCallback((e=>{o.current=e?getComputedStyle(e):null,r(e)}),[])}}(t),i="function"==typeof r?r({present:o.isPresent}):n.Children.only(r),a=F(o.ref,function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;if(r)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r)return e.props.ref;return e.props.ref||e.ref}(i));return"function"==typeof r||o.isPresent?n.cloneElement(i,{ref:a}):null};function cr(e){return e?.animationName||"none"}lr.displayName="Presence";var ur=n[" useInsertionEffect ".trim().toString()]||ie;function dr({prop:e,defaultProp:t,onChange:r=()=>{},caller:o}){const[i,a,s]=function({defaultProp:e,onChange:t}){const[r,o]=n.useState(e),i=n.useRef(r),a=n.useRef(t);return ur((()=>{a.current=t}),[t]),n.useEffect((()=>{i.current!==r&&(a.current?.(r),i.current=r)}),[r,i]),[r,o,a]}({defaultProp:t,onChange:r}),l=void 0!==e,c=l?e:i;{const t=n.useRef(void 0!==e);n.useEffect((()=>{const e=t.current;if(e!==l){const t=e?"controlled":"uncontrolled",r=l?"controlled":"uncontrolled";console.warn(`${o} is changing from ${t} to ${r}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=l}),[l,o])}const u=n.useCallback((t=>{if(l){const r=function(e){return"function"==typeof e}(t)?t(e):t;r!==e&&s.current?.(r)}else a(t)}),[l,e,a,s]);return[c,u]}var fr=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),hr=n.forwardRef(((t,r)=>e(q.span,{...t,ref:r,style:{...fr,...t.style}})));hr.displayName="VisuallyHidden";var mr=hr,[pr,gr]=W("Tooltip",[Ft]),vr=Ft(),br="TooltipProvider",yr=700,wr="tooltip.open",[xr,Er]=pr(br),kr=t=>{const{__scopeTooltip:r,delayDuration:o=yr,skipDelayDuration:i=300,disableHoverableContent:a=!1,children:s}=t,l=n.useRef(!0),c=n.useRef(!1),u=n.useRef(0);return n.useEffect((()=>{const e=u.current;return()=>window.clearTimeout(e)}),[]),e(xr,{scope:r,isOpenDelayedRef:l,delayDuration:o,onOpen:n.useCallback((()=>{window.clearTimeout(u.current),l.current=!1}),[]),onClose:n.useCallback((()=>{window.clearTimeout(u.current),u.current=window.setTimeout((()=>l.current=!0),i)}),[i]),isPointerInTransitRef:c,onPointerInTransitChange:n.useCallback((e=>{c.current=e}),[]),disableHoverableContent:a,children:s})};kr.displayName=br;var Ar="Tooltip",[Nr,zr]=pr(Ar),Ur=t=>{const{__scopeTooltip:r,children:o,open:i,defaultOpen:a,onOpenChange:s,disableHoverableContent:l,delayDuration:c}=t,u=Er(Ar,t.__scopeTooltip),d=vr(r),[f,h]=n.useState(null),m=le(),p=n.useRef(0),g=l??u.disableHoverableContent,v=c??u.delayDuration,b=n.useRef(!1),[y,w]=dr({prop:i,defaultProp:a??!1,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(wr))):u.onClose(),s?.(e)},caller:Ar}),x=n.useMemo((()=>y?b.current?"delayed-open":"instant-open":"closed"),[y]),E=n.useCallback((()=>{window.clearTimeout(p.current),p.current=0,b.current=!1,w(!0)}),[w]),k=n.useCallback((()=>{window.clearTimeout(p.current),p.current=0,w(!1)}),[w]),A=n.useCallback((()=>{window.clearTimeout(p.current),p.current=window.setTimeout((()=>{b.current=!0,w(!0),p.current=0}),v)}),[v,w]);return n.useEffect((()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)}),[]),e(nr,{...d,children:e(Nr,{scope:r,contentId:m,open:y,stateAttribute:x,trigger:f,onTriggerChange:h,onTriggerEnter:n.useCallback((()=>{u.isOpenDelayedRef.current?A():E()}),[u.isOpenDelayedRef,A,E]),onTriggerLeave:n.useCallback((()=>{g?k():(window.clearTimeout(p.current),p.current=0)}),[k,g]),onOpen:E,onClose:k,disableHoverableContent:g,children:o})})};Ur.displayName=Ar;var _r="TooltipTrigger",Tr=n.forwardRef(((t,r)=>{const{__scopeTooltip:o,...i}=t,a=zr(_r,o),s=Er(_r,o),l=vr(o),c=F(r,n.useRef(null),a.onTriggerChange),u=n.useRef(!1),d=n.useRef(!1),f=n.useCallback((()=>u.current=!1),[]);return n.useEffect((()=>()=>document.removeEventListener("pointerup",f)),[f]),e(or,{asChild:!0,...l,children:e(q.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...i,ref:c,onPointerMove:P(t.onPointerMove,(e=>{"touch"!==e.pointerType&&(d.current||s.isPointerInTransitRef.current||(a.onTriggerEnter(),d.current=!0))})),onPointerLeave:P(t.onPointerLeave,(()=>{a.onTriggerLeave(),d.current=!1})),onPointerDown:P(t.onPointerDown,(()=>{a.open&&a.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})})),onFocus:P(t.onFocus,(()=>{u.current||a.onOpen()})),onBlur:P(t.onBlur,a.onClose),onClick:P(t.onClick,a.onClose)})})}));Tr.displayName=_r;var[Sr,Cr]=pr("TooltipPortal",{forceMount:void 0}),Ir="TooltipContent",Or=n.forwardRef(((t,r)=>{const n=Cr(Ir,t.__scopeTooltip),{forceMount:o=n.forceMount,side:i="top",...a}=t,s=zr(Ir,t.__scopeTooltip);return e(lr,{present:o||s.open,children:s.disableHoverableContent?e(Pr,{side:i,...a,ref:r}):e(Lr,{side:i,...a,ref:r})})})),Lr=n.forwardRef(((t,r)=>{const o=zr(Ir,t.__scopeTooltip),i=Er(Ir,t.__scopeTooltip),a=n.useRef(null),s=F(r,a),[l,c]=n.useState(null),{trigger:u,onClose:d}=o,f=a.current,{onPointerInTransitChange:h}=i,m=n.useCallback((()=>{c(null),h(!1)}),[h]),p=n.useCallback(((e,t)=>{const r=e.currentTarget,n={x:e.clientX,y:e.clientY},o=function(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r})}return n}(n,function(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(r,n,o,i)){case i:return"left";case o:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}(n,r.getBoundingClientRect())),i=function(e){const t=e.slice();return t.sort(((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0)),function(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const n=e[r];for(;t.length>=2;){const e=t[t.length-1],r=t[t.length-2];if(!((e.x-r.x)*(n.y-r.y)>=(e.y-r.y)*(n.x-r.x)))break;t.pop()}t.push(n)}t.pop();const r=[];for(let t=e.length-1;t>=0;t--){const n=e[t];for(;r.length>=2;){const e=r[r.length-1],t=r[r.length-2];if(!((e.x-t.x)*(n.y-t.y)>=(e.y-t.y)*(n.x-t.x)))break;r.pop()}r.push(n)}return r.pop(),1===t.length&&1===r.length&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}(t)}([...o,...function(e){const{top:t,right:r,bottom:n,left:o}=e;return[{x:o,y:t},{x:r,y:t},{x:r,y:n},{x:o,y:n}]}(t.getBoundingClientRect())]);c(i),h(!0)}),[h]);return n.useEffect((()=>()=>m()),[m]),n.useEffect((()=>{if(u&&f){const e=e=>p(e,f),t=e=>p(e,u);return u.addEventListener("pointerleave",e),f.addEventListener("pointerleave",t),()=>{u.removeEventListener("pointerleave",e),f.removeEventListener("pointerleave",t)}}}),[u,f,p,m]),n.useEffect((()=>{if(l){const e=e=>{const t=e.target,r={x:e.clientX,y:e.clientY},n=u?.contains(t)||f?.contains(t),o=!function(e,t){const{x:r,y:n}=e;let o=!1;for(let e=0,i=t.length-1;e<t.length;i=e++){const a=t[e],s=t[i],l=a.x,c=a.y,u=s.x,d=s.y;c>n!=d>n&&r<(u-l)*(n-c)/(d-c)+l&&(o=!o)}return o}(r,l);n?m():o&&(m(),d())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}}),[u,f,l,d,m]),e(Pr,{...t,ref:s})})),[Mr,Rr]=pr(Ar,{isInside:!1}),Br=function(r){const n=({children:r})=>e(t,{children:r});return n.displayName=`${r}.Slottable`,n.__radixId=V,n}("TooltipContent"),Pr=n.forwardRef(((t,o)=>{const{__scopeTooltip:i,children:a,"aria-label":s,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=t,d=zr(Ir,i),f=vr(i),{onClose:h}=d;return n.useEffect((()=>(document.addEventListener(wr,h),()=>document.removeEventListener(wr,h))),[h]),n.useEffect((()=>{if(d.trigger){const e=e=>{const t=e.target;t?.contains(d.trigger)&&h()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}}),[d.trigger,h]),e(re,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:h,children:r(ir,{"data-state":d.stateAttribute,...f,...u,ref:o,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[e(Br,{children:a}),e(Mr,{scope:i,isInside:!0,children:e(mr,{id:d.contentId,role:"tooltip",children:s||a})})]})})}));Or.displayName=Ir;var Dr="TooltipArrow";n.forwardRef(((t,r)=>{const{__scopeTooltip:n,...o}=t,i=vr(n);return Rr(Dr,n).isInside?null:e(ar,{...i,...o,ref:r})})).displayName=Dr;var Hr=kr,Fr=Ur,Wr=Tr,jr=Or;function $r(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=$r(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Gr(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=$r(e))&&(n&&(n+=" "),n+=t);return n}const Kr=e=>{const t=Xr(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{const r=e.split("-");return""===r[0]&&1!==r.length&&r.shift(),Vr(r,t)||qr(e)},getConflictingClassGroupIds:(e,t)=>{const o=r[e]||[];return t&&n[e]?[...o,...n[e]]:o}}},Vr=(e,t)=>{if(0===e.length)return t.